Package com.dnanexus
Class DXEnvironment.Builder
- java.lang.Object
-
- com.dnanexus.DXEnvironment.Builder
-
- Enclosing class:
- DXEnvironment
public static class DXEnvironment.Builder extends Object
Builder class for creating DXEnvironment objects.The resulting DXEnvironment has its fields set from the following sources, in order (with later items overriding earlier items):
- Hardcoded defaults
- JSON config in the file specified at the Builder object's creation time (you can specify
the file using
fromFile(File)). - DX_* environment variables
- Fields set by calling methods on the Builder object
-
-
Constructor Summary
Constructors Constructor Description Builder()Deprecated.UsefromDefaults()instead
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DXEnvironmentbuild()Build the DXEnvironment from the settings configured so far.DXEnvironment.BuilderdisableRetry()Disables automatic retry of HTTP requests.static DXEnvironment.BuilderfromDefaults()Creates a Builder object using the JSON config in the file~/.dnanexus_config/environment.json.static DXEnvironment.BuilderfromEnvironment(DXEnvironment templateEnvironment)Creates a Builder object with initial settings copied from the specified environment.static DXEnvironment.BuilderfromFile(File environmentJsonFile)Creates a Builder object using the JSON config in the specified file.DXEnvironment.BuildermaxTotalConnections(int maxTotalConnections)Sets maxTotalConnections for httpclientDXEnvironment.BuildersetApiserverHost(String apiserverHost)Sets the API server hostname.DXEnvironment.BuildersetApiserverPort(int apiserverPort)Sets the API server port.DXEnvironment.BuildersetApiserverProtocol(String apiserverProtocol)Sets the API server protocol ("http" or "https").DXEnvironment.BuildersetBearerToken(String token)Sets the token to use to authenticate to the Platform.DXEnvironment.BuildersetConnectionTimeout(int connectionTimeout)Sets connection timeout of HTTP requests.DXEnvironment.BuildersetHttpProxy(String httpProxy)Sets the HTTP proxy serverDXEnvironment.BuildersetJob(DXJob job)Sets the current job to the specified job.DXEnvironment.BuildersetMaxDefaultConnectionsPerRoute(int maxDefaultConnectionsPerRoute)Sets maxDefaultConnectionsPerRoute for httpClientDXEnvironment.BuildersetProjectContext(DXProject projectContext)Sets the project context to the specified project.DXEnvironment.BuildersetSecurityContext(com.fasterxml.jackson.databind.JsonNode json)Deprecated.UsesetBearerToken(String)instead.DXEnvironment.BuildersetSocketTimeout(int socketTimeout)Sets socket timeout of HTTP requests.DXEnvironment.BuildersetWorkspace(DXContainer workspace)Sets the workspace to the specified container.
-
-
-
Constructor Detail
-
Builder
@Deprecated public Builder()
Deprecated.UsefromDefaults()insteadInitializes a Builder object using JSON config in the file~/.dnanexus_config/environment.json.
-
-
Method Detail
-
fromDefaults
public static DXEnvironment.Builder fromDefaults()
Creates a Builder object using the JSON config in the file~/.dnanexus_config/environment.json.- Returns:
- new Builder object
-
fromEnvironment
public static DXEnvironment.Builder fromEnvironment(DXEnvironment templateEnvironment)
Creates a Builder object with initial settings copied from the specified environment.- Parameters:
templateEnvironment- environment to initialize this Builder from- Returns:
- new Builder object
-
fromFile
public static DXEnvironment.Builder fromFile(File environmentJsonFile)
Creates a Builder object using the JSON config in the specified file.- Parameters:
environmentJsonFile- JSON file from which to load configuration defaults- Returns:
- new Builder object
-
build
public DXEnvironment build()
Build the DXEnvironment from the settings configured so far.- Returns:
- newly created DXEnvironment
-
setApiserverHost
public DXEnvironment.Builder setApiserverHost(String apiserverHost)
Sets the API server hostname.- Parameters:
apiserverHost- API server hostname- Returns:
- the same Builder object
-
setApiserverPort
public DXEnvironment.Builder setApiserverPort(int apiserverPort)
Sets the API server port.- Parameters:
apiserverPort- API server port- Returns:
- the same Builder object
-
setApiserverProtocol
public DXEnvironment.Builder setApiserverProtocol(String apiserverProtocol)
Sets the API server protocol ("http" or "https").- Parameters:
apiserverProtocol- API server protocol- Returns:
- the same Builder object
-
setBearerToken
public DXEnvironment.Builder setBearerToken(String token)
Sets the token to use to authenticate to the Platform.- Parameters:
token- bearer token- Returns:
- the same Builder object
-
setJob
public DXEnvironment.Builder setJob(DXJob job)
Sets the current job to the specified job.- Parameters:
job- job object- Returns:
- the same Builder object
-
setProjectContext
public DXEnvironment.Builder setProjectContext(DXProject projectContext)
Sets the project context to the specified project.- Parameters:
projectContext- project context- Returns:
- the same Builder object
-
setSecurityContext
@Deprecated public DXEnvironment.Builder setSecurityContext(com.fasterxml.jackson.databind.JsonNode json)
Deprecated.UsesetBearerToken(String)instead.Sets the security context to use to authenticate to the Platform.- Parameters:
json- security context JSON- Returns:
- the same Builder object
-
setWorkspace
public DXEnvironment.Builder setWorkspace(DXContainer workspace)
Sets the workspace to the specified container.- Parameters:
workspace- workspace container- Returns:
- the same Builder object
-
disableRetry
public DXEnvironment.Builder disableRetry()
Disables automatic retry of HTTP requests.- Returns:
- the same Builder object
-
setConnectionTimeout
public DXEnvironment.Builder setConnectionTimeout(int connectionTimeout)
Sets connection timeout of HTTP requests.- Parameters:
connectionTimeout- integer- Returns:
- the same Builder object
-
setSocketTimeout
public DXEnvironment.Builder setSocketTimeout(int socketTimeout)
Sets socket timeout of HTTP requests.- Parameters:
socketTimeout- integer- Returns:
- the same Builder object
-
maxTotalConnections
public DXEnvironment.Builder maxTotalConnections(int maxTotalConnections)
Sets maxTotalConnections for httpclient- Parameters:
maxTotalConnections- integer- Returns:
- the same Builder object
-
setMaxDefaultConnectionsPerRoute
public DXEnvironment.Builder setMaxDefaultConnectionsPerRoute(int maxDefaultConnectionsPerRoute)
Sets maxDefaultConnectionsPerRoute for httpClient- Parameters:
maxDefaultConnectionsPerRoute- integer- Returns:
- the same Builder object
-
setHttpProxy
public DXEnvironment.Builder setHttpProxy(String httpProxy)
Sets the HTTP proxy server- Parameters:
httpProxy- String- Returns:
- the same Builder object
-
-