com.netflix.config
Class ConfigurationBasedDeploymentContext

java.lang.Object
  extended by com.netflix.config.SimpleDeploymentContext
      extended by com.netflix.config.ConfigurationBasedDeploymentContext
All Implemented Interfaces:
DeploymentContext

public class ConfigurationBasedDeploymentContext
extends SimpleDeploymentContext

An implementation of DeploymentContext based on system wide configuration set with ConfigurationManager. All the getters will first consult corresponding property and return the value if set.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.netflix.config.DeploymentContext
DeploymentContext.ContextKey
 
Constructor Summary
ConfigurationBasedDeploymentContext()
           
 
Method Summary
 java.lang.String getApplicationId()
          Get the deployment environment.
 java.lang.String getDeploymentDatacenter()
          Get the deployment environment.
 java.lang.String getDeploymentEnvironment()
          Get the deployment environment.
 java.lang.String getDeploymentRegion()
          Get the deployment environment.
 java.lang.String getDeploymentServerId()
          Get the deployment environment.
 java.lang.String getDeploymentStack()
          Get the deployment environment.
 java.lang.String getValue(DeploymentContext.ContextKey key)
           
 
Methods inherited from class com.netflix.config.SimpleDeploymentContext
setApplicationId, setDeploymentDatacenter, setDeploymentEnvironment, setDeploymentRegion, setDeploymentServerId, setDeploymentStack, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationBasedDeploymentContext

public ConfigurationBasedDeploymentContext()
Method Detail

getDeploymentEnvironment

public java.lang.String getDeploymentEnvironment()
Get the deployment environment. If property "archaius.deployment.environment" is set in the system wide configuration, it will return it. Otherwise, it will return super.getDeploymentEnvironment().

Specified by:
getDeploymentEnvironment in interface DeploymentContext
Overrides:
getDeploymentEnvironment in class SimpleDeploymentContext
Returns:
the deployment environment. For example "test", "dev", "prod".

getDeploymentDatacenter

public java.lang.String getDeploymentDatacenter()
Get the deployment environment. If property "archaius.deployment.datacenter" is set in the system wide configuration, it will return it. Otherwise, it will return super.getDeploymentDatacenter().

Specified by:
getDeploymentDatacenter in interface DeploymentContext
Overrides:
getDeploymentDatacenter in class SimpleDeploymentContext
Returns:
the name or ID of the data center.

getApplicationId

public java.lang.String getApplicationId()
Get the deployment environment. If property "archaius.deployment.applicationId" is set in the system wide configuration, it will return it. Otherwise, it will return super.getApplicationId().

Specified by:
getApplicationId in interface DeploymentContext
Overrides:
getApplicationId in class SimpleDeploymentContext

getDeploymentServerId

public java.lang.String getDeploymentServerId()
Get the deployment environment. If property "archaius.deployment.serverId" is set in the system wide configuration, it will return it. Otherwise, it will return super.getDeploymentServerId().

Specified by:
getDeploymentServerId in interface DeploymentContext
Overrides:
getDeploymentServerId in class SimpleDeploymentContext

getDeploymentStack

public java.lang.String getDeploymentStack()
Get the deployment environment. If property "archaius.deployment.stack" is set in the system wide configuration, it will return it. Otherwise, it will return super.getDeploymentStack().

Specified by:
getDeploymentStack in interface DeploymentContext
Overrides:
getDeploymentStack in class SimpleDeploymentContext
Returns:
a vertical stack name where this application is deployed. The stack name can be used to affect the application's behavior.

getDeploymentRegion

public java.lang.String getDeploymentRegion()
Get the deployment environment. If property "archaius.deployment.region" is set in the system wide configuration, it will return it. Otherwise, it will return super.getDeploymentRegion().

Specified by:
getDeploymentRegion in interface DeploymentContext
Overrides:
getDeploymentRegion in class SimpleDeploymentContext
Returns:
region of the deployment. In EC2, this could be Amazon region "us-east-1", "us-west-1", etc.

getValue

public java.lang.String getValue(DeploymentContext.ContextKey key)
Specified by:
getValue in interface DeploymentContext
Overrides:
getValue in class SimpleDeploymentContext