public class Environment extends Object
Constructor and Description |
---|
Environment(File home)
Call to that constructor should be followed by a call to
init() . |
Environment(File home,
Properties properties)
Call to that constructor should be followed by a call to
init() . |
Modifier and Type | Method and Description |
---|---|
String[] |
getCommandLineArguments() |
File |
getConfig() |
Iterable<URL> |
getConfigurationProvider() |
File |
getData() |
static Environment |
getDefault() |
File |
getHome() |
String |
getHostApplicationName() |
String |
getHostApplicationVersion() |
File |
getLog() |
File |
getPath(String key) |
File |
getPath(String key,
String defaultValue) |
Properties |
getProperties() |
String |
getProperty(String key) |
String |
getProperty(String key,
String defaultValue) |
File |
getRuntimeHome() |
File |
getServerHome()
This method always returns the server home (or
getHome() if NUXEO_HOME_DIR is not set). |
File |
getTemp() |
File |
getWeb() |
void |
init()
Initialization with System properties to avoid issues due to home set with runtime home instead of server home.
|
boolean |
isApplicationServer() |
boolean |
isJBoss() |
boolean |
isJetty() |
boolean |
isTomcat() |
void |
loadProperties(Properties props) |
void |
setCommandLineArguments(String[] args) |
void |
setConfig(File config) |
void |
setConfig(String config)
Resolve the path against
runtimeHome if not absolute. |
void |
setConfigurationProvider(Iterable<URL> configProvider) |
void |
setData(File data) |
void |
setData(String data)
Resolve the path against
runtimeHome if not absolute. |
static void |
setDefault(Environment env) |
void |
setHostApplicationName(String name) |
void |
setHostApplicationVersion(String version) |
void |
setIsApplicationServer(boolean isAppServer) |
void |
setLog(File log) |
void |
setLog(String log)
Resolve the path against
serverHome if not absolute. |
void |
setPath(String key,
File value)
Add a file path as a property
|
void |
setPath(String key,
File value,
File baseDir)
Add a file path as a property
|
void |
setPath(String key,
String value)
Add a file path as a property
|
void |
setPath(String key,
String value,
File baseDir)
Add a file path as a property
|
void |
setProperty(String key,
String value)
If setting a path property, consider using
setPath(String, String) |
void |
setRuntimeHome(File runtimeHome) |
void |
setServerHome(File serverHome) |
void |
setTemp(File temp) |
void |
setTemp(String temp)
Resolve the path against
serverHome if not absolute. |
void |
setWeb(File web) |
void |
setWeb(String web)
Resolve the path against
runtimeHome if not absolute. |
String |
toString() |
public static final String JBOSS_HOST
public static final String NXSERVER_HOST
public static final String TOMCAT_HOST
public static final String NUXEO_HOME_DIR
public static final String NUXEO_HOME
public static final String NUXEO_RUNTIME_HOME
public static final String NUXEO_DATA_DIR
public static final String DEFAULT_DATA_DIR
public static final String NUXEO_LOG_DIR
public static final String DEFAULT_LOG_DIR
public static final String NUXEO_PID_DIR
public static final String NUXEO_TMP_DIR
public static final String DEFAULT_TMP_DIR
public static final String NUXEO_CONFIG_DIR
public static final String DEFAULT_CONFIG_DIR
public static final String NUXEO_WEB_DIR
public static final String DEFAULT_WEB_DIR
public static final String NUXEO_MP_DIR
public static final String DEFAULT_MP_DIR
public static final String NUXEO_CONTEXT_PATH
@Deprecated public static final String HOME_DIR
NUXEO_HOME_DIR
@Deprecated public static final String WEB_DIR
NUXEO_WEB_DIR
@Deprecated public static final String CONFIG_DIR
NUXEO_CONFIG_DIR
@Deprecated public static final String DATA_DIR
NUXEO_DATA_DIR
@Deprecated public static final String LOG_DIR
NUXEO_LOG_DIR
public static final String BUNDLES_DIR
public static final String BUNDLES
protected final Properties properties
protected boolean isAppServer
protected String hostAppName
protected String hostAppVersion
protected Iterable<URL> configProvider
public static final String SERVER_STATUS_KEY
public static final String DISTRIBUTION_NAME
public static final String DISTRIBUTION_VERSION
public static final String DISTRIBUTION_SERVER
public static final String DISTRIBUTION_DATE
public static final String DISTRIBUTION_PACKAGE
public static final String PRODUCT_NAME
public static final String PRODUCT_VERSION
public static final String NUXEO_HTTP_PROXY_HOST
public static final String NUXEO_HTTP_PROXY_PORT
public static final String NUXEO_HTTP_PROXY_LOGIN
public static final String NUXEO_HTTP_PROXY_PASSWORD
public static final String CRYPT_ALGO
public static final String CRYPT_KEY
public static final String CRYPT_KEYALIAS
public static final String CRYPT_KEYSTORE_PATH
public static final String CRYPT_KEYSTORE_PASS
public static final String JAVA_DEFAULT_KEYSTORE
public static final String JAVA_DEFAULT_KEYSTORE_PASS
public Environment(File home)
init()
. Depending on the available System
properties, you may want to also call loadProperties(Properties)
or setServerHome(File)
methods
before init()
; here is the recommended order:
Environment env = new Environment(home); Environment.setDefault(env); env.loadProperties(properties); env.setServerHome(home); env.init();
home
- Root path used for most defaults. It is recommended to make it match the server home rather than the
runtime home.init()
public Environment(File home, Properties properties)
init()
. Depending on the available System
properties, you may want to also call setServerHome(File)
method before init()
; here is the
recommended order:
Environment env = new Environment(home, properties); Environment.setDefault(env); env.setServerHome(home); env.init();
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 an Hashtable
: ie only the custom
values are read, the properties default values are ignored if any.init()
public static void setDefault(Environment env)
public static Environment getDefault()
public boolean isApplicationServer()
public void setIsApplicationServer(boolean isAppServer)
public String getHostApplicationName()
public String getHostApplicationVersion()
public void setHostApplicationName(String name)
public void setHostApplicationVersion(String version)
public void setTemp(String temp)
serverHome
if not absolute.temp
- public void setConfig(String config)
runtimeHome
if not absolute.config
- public void setLog(String log)
serverHome
if not absolute.log
- public void setData(String data)
runtimeHome
if not absolute.data
- public void setWeb(String web)
runtimeHome
if not absolute.web
- public File getRuntimeHome()
public void setRuntimeHome(File runtimeHome)
public String[] getCommandLineArguments()
public void setCommandLineArguments(String[] args)
public String getProperty(String key)
public String getProperty(String key, String defaultValue)
public void setProperty(String key, String value)
setPath(String, String)
public Properties getProperties()
public void loadProperties(Properties props)
public boolean isJBoss()
public boolean isJetty()
public boolean isTomcat()
public void init()
NUXEO_HOME
System property is not set, or if you want to set a custom server home, then you should
call setServerHome(File)
before.public File getServerHome()
getHome()
if NUXEO_HOME_DIR
is not set).public void setServerHome(File serverHome)
public void setConfigurationProvider(Iterable<URL> configProvider)
public Iterable<URL> getConfigurationProvider()
public void setPath(String key, File value, File baseDir)
key
- Property keyvalue
- Property value: an absolute or relative filebaseDir
- The directory against which the file will be resolved if not absolutesetProperty(String, String)
,
setPath(String, String, File)
,
setPath(String, File)
public void setPath(String key, String value, File baseDir)
key
- Property keyvalue
- Property value: an absolute or relative file pathbaseDir
- The directory against which the file will be resolved if not absolutesetProperty(String, String)
,
setPath(String, File, File)
,
setPath(String, File)
public void setPath(String key, File value)
key
- Property keyvalue
- Property value: an absolute or relative file; if relative, it will be resolved against home
setProperty(String, String)
,
setPath(String, File, File)
public void setPath(String key, String value)
key
- Property keyvalue
- Property value: an absolute or relative file path; if relative, it will be resolved against
home
setProperty(String, String)
,
setPath(String, String, File)
public File getPath(String key)
key
- setPath(String, File)
public File getPath(String key, String defaultValue)
key
- the property keydefaultValue
- the default path, absolute or relative to server homesetPath(String, File)
Copyright © 2016 Nuxeo SA. All rights reserved.