Package org.nuxeo.common
Class Environment
- java.lang.Object
-
- org.nuxeo.common.Environment
-
public class Environment extends Object
- Author:
- Bogdan Stefanescu
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Environment(File home)Call to that constructor should be followed by a call toinit().Environment(File home, Properties properties)Call to that constructor should be followed by a call toinit().
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]getCommandLineArguments()FilegetConfig()Iterable<URL>getConfigurationProvider()FilegetData()static EnvironmentgetDefault()static EnvironmentgetDefault(Properties systemProperties)StringgetDistributionDate()protected voidgetDistributionInfo()StringgetDistributionVersion()FilegetHome()StringgetHostApplicationName()StringgetHostApplicationVersion()FilegetLog()FilegetPath(String key)FilegetPath(String key, String defaultValue)PropertiesgetProperties()StringgetProperty(String key)StringgetProperty(String key, String defaultValue)FilegetRuntimeHome()FilegetServerHome()This method always returns the server home (orgetHome()ifNUXEO_HOME_DIRis not set).FilegetTemp()FilegetWeb()voidinit()Initialization with System properties to avoid issues due to home set with runtime home instead of server home.booleanisApplicationServer()booleanisJBoss()booleanisJetty()booleanisTomcat()voidloadProperties(Properties props)voidsetCommandLineArguments(String[] args)voidsetConfig(File config)voidsetConfig(String config)Resolve the path againstruntimeHomeif not absolute.voidsetConfigurationProvider(Iterable<URL> configProvider)voidsetData(File data)voidsetData(String data)Resolve the path againstruntimeHomeif not absolute.static voidsetDefault(Environment env)voidsetHostApplicationName(String name)voidsetHostApplicationVersion(String version)voidsetIsApplicationServer(boolean isAppServer)voidsetLog(File log)voidsetLog(String log)Resolve the path againstserverHomeif not absolute.voidsetPath(String key, File value)Add a file path as a propertyvoidsetPath(String key, File value, File baseDir)Add a file path as a propertyvoidsetPath(String key, String value)Add a file path as a propertyvoidsetPath(String key, String value, File baseDir)Add a file path as a propertyvoidsetProperty(String key, String value)If setting a path property, consider usingsetPath(String, String)voidsetRuntimeHome(File runtimeHome)voidsetServerHome(File serverHome)voidsetTemp(File temp)voidsetTemp(String temp)Resolve the path againstserverHomeif not absolute.voidsetWeb(File web)voidsetWeb(String web)Resolve the path againstruntimeHomeif not absolute.StringtoString()
-
-
-
Field Detail
-
JBOSS_HOST
public static final String JBOSS_HOST
Constants that identifies possible hosts for the framework.- See Also:
- Constant Field Values
-
NXSERVER_HOST
public static final String NXSERVER_HOST
- See Also:
- Constant Field Values
-
TOMCAT_HOST
public static final String TOMCAT_HOST
- See Also:
- Constant Field Values
-
NUXEO_HOME_DIR
public static final String NUXEO_HOME_DIR
- See Also:
- Constant Field Values
-
NUXEO_HOME
public static final String NUXEO_HOME
- Since:
- 5.6
- See Also:
- Constant Field Values
-
NUXEO_RUNTIME_HOME
public static final String NUXEO_RUNTIME_HOME
- Since:
- 5.4.2
- See Also:
- Constant Field Values
-
NUXEO_DATA_DIR
public static final String NUXEO_DATA_DIR
- See Also:
- Constant Field Values
-
DEFAULT_DATA_DIR
public static final String DEFAULT_DATA_DIR
- Since:
- 5.9.4
- See Also:
- Constant Field Values
-
NUXEO_LOG_DIR
public static final String NUXEO_LOG_DIR
- See Also:
- Constant Field Values
-
DEFAULT_LOG_DIR
public static final String DEFAULT_LOG_DIR
- Since:
- 5.9.4
- See Also:
- Constant Field Values
-
NUXEO_PID_DIR
public static final String NUXEO_PID_DIR
- See Also:
- Constant Field Values
-
NUXEO_TMP_DIR
public static final String NUXEO_TMP_DIR
- See Also:
- Constant Field Values
-
DEFAULT_TMP_DIR
public static final String DEFAULT_TMP_DIR
- Since:
- 5.9.4
- See Also:
- Constant Field Values
-
NUXEO_CONFIG_DIR
public static final String NUXEO_CONFIG_DIR
- See Also:
- Constant Field Values
-
DEFAULT_CONFIG_DIR
public static final String DEFAULT_CONFIG_DIR
- Since:
- 5.9.4
- See Also:
- Constant Field Values
-
NUXEO_WEB_DIR
public static final String NUXEO_WEB_DIR
- See Also:
- Constant Field Values
-
DEFAULT_WEB_DIR
public static final String DEFAULT_WEB_DIR
- Since:
- 5.9.4
- See Also:
- Constant Field Values
-
NUXEO_MP_DIR
public static final String NUXEO_MP_DIR
- Since:
- 5.9.4
- See Also:
- Constant Field Values
-
DEFAULT_MP_DIR
public static final String DEFAULT_MP_DIR
- Since:
- 5.9.4
- See Also:
- Constant Field Values
-
NUXEO_CONTEXT_PATH
public static final String NUXEO_CONTEXT_PATH
- Since:
- 5.6
- See Also:
- Constant Field Values
-
BUNDLES_DIR
public static final String BUNDLES_DIR
The application layout (optional): directory containing nuxeo runtime osgi bundles.- See Also:
- Constant Field Values
-
BUNDLES
public static final String BUNDLES
- See Also:
- Constant Field Values
-
home
protected final File home
-
data
protected File data
-
log
protected File log
-
config
protected File config
-
web
protected File web
-
temp
protected File temp
-
properties
protected final Properties properties
-
args
protected String[] args
-
isAppServer
protected boolean isAppServer
-
hostAppName
protected String hostAppName
-
hostAppVersion
protected String hostAppVersion
-
distributionVersion
protected String distributionVersion
-
distributionDate
protected String distributionDate
-
SERVER_STATUS_KEY
public static final String SERVER_STATUS_KEY
- See Also:
- Constant Field Values
-
DISTRIBUTION_NAME
public static final String DISTRIBUTION_NAME
- See Also:
- Constant Field Values
-
DISTRIBUTION_VERSION
public static final String DISTRIBUTION_VERSION
- See Also:
- Constant Field Values
-
DISTRIBUTION_SERVER
public static final String DISTRIBUTION_SERVER
- Since:
- 7.10
- See Also:
- Constant Field Values
-
DISTRIBUTION_DATE
public static final String DISTRIBUTION_DATE
- Since:
- 7.10
- See Also:
- Constant Field Values
-
DISTRIBUTION_PACKAGE
public static final String DISTRIBUTION_PACKAGE
- Since:
- 7.10
- See Also:
- Constant Field Values
-
DISTRIBUTION_HOTFIX
public static final String DISTRIBUTION_HOTFIX
- Since:
- 11.5
- See Also:
- Constant Field Values
-
DISTRIBUTION_PROPERTY_FILE
public static final String DISTRIBUTION_PROPERTY_FILE
- Since:
- 11.5
- See Also:
- Constant Field Values
-
PRODUCT_NAME
public static final String PRODUCT_NAME
- Since:
- 7.10
- See Also:
- Constant Field Values
-
PRODUCT_VERSION
public static final String PRODUCT_VERSION
- Since:
- 7.10
- See Also:
- Constant Field Values
-
NUXEO_HTTP_PROXY_HOST
public static final String NUXEO_HTTP_PROXY_HOST
- Since:
- 6.0
- See Also:
- Constant Field Values
-
NUXEO_HTTP_PROXY_PORT
public static final String NUXEO_HTTP_PROXY_PORT
- Since:
- 6.0
- See Also:
- Constant Field Values
-
NUXEO_HTTP_PROXY_LOGIN
public static final String NUXEO_HTTP_PROXY_LOGIN
- Since:
- 6.0
- See Also:
- Constant Field Values
-
NUXEO_HTTP_PROXY_PASSWORD
public static final String NUXEO_HTTP_PROXY_PASSWORD
- Since:
- 6.0
- See Also:
- Constant Field Values
-
CRYPT_ALGO
public static final String CRYPT_ALGO
- Since:
- 7.4
- See Also:
- Constant Field Values
-
CRYPT_KEY
public static final String CRYPT_KEY
- Since:
- 7.4
- See Also:
- Constant Field Values
-
CRYPT_KEYALIAS
public static final String CRYPT_KEYALIAS
- Since:
- 7.4
- See Also:
- Constant Field Values
-
CRYPT_KEYSTORE_PATH
public static final String CRYPT_KEYSTORE_PATH
- Since:
- 7.4
- See Also:
- Constant Field Values
-
CRYPT_KEYSTORE_PASS
public static final String CRYPT_KEYSTORE_PASS
- Since:
- 7.4
- See Also:
- Constant Field Values
-
JAVA_DEFAULT_KEYSTORE
public static final String JAVA_DEFAULT_KEYSTORE
- Since:
- 7.4
- See Also:
- Constant Field Values
-
JAVA_DEFAULT_KEYSTORE_PASS
public static final String JAVA_DEFAULT_KEYSTORE_PASS
- Since:
- 7.4
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Environment
public Environment(File home)
Call to that constructor should be followed by a call toinit(). Depending on the available System properties, you may want to also callloadProperties(Properties)orsetServerHome(File)methods beforeinit(); here is the recommended order:Environment env = new Environment(home); Environment.setDefault(env); env.loadProperties(properties); env.setServerHome(home); env.init();
- Parameters:
home- Root path used for most defaults. It is recommended to make it match the server home rather than the runtime home.- See Also:
init()
-
Environment
public Environment(File home, Properties properties)
Call to that constructor should be followed by a call toinit(). Depending on the available System properties, you may want to also callsetServerHome(File)method beforeinit(); here is the recommended order:Environment env = new Environment(home, properties); Environment.setDefault(env); env.setServerHome(home); env.init();
- Parameters:
home- Root path used for most defaults. It is recommended to make it match the server home rather than the runtime home.properties- Source properties for initialization. It is used as anHashtable: ie only the custom values are read, the properties default values are ignored if any.- See Also:
init()
-
-
Method Detail
-
setDefault
public static void setDefault(Environment env)
-
getDefault
public static Environment getDefault()
-
getDefault
public static Environment getDefault(Properties systemProperties)
- Since:
- 11.5
-
getHome
public File getHome()
-
isApplicationServer
public boolean isApplicationServer()
-
setIsApplicationServer
public void setIsApplicationServer(boolean isAppServer)
-
getHostApplicationName
public String getHostApplicationName()
-
getHostApplicationVersion
public String getHostApplicationVersion()
-
setHostApplicationName
public void setHostApplicationName(String name)
-
setHostApplicationVersion
public void setHostApplicationVersion(String version)
-
getTemp
public File getTemp()
-
setTemp
public void setTemp(String temp)
Resolve the path againstserverHomeif not absolute.- Since:
- 8.1
-
setTemp
public void setTemp(File temp)
-
getConfig
public File getConfig()
-
setConfig
public void setConfig(String config)
Resolve the path againstruntimeHomeif not absolute.- Since:
- 8.1
-
setConfig
public void setConfig(File config)
-
getLog
public File getLog()
-
setLog
public void setLog(String log)
Resolve the path againstserverHomeif not absolute.- Since:
- 8.1
-
setLog
public void setLog(File log)
-
getData
public File getData()
-
setData
public void setData(String data)
Resolve the path againstruntimeHomeif not absolute.- Since:
- 8.1
-
setData
public void setData(File data)
-
getWeb
public File getWeb()
-
setWeb
public void setWeb(String web)
Resolve the path againstruntimeHomeif not absolute.- Since:
- 8.1
-
setWeb
public void setWeb(File web)
-
getRuntimeHome
public File getRuntimeHome()
- Since:
- 5.4.2
-
setRuntimeHome
public void setRuntimeHome(File runtimeHome)
- Since:
- 5.4.2
-
getCommandLineArguments
public String[] getCommandLineArguments()
-
setCommandLineArguments
public void setCommandLineArguments(String[] args)
-
setProperty
public void setProperty(String key, String value)
If setting a path property, consider usingsetPath(String, String)
-
getProperties
public Properties getProperties()
-
loadProperties
public void loadProperties(Properties props)
-
isJBoss
public boolean isJBoss()
-
isJetty
public boolean isJetty()
-
isTomcat
public boolean isTomcat()
-
init
public void init()
Initialization with System properties to avoid issues due to home set with runtime home instead of server home. IfNUXEO_HOMESystem property is not set, or if you want to set a custom server home, then you should callsetServerHome(File)before.- Since:
- 5.4.1
-
getServerHome
public File getServerHome()
This method always returns the server home (orgetHome()ifNUXEO_HOME_DIRis not set).- Returns:
- Server home
- Since:
- 5.4.2
-
setServerHome
public void setServerHome(File serverHome)
- Since:
- 5.4.2
-
setPath
public void setPath(String key, File value, File baseDir)
Add a file path as a property- Parameters:
key- Property keyvalue- Property value: an absolute or relative filebaseDir- The directory against which the file will be resolved if not absolute- Since:
- 8.1
- See Also:
setProperty(String, String),setPath(String, String, File),setPath(String, File)
-
setPath
public void setPath(String key, String value, File baseDir)
Add a file path as a property- Parameters:
key- Property keyvalue- Property value: an absolute or relative file pathbaseDir- The directory against which the file will be resolved if not absolute- Since:
- 8.1
- See Also:
setProperty(String, String),setPath(String, File, File),setPath(String, File)
-
setPath
public void setPath(String key, File value)
Add a file path as a property- Parameters:
key- Property keyvalue- Property value: an absolute or relative file; if relative, it will be resolved againsthome- Since:
- 8.1
- See Also:
setProperty(String, String),setPath(String, File, File)
-
setPath
public void setPath(String key, String value)
Add a file path as a property- Parameters:
key- Property keyvalue- Property value: an absolute or relative file path; if relative, it will be resolved againsthome- Since:
- 8.1
- See Also:
setProperty(String, String),setPath(String, String, File)
-
getPath
public File getPath(String key)
- Returns:
- the file which path is associated with the given key. The file is guaranteed to be absolute if it has
been set with
setPath(String, File) - Since:
- 8.1
-
getPath
public File getPath(String key, String defaultValue)
- Parameters:
key- the property keydefaultValue- the default path, absolute or relative to server home- Returns:
- the file which path is associated with the given key. The file is guaranteed to be absolute if it has
been set with
setPath(String, File) - Since:
- 8.1
-
getDistributionVersion
public String getDistributionVersion()
- Returns:
- the version of the Nuxeo distribution
- Since:
- 11.5
-
getDistributionDate
public String getDistributionDate()
- Returns:
- the build date of the Nuxeo distribution
- Since:
- 11.5
-
getDistributionInfo
protected void getDistributionInfo()
-
-