mirror of https://github.com/apache/jclouds.git
Issue 112: added factory
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2436 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
107ef1c040
commit
da8206a64a
|
@ -0,0 +1,43 @@
|
|||
package org.jclouds.vcloud.terremark;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
||||
import org.jclouds.logging.jdk.config.JDKLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Creates {@link TerremarkVCloudContext} instances based on the most commonly requested arguments.
|
||||
* <p/>
|
||||
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* If no <code>Module</code>s are specified, the default {@link JDKLoggingModule logging} and
|
||||
* {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @see TerremarkVCloudContext
|
||||
*/
|
||||
public class TerremarkVCloudContextFactory {
|
||||
|
||||
public static RestContext<TerremarkVCloudAsyncClient, TerremarkVCloudClient> createContext(String username, String password,
|
||||
Module... modules) {
|
||||
return new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(username, password).build())
|
||||
.withModules(modules).buildContext();
|
||||
}
|
||||
|
||||
public static RestContext<TerremarkVCloudAsyncClient, TerremarkVCloudClient> createContext(URI endpoint, String username,
|
||||
String password, Module... modules) {
|
||||
return new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(username, password).withEndpoint(
|
||||
endpoint).build()).withModules(modules).buildContext();
|
||||
}
|
||||
|
||||
public static RestContext<TerremarkVCloudAsyncClient, TerremarkVCloudClient> createContext(Properties props, Module... modules) {
|
||||
return new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(props).build())
|
||||
.withModules(modules).buildContext();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue