本文整理汇总了Java中org.jclouds.logging.slf4j.config.SLF4JLoggingModule类的典型用法代码示例。如果您正苦于以下问题:Java SLF4JLoggingModule类的具体用法?Java SLF4JLoggingModule怎么用?Java SLF4JLoggingModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SLF4JLoggingModule类属于org.jclouds.logging.slf4j.config包,在下文中一共展示了SLF4JLoggingModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withCompute
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
private <T> T withCompute(ComputeTask<T> task) throws HekateException {
ContextBuilder builder = ContextBuilder.newBuilder(provider)
.credentialsSupplier(credentials::get)
.modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()));
if (!properties.isEmpty()) {
builder.overrides(properties);
}
if (endpoint != null && !endpoint.trim().isEmpty()) {
builder.endpoint(endpoint.trim());
}
try (ComputeServiceContext ctx = builder.buildView(ComputeServiceContext.class)) {
return task.execute(ctx);
}
}
示例2: setUpClass
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws RunNodesException {
Assume.assumeTrue(HekateTestProps.is("AWS_TEST_ENABLED"));
Properties props = new Properties();
props.setProperty(LocationConstants.PROPERTY_REGIONS, REGION);
ContextBuilder builder = newBuilder("aws-ec2").credentials(
ACCESS_KEY,
SECRET_KEY
).overrides(props);
ComputeService compute = builder.modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
.buildView(ComputeServiceContext.class)
.getComputeService();
for (int i = 0; i < 4; i++) {
ensureNodeExists(i, compute);
}
}
示例3: createContextBuilder
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
private static ContextBuilder createContextBuilder(ObjectProperties objectProperties) {
Set<Module> modules = new HashSet<>();
modules.add(new DynamicSshClientModule());
modules.add(new SocketFinderOnlyPublicInterfacesModule());
modules.add(new SLF4JLoggingModule());
Properties overrides = new Properties();
overrides.setProperty("jclouds.ssh.retry-auth", Boolean.FALSE.toString());
overrides.setProperty("jclouds.ssh.max-retries", Integer.toString(1));
ContextBuilder contextBuilder = ContextBuilder.newBuilder("openstack-nova");
String endpoint = objectProperties.getProperty(Config.CloudProvider.Openstack.ENDPOINT);
if (!Strings.isNullOrEmpty(endpoint)) {
contextBuilder.endpoint(endpoint);
}
contextBuilder
.credentials(
objectProperties.getProperty(Config.CloudProvider.Openstack.USERNAME),
objectProperties.getProperty(Config.CloudProvider.Openstack.PASSWORD)
)
.overrides(overrides)
.modules(modules);
return contextBuilder;
}
示例4: S3ProxyImpl
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
public S3ProxyImpl(String endpoint, S3Config s3Config) {
URI uri = URI.create(endpoint);
Properties properties = new Properties();
properties.setProperty("s3proxy.authorization", "none");
properties.setProperty("s3proxy.endpoint", endpoint);
properties.setProperty("jclouds.provider", "filesystem");
properties.setProperty("jclouds.filesystem.basedir", "/tmp/s3proxy");
ContextBuilder builder = ContextBuilder
.newBuilder("filesystem")
.credentials("x", "x")
.modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
.overrides(properties);
BlobStoreContext context = builder.build(BlobStoreContext.class);
BlobStore blobStore = context.getBlobStore();
s3Proxy = S3Proxy.builder().awsAuthentication(AuthenticationType.AWS_V2_OR_V4, "x", "x")
.endpoint(uri)
.keyStore("", "")
.blobStore(blobStore)
.ignoreUnknownHeaders(true)
.build();
client = new S3JerseyCopyPartClient(s3Config);
}
示例5: buildContext
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
public static ContextBuilder buildContext(NovaCredentials credentials) {
Properties properties = new Properties();
properties.setProperty(NovaProperties.AUTO_ALLOCATE_FLOATING_IPS, "true");
Iterable<Module> modules = ImmutableSet.<Module>of(
new SshjSshClientModule(),
new SLF4JLoggingModule(),
new EnterpriseConfigurationModule());
ContextBuilder build = ContextBuilder.newBuilder("aws-ec2")
.credentials(credentials.getAccountName(), credentials.getAccountPass())
.endpoint(credentials.getEndpoint())
.modules(modules)
.overrides(properties);
return build;
}
示例6: OSConnection
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
/**
* Establishes a connection the OpenStack with the given credentials
*
* @param credentials
* @param endpointURL e.g. https://keystone.rc.nectar.org.au:5000/v2.0/
*/
public OSConnection(OSCredentials credentials, String endpointURL) {
Iterable<Module> modules = ImmutableSet.<Module>of(new SLF4JLoggingModule(),
new JschSshClientModule());
String provider = "openstack-nova";
String identity = credentials.getTenantId()+":"+credentials.getUserName();
String credential = credentials.getPassword();
ContextBuilder contextBuilder = ContextBuilder.newBuilder(provider)
.endpoint(endpointURL)
.credentials(identity, credential)
.modules(modules);
novaApi = contextBuilder.buildApi(NovaApi.class);
computeService = contextBuilder.buildView(ComputeServiceContext.class).getComputeService();
DEFAULT_ZONE = novaApi.getConfiguredZones().iterator().next();
}
示例7: setUp
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
containerName = createRandomContainerName();
nearContext = ContextBuilder
.newBuilder("transient")
.credentials("identity", "credential")
.modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
.build(BlobStoreContext.class);
nearBlobStore = nearContext.getBlobStore();
nearBlobStore.createContainerInLocation(null, containerName);
farContext = ContextBuilder
.newBuilder("transient")
.credentials("identity", "credential")
.modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
.build(BlobStoreContext.class);
farBlobStore = farContext.getBlobStore();
farBlobStore.createContainerInLocation(null, containerName);
executorService = Executors.newScheduledThreadPool(1);
eventualBlobStore = EventualBlobStore.newEventualBlobStore(
nearBlobStore, farBlobStore, executorService, DELAY,
DELAY_UNIT, 1.0);
}
示例8: novaApi
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
@Bean
@ConditionalOnProperty("openstack.endpoint")
NovaApi novaApi(@Value("${openstack.endpoint}") String endpoint,
@Value("${openstack.tenant}") String tenant,
@Value("${openstack.username}") String username,
@Value("${openstack.password}") String password) {
String identity = String.format("%s:%s", tenant, username);
// see https://issues.apache.org/jira/browse/JCLOUDS-816
Properties overrides = new Properties();
overrides.put(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.put(Constants.PROPERTY_RELAX_HOSTNAME, "true");
return ContextBuilder.newBuilder("openstack-nova")
.endpoint(endpoint)
.credentials(identity, password)
.modules(Collections.singleton(new SLF4JLoggingModule()))
.overrides(overrides)
.buildApi(NovaApi.class);
}
示例9: addProviderFromConfig
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
private void addProviderFromConfig(String prefix, String provider) {
String id = prefix.substring(prefix.lastIndexOf('.')).substring(1);
logger.info("adding provider from {} id: {}", prefix, id);
Configuration c = config.subset(prefix);
BlobStoreContext context;
try {
ContextBuilder builder = ContextBuilder.newBuilder(provider);
String identity = c.getString(Constants.PROPERTY_IDENTITY);
if (identity != null) {
builder.credentials(identity, c.getString(Constants.PROPERTY_CREDENTIAL));
}
c.addProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true");
context = builder.overrides(new ConfigurationPropertiesView(c))
.modules(ImmutableList.of(new SLF4JLoggingModule()))
.build(BlobStoreContext.class);
logger.info("added provider {} id {}", context.unwrap().getId(), id);
} catch (CreationException e) {
e.printStackTrace();
throw propagate(e);
}
BlobStore blobStore = new LoggingBlobStore(context.getBlobStore(), id, this);
providers.put(Integer.valueOf(id), blobStore);
}
示例10: setUp
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
containerName = Utils.createRandomContainerName();
nearContext = ContextBuilder
.newBuilder("transient")
.credentials("identity", "credential")
.modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
.build(BlobStoreContext.class);
nearBlobStore = nearContext.getBlobStore();
nearBlobStore.createContainerInLocation(null, containerName);
farContext = ContextBuilder
.newBuilder("transient")
.credentials("identity", "credential")
.modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
.build(BlobStoreContext.class);
farBlobStore = farContext.getBlobStore();
farBlobStore.createContainerInLocation(null, containerName);
}
示例11: buildDefaultComputeService
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
public static ComputeService buildDefaultComputeService(IaasProvider iaasProvider) {
Properties properties = new Properties();
// load properties
for (Map.Entry<String, String> entry : iaasProvider.getProperties().entrySet()) {
properties.put(entry.getKey(), entry.getValue());
}
// set modules
Iterable<Module> modules =
ImmutableSet.<Module>of(new SshjSshClientModule(), new SLF4JLoggingModule(),
new EnterpriseConfigurationModule());
// build context
ContextBuilder builder =
ContextBuilder.newBuilder(iaasProvider.getProvider())
.credentials(iaasProvider.getIdentity(), iaasProvider.getCredential()).modules(modules)
.overrides(properties);
return builder.buildView(ComputeServiceContext.class).getComputeService();
}
示例12: blobStoreContextFromProperties
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
private static BlobStoreContext blobStoreContextFromProperties(
Properties properties) {
String provider = properties.getProperty(Constants.PROPERTY_PROVIDER);
String identity = properties.getProperty(Constants.PROPERTY_IDENTITY);
String credential = properties.getProperty(
Constants.PROPERTY_CREDENTIAL);
String endpoint = properties.getProperty(Constants.PROPERTY_ENDPOINT);
if (provider == null || identity == null || credential == null) {
System.err.println("Properties file must contain:\n" +
Constants.PROPERTY_PROVIDER + "\n" +
Constants.PROPERTY_IDENTITY + "\n" +
Constants.PROPERTY_CREDENTIAL);
System.exit(1);
}
ContextBuilder builder = ContextBuilder
.newBuilder(provider)
.credentials(identity, credential)
.modules(ImmutableList.<Module>of(new SLF4JLoggingModule()))
.overrides(properties);
if (endpoint != null) {
builder = builder.endpoint(endpoint);
}
return builder.build(BlobStoreContext.class);
}
示例13: setUp
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
ContextBuilder builder = ContextBuilder
.newBuilder("transient")
.credentials("identity", "credential")
.modules(ImmutableList.<Module>of(new SLF4JLoggingModule()));
context = builder.build(BlobStoreContext.class);
contextRead = builder.build(BlobStoreContext.class);
BlobStore blobStore = context.getBlobStore();
BlobStore blobStoreRead = contextRead.getBlobStore();
String containerName = "container-name";
Location location = null;
blobStore.createContainerInLocation(location, containerName);
blobStoreRead.createContainerInLocation(location, containerName);
awcyStrong = new AreWeConsistentYet(blobStore,
blobStore, containerName, ITERATIONS, OBJECT_SIZE);
awcyEventual = new AreWeConsistentYet(blobStore,
blobStoreRead, containerName, ITERATIONS, OBJECT_SIZE);
}
示例14: getDockerApiFromCarinaDirectory
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
public static DockerApi getDockerApiFromCarinaDirectory(String path) throws IOException {
// docker.ps1 contains the endpoint
String endpoint = "https://" +
Files.readFirstLine(new File(joinPath(path, "docker.ps1")),
Charset.forName("UTF-8")).split("=")[1].replace("\"", "").substring(6);
// enable logging
Iterable<Module> modules = ImmutableSet.<Module> of(new SLF4JLoggingModule());
Properties overrides = new Properties();
// disable certificate checking for Carina
overrides.setProperty("jclouds.trust-all-certs", "true");
return ContextBuilder.newBuilder("docker")
// Use the unencrypted credentials
.credentials(joinPath(path, "cert.pem"), joinPath(path, "key.pem"))
.overrides(overrides)
.endpoint(endpoint)
.modules(modules)
.buildApi(DockerApi.class);
}
示例15: getComputeApiFromCarinaDirectory
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; //导入依赖的package包/类
public static ComputeServiceContext getComputeApiFromCarinaDirectory(String path) throws IOException {
// docker.ps1 contains the endpoint
String endpoint = "https://" +
Files.readFirstLine(new File(joinPath(path, "docker.ps1")),
Charset.forName("UTF-8")).split("=")[1].replace("\"", "").substring(6);
// enable logging and sshj
Iterable<Module> modules = ImmutableSet.<Module> of(new SLF4JLoggingModule(), new SshjSshClientModule());
Properties overrides = new Properties();
// disable certificate checking for Carina
overrides.setProperty("jclouds.trust-all-certs", "true");
return ContextBuilder.newBuilder("docker")
.credentials(joinPath(path, "cert.pem"), joinPath(path, "key.pem"))
.modules(modules)
.overrides(overrides)
.endpoint(endpoint)
.buildView(ComputeServiceContext.class);
}