Package org.nuxeo.launcher.config
Class ServerConfigurator
- java.lang.Object
-
- org.nuxeo.launcher.config.ServerConfigurator
-
public class ServerConfigurator extends Object
- Author:
- jcarsique
- Implementation Note:
- since 11.1, configurator only handles Tomcat and is no more abstract
-
-
Field Summary
Fields Modifier and Type Field Description protected File
dataDir
protected static String
DEFAULT_CONTEXT_NAME
protected ConfigurationGenerator
generator
static String
JAVA_OPTS
protected File
logDir
static List<String>
NUXEO_SYSTEM_PROPERTIES
protected File
packagesDir
static String
PARAM_HTTP_TOMCAT_ADMIN_PORT
protected File
pidDir
protected File
tmpDir
static String
TOMCAT_HOME
static String
TOMCAT_STARTUP_CLASS
-
Constructor Summary
Constructors Constructor Description ServerConfigurator(ConfigurationGenerator configurationGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkNetwork()
Perform server specific checks, not already done byConfigurationGenerator.checkAddressesAndPorts()
protected void
checkPath(File oldPath, String message)
Check if oldPath exist; if so, then raise a ConfigurationException with information for fixing issuevoid
checkPaths()
Check server paths; warn if existing deprecated paths.protected void
computeKeyVals(List<KeyValueInfo> keyVals, CryptoProperties userConfig, Set<?> keys)
void
dumpProperties(CryptoProperties userConfig)
Properties
filterSystemProperties(CryptoProperties properties)
Extract Nuxeo properties from given Properties (System properties are removed, except those set by Nuxeo)File
getConfigDir()
String
getContextName()
File
getDataDir()
protected String
getDefaultDataDir()
String
getDefaultPackagesDir()
String
getDefaultTmpDir()
File
getDirectory(String key)
InstanceInfo
getInfo(String clid, List<org.nuxeo.connect.update.LocalPackage> pkgs)
Introspect the server and builds the instance infoFile
getLogConfFile()
File
getLogDir()
File
getNuxeoLibDir()
protected File
getOutputDirectory()
File
getPackagesDir()
File
getPidDir()
protected File
getRuntimeHome()
Returns the Home of NuxeoRuntime (same as Framework.getRuntime().getHome().getAbsolutePath())File
getServerLibDir()
File
getTmpDir()
void
initLogs()
Initialize logs.protected boolean
isConfigured()
protected void
parseAndCopy(Properties config)
Generate configuration files from templates and given configuration parametersvoid
setDataDir(String dataDirStr)
void
setDirectory(String key, String directory)
void
setLogDir(String logDirStr)
void
setPidDir(String pidDirStr)
void
setTmpDir(String tmpDirStr)
void
verifyInstallation()
-
-
-
Field Detail
-
TOMCAT_STARTUP_CLASS
public static final String TOMCAT_STARTUP_CLASS
- Since:
- 5.4.2
- See Also:
- Constant Field Values
-
TOMCAT_HOME
public static final String TOMCAT_HOME
- Since:
- 5.6
- See Also:
- Constant Field Values
-
PARAM_HTTP_TOMCAT_ADMIN_PORT
public static final String PARAM_HTTP_TOMCAT_ADMIN_PORT
- Since:
- 5.7
- See Also:
- Constant Field Values
-
NUXEO_SYSTEM_PROPERTIES
public static final List<String> NUXEO_SYSTEM_PROPERTIES
- Since:
- 5.4.2
-
DEFAULT_CONTEXT_NAME
protected static final String DEFAULT_CONTEXT_NAME
- See Also:
- Constant Field Values
-
JAVA_OPTS
public static final String JAVA_OPTS
- Since:
- 9.3
- See Also:
- Constant Field Values
-
generator
protected final ConfigurationGenerator generator
-
packagesDir
protected File packagesDir
-
-
Constructor Detail
-
ServerConfigurator
public ServerConfigurator(ConfigurationGenerator configurationGenerator)
-
-
Method Detail
-
isConfigured
protected boolean isConfigured()
- Returns:
- true if server configuration files already exist
-
getContextName
public String getContextName()
- Returns:
- Configured context name
- Since:
- 5.4.2
-
parseAndCopy
protected void parseAndCopy(Properties config) throws IOException, freemarker.template.TemplateException, ConfigurationException
Generate configuration files from templates and given configuration parameters- Parameters:
config
- Properties with configuration parameters for template replacement- Throws:
IOException
freemarker.template.TemplateException
ConfigurationException
-
getOutputDirectory
protected File getOutputDirectory()
- Returns:
- output directory for files generation
-
getDefaultDataDir
protected String getDefaultDataDir()
- Returns:
- Default data directory path relative to Nuxeo Home
- Since:
- 5.4.2
-
getRuntimeHome
protected File getRuntimeHome()
Returns the Home of NuxeoRuntime (same as Framework.getRuntime().getHome().getAbsolutePath())
-
getDataDir
public File getDataDir()
- Returns:
- Data directory
- Since:
- 5.4.2
-
setDataDir
public void setDataDir(String dataDirStr)
- Parameters:
dataDirStr
- Data directory path to set- Since:
- 5.4.2
-
setLogDir
public void setLogDir(String logDirStr)
- Parameters:
logDirStr
- Log directory path to set- Since:
- 5.4.2
-
initLogs
public void initLogs()
Initialize logs. This is called beforeConfigurationGenerator.init()
so thelogDir
field is not yet initialized- Since:
- 5.4.2
-
getPidDir
public File getPidDir()
- Returns:
- Pid directory (usually known as "run directory"); Returns log directory if not set by configuration.
- Since:
- 5.4.2
-
setPidDir
public void setPidDir(String pidDirStr)
- Parameters:
pidDirStr
- Pid directory path to set- Since:
- 5.4.2
-
checkPaths
public void checkPaths() throws ConfigurationException
Check server paths; warn if existing deprecated paths. Override this method to perform server specific checks.- Throws:
ConfigurationException
- If deprecated paths have been detected- Since:
- 5.4.2
-
getDefaultTmpDir
public String getDefaultTmpDir()
- Returns:
- Default temporary directory path relative to Nuxeo Home
- Since:
- 5.4.2
-
setTmpDir
public void setTmpDir(String tmpDirStr)
- Parameters:
tmpDirStr
- Temporary directory path to set- Since:
- 5.4.2
-
setDirectory
public void setDirectory(String key, String directory)
- Parameters:
key
- directory system keydirectory
- absolute or relative directory path- Since:
- 5.4.2
- See Also:
Environment
-
getDirectory
public File getDirectory(String key)
- Parameters:
key
- directory system key- Returns:
- Directory denoted by key
- Since:
- 5.4.2
- See Also:
Environment
-
checkPath
protected void checkPath(File oldPath, String message) throws ConfigurationException
Check if oldPath exist; if so, then raise a ConfigurationException with information for fixing issue- Parameters:
oldPath
- Path that must NOT existmessage
- Error message thrown with exception- Throws:
ConfigurationException
- If an old path has been discovered
-
getLogConfFile
public File getLogConfFile()
- Returns:
- Log4J configuration file
- Since:
- 5.4.2
-
getConfigDir
public File getConfigDir()
- Returns:
- Nuxeo config directory
- Since:
- 5.4.2
-
dumpProperties
public void dumpProperties(CryptoProperties userConfig)
- Parameters:
userConfig
- Properties to dump into config directory- Since:
- 5.4.2
-
filterSystemProperties
public Properties filterSystemProperties(CryptoProperties properties)
Extract Nuxeo properties from given Properties (System properties are removed, except those set by Nuxeo)- Parameters:
properties
- Properties to be filtered- Returns:
- copy of given properties filtered out of System properties
- Since:
- 5.4.2
-
getNuxeoLibDir
public File getNuxeoLibDir()
- Returns:
- Nuxeo's third party libraries directory
- Since:
- 5.4.1
-
getServerLibDir
public File getServerLibDir()
- Returns:
- Server's third party libraries directory
- Since:
- 5.4.1
-
verifyInstallation
public void verifyInstallation() throws ConfigurationException
- Throws:
ConfigurationException
- Since:
- 5.7
-
checkNetwork
protected void checkNetwork() throws ConfigurationException
Perform server specific checks, not already done byConfigurationGenerator.checkAddressesAndPorts()
- Throws:
ConfigurationException
- Since:
- 5.7
- See Also:
ConfigurationGenerator.checkAddressesAndPorts()
-
getPackagesDir
public File getPackagesDir()
- Returns:
- Marketplace Packages directory
- Since:
- 5.9.4
-
getDefaultPackagesDir
public String getDefaultPackagesDir()
- Returns:
- Default MP directory path relative to Nuxeo Home
- Since:
- 5.9.4
-
getInfo
public InstanceInfo getInfo(String clid, List<org.nuxeo.connect.update.LocalPackage> pkgs)
Introspect the server and builds the instance info- Since:
- 8.3
-
computeKeyVals
protected void computeKeyVals(List<KeyValueInfo> keyVals, CryptoProperties userConfig, Set<?> keys)
-
-