use of org.jclouds.enterprise.config.EnterpriseConfigurationModule in project acceptance-test-harness by jenkinsci.
the class JcloudsMachineProvider method initComputeService.
private ContextBuilder initComputeService(String provider, String identity, String credential) {
Iterable<Module> modules = ImmutableSet.<Module>of(new SshjSshClientModule(), new SLF4JLoggingModule(), new EnterpriseConfigurationModule());
ContextBuilder contextBuilder = ContextBuilder.newBuilder(provider).credentials(identity, credential).modules(modules).overrides(getOptions());
logger.info(String.format("Initializing %s", contextBuilder.getApiMetadata()));
return contextBuilder;
}
use of org.jclouds.enterprise.config.EnterpriseConfigurationModule in project legacy-jclouds-examples by jclouds.
the class MainApp method initComputeService.
private static ComputeService initComputeService(String provider, String identity, String credential) {
// example of specific properties, in this case optimizing image list to
// only amazon supplied
Properties properties = new Properties();
properties.setProperty(PROPERTY_EC2_AMI_QUERY, "owner-id=137112412989;state=available;image-type=machine");
properties.setProperty(PROPERTY_EC2_CC_AMI_QUERY, "");
long scriptTimeout = TimeUnit.MILLISECONDS.convert(20, TimeUnit.MINUTES);
properties.setProperty(TIMEOUT_SCRIPT_COMPLETE, scriptTimeout + "");
// example of injecting a ssh implementation
Iterable<Module> modules = ImmutableSet.<Module>of(new SshjSshClientModule(), new SLF4JLoggingModule(), new EnterpriseConfigurationModule());
ContextBuilder builder = ContextBuilder.newBuilder(provider).credentials(identity, credential).modules(modules).overrides(properties);
System.out.printf(">> initializing %s%n", builder.getApiMetadata());
return builder.buildView(ComputeServiceContext.class).getComputeService();
}
use of org.jclouds.enterprise.config.EnterpriseConfigurationModule in project legacy-jclouds-examples by jclouds.
the class MainApp method initComputeService.
private static ComputeService initComputeService(String provider, String identity, String credential) {
// example of specific properties, in this case optimizing image list to
// only amazon supplied
Properties properties = new Properties();
properties.setProperty(PROPERTY_EC2_AMI_QUERY, "owner-id=137112412989;state=available;image-type=machine");
properties.setProperty(PROPERTY_EC2_CC_AMI_QUERY, "");
long scriptTimeout = TimeUnit.MILLISECONDS.convert(20, TimeUnit.MINUTES);
properties.setProperty(TIMEOUT_SCRIPT_COMPLETE, scriptTimeout + "");
// example of injecting a ssh implementation
Iterable<Module> modules = ImmutableSet.<Module>of(new SshjSshClientModule(), new SLF4JLoggingModule(), new EnterpriseConfigurationModule());
ContextBuilder builder = ContextBuilder.newBuilder(provider).credentials(identity, credential).modules(modules).overrides(properties);
System.out.printf(">> initializing %s%n", builder.getApiMetadata());
return builder.buildView(ComputeServiceContext.class).getComputeService();
}
use of org.jclouds.enterprise.config.EnterpriseConfigurationModule in project legacy-jclouds-examples by jclouds.
the class MainApp method initController.
private static MinecraftController initController(String provider, String identity, String credential, String group) {
Properties properties = new Properties();
properties.setProperty("minecraft.port", "25565");
properties.setProperty("minecraft.group", group);
properties.setProperty("minecraft.ms", "1024");
properties.setProperty("minecraft.mx", "1024");
properties.setProperty("minecraft.url", "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar");
if ("aws-ec2".equals(provider)) {
// since minecraft download is in s3 on us-east, lowest latency is from
// there
properties.setProperty(PROPERTY_REGIONS, "us-east-1");
properties.setProperty("jclouds.ec2.ami-query", "owner-id=137112412989;state=available;image-type=machine");
properties.setProperty("jclouds.ec2.cc-ami-query", "");
}
// example of injecting a ssh implementation
Iterable<Module> modules = ImmutableSet.<Module>of(new SshjSshClientModule(), new SLF4JLoggingModule(), new EnterpriseConfigurationModule(), // This is extended stuff you might inject!!
new ConfigureMinecraftDaemon());
ContextBuilder builder = ContextBuilder.newBuilder(provider).credentials(identity, credential).modules(modules).overrides(properties);
System.out.printf(">> initializing %s%n", builder.getApiMetadata());
ComputeServiceContext context = builder.buildView(ComputeServiceContext.class);
context.utils().eventBus().register(ScriptLogger.INSTANCE);
return context.utils().injector().getInstance(MinecraftController.class);
}
Aggregations