public class ConfigurationGenerator extends Object
Constructor and Description |
---|
ConfigurationGenerator() |
ConfigurationGenerator(boolean quiet,
boolean debug) |
Modifier and Type | Method and Description |
---|---|
void |
addTemplate(String template)
Add a template to the
PARAM_TEMPLATES_NAME list if not already
present |
void |
changeDBTemplate(String dbTemplate)
Change templates using given database template
|
void |
changeTemplates(String newTemplates) |
void |
checkAddressesAndPorts()
Will check the configured addresses are reachable and Nuxeo required
ports are available on those addresses.
|
static void |
checkAddressReachable(InetAddress address) |
void |
checkDatabaseConnection(String databaseTemplate,
String dbName,
String dbUser,
String dbPassword,
String dbHost,
String dbPort)
Check driver availability and database connection
|
void |
checkJavaVersion()
Check that the process is executed with a supported Java version
|
static void |
checkPortAvailable(InetAddress address,
int port)
Checks if port is available on given address.
|
void |
cleanupPostWizard()
Ensure the wizard won't be started and nuxeo is ready for use
|
String |
extractDatabaseTemplateName()
Extract a database template from the current list of templates.
|
InetAddress |
getBindAddress() |
Map<String,String> |
getChangedParameters(Map<String,String> changedParameters)
Filters given parameters including them only if (there was no previous
value and new value is not empty/null) or (there was a previous value
and it differs from the new value)
|
File |
getConfigDir() |
File |
getDataDir() |
File |
getDistributionMPDir() |
File |
getDumpedConfig() |
Environment |
getEnv() |
List<File> |
getIncludedTemplates() |
File |
getInstallFile() |
File |
getLogDir() |
ArrayList<String> |
getLogFiles() |
File |
getNuxeoConf() |
File |
getNuxeoDefaultConf() |
File |
getNuxeoHome() |
File |
getPidDir() |
File |
getRuntimeHome() |
ServerConfigurator |
getServerConfigurator() |
File |
getTmpDir() |
Properties |
getUserConfig() |
String |
getUserTemplates() |
void |
hideDeprecationWarnings(boolean hide) |
boolean |
init()
Initialize configurator, check requirements and load current
configuration
|
boolean |
init(boolean forceReload)
Initialize configurator, check requirements and load current
configuration
|
void |
initLogs()
Delegate logs initialization to serverConfigurator instance
|
boolean |
isConfigurable() |
boolean |
isForceGeneration() |
boolean |
isInstallInProgress() |
boolean |
isWizardRequired()
Check if wizard must and can be ran
|
static Properties |
loadTrimmedProperties(File propsFile) |
static void |
loadTrimmedProperties(Properties props,
InputStream propsIS) |
static void |
main(String[] args) |
void |
prepareWizardStart()
Ensure the server will start only wizard application, not Nuxeo
|
String |
rebuildTemplatesStr(String dbTemplate)
Rebuild a templates string for use in nuxeo.conf
|
void |
rmTemplate(String template)
Remove a template from the
PARAM_TEMPLATES_NAME list |
void |
run()
Runs the configuration files generation.
|
void |
saveConfiguration(Map<String,String> changedParameters)
Save changed parameters in
nuxeo.conf . |
void |
saveConfiguration(Map<String,String> changedParameters,
boolean setGenerationOnceToFalse,
boolean setGenerationFalseToOnce)
Save changed parameters in
nuxeo.conf calculating templates if
changedParameters contains a value for PARAM_TEMPLATE_DBNAME . |
void |
saveFilteredConfiguration(Map<String,String> changedParameters)
Save changed parameters in
nuxeo.conf , filtering parameters with
#getChangedParametersMap(Map, Map) |
void |
setDirectoryWithProperty(String key) |
void |
setForceGeneration(boolean forceGeneration) |
String |
setProperty(String key,
String value)
Set a property in nuxeo configuration
|
void |
verifyInstallation()
Create needed directories.
|
public static final String[] COMPLIANT_JAVA_VERSIONS
@Deprecated public static final String NUXEO_HOME
Environment#NUXEO_HOME
insteadpublic static final String NUXEO_CONF
public static final String TEMPLATES
@Deprecated public static final String PARAM_TEMPLATE_NAME
PARAM_TEMPLATES_NAME
insteadpublic static final String PARAM_TEMPLATES_NAME
public static final String PARAM_TEMPLATE_DBNAME
public static final String PARAM_TEMPLATE_DBTYPE
@Deprecated public static final String PARAM_TEMPLATES_NODB
public static final String OLD_PARAM_TEMPLATES_PARSING_EXTENSIONS
public static final String PARAM_TEMPLATES_PARSING_EXTENSIONS
public static final String PARAM_TEMPLATES_FREEMARKER_EXTENSIONS
public static final String PARAM_FORCE_GENERATION
public static final String BOUNDARY_BEGIN
public static final String BOUNDARY_END
public static final String PARAM_WIZARD_DONE
public static final String PARAM_WIZARD_RESTART_PARAMS
public static final String PARAM_FAKE_WINDOWS
public static final String PARAM_LOOPBACK_URL
public static final int MIN_PORT
public static final int MAX_PORT
public static final int ADDRESS_PING_TIMEOUT
public static final String PARAM_BIND_ADDRESS
public static final String PARAM_HTTP_PORT
public static final String PARAM_STATUS_KEY
public static final String PARAM_CONTEXT_PATH
public static final String PARAM_MP_DIR
public static final String DISTRIBUTION_MP_DIR
public static final String INSTALL_AFTER_RESTART
public static final String PARAM_DB_DRIVER
public static final String PARAM_DB_JDBC_URL
public static final String PARAM_DB_HOST
public static final String PARAM_DB_PORT
public static final String PARAM_DB_NAME
public static final String PARAM_DB_USER
public static final String PARAM_DB_PWD
public static final String PARAM_PRODUCT_NAME
public static final String PARAM_PRODUCT_VERSION
public static final String PARAM_NUXEO_URL
public static final String NUXEO_DEV_SYSTEM_PROP
public static final String SEAM_DEBUG_SYSTEM_PROP
NUXEO_DEV_SYSTEM_PROP
@Deprecated public static final String SEAM_HOT_RELOAD_GLOBAL_CONFIG_FILE
SEAM_DEBUG_SYSTEM_PROP
in nuxeo.conf is enough now.public boolean isJBoss
public boolean isJetty
public boolean isTomcat
public ConfigurationGenerator()
public ConfigurationGenerator(boolean quiet, boolean debug)
quiet
- Suppress info level messages from the console outputdebug
- Activate debug level loggingpublic boolean isConfigurable()
public void hideDeprecationWarnings(boolean hide)
public void setForceGeneration(boolean forceGeneration)
forceGeneration
- PARAM_FORCE_GENERATION
public boolean isForceGeneration()
PARAM_FORCE_GENERATION
public Properties getUserConfig()
public final ServerConfigurator getServerConfigurator()
public void run() throws ConfigurationException
ConfigurationException
public boolean init()
public boolean init(boolean forceReload)
forceReload
- If true, forces configuration reload.public void changeTemplates(String newTemplates)
public void changeDBTemplate(String dbTemplate)
dbTemplate
- new database templatepublic void setDirectoryWithProperty(String key)
key
- Directory system keyEnvironment
public String getUserTemplates()
public File getNuxeoHome()
public File getNuxeoDefaultConf()
public static void main(String[] args) throws ConfigurationException
ConfigurationException
public void saveConfiguration(Map<String,String> changedParameters) throws ConfigurationException
nuxeo.conf
. This method does not
check values in map. Use saveFilteredConfiguration(Map)
for
parameters filtering.changedParameters
- Map of modified parametersConfigurationException
saveFilteredConfiguration(Map)
public void saveConfiguration(Map<String,String> changedParameters, boolean setGenerationOnceToFalse, boolean setGenerationFalseToOnce) throws ConfigurationException
nuxeo.conf
calculating templates if
changedParameters contains a value for PARAM_TEMPLATE_DBNAME
. If
a parameter value is empty ("" or null), then the property is unset. This
method does not check values in map: use
saveFilteredConfiguration(Map)
for parameters filtering.changedParameters
- Map of modified parameterssetGenerationOnceToFalse
- If generation was on (true or once),
then set it to false or not?setGenerationFalseToOnce
- If generation was off (false), then set
it to once?ConfigurationException
saveFilteredConfiguration(Map)
public void saveFilteredConfiguration(Map<String,String> changedParameters) throws ConfigurationException
nuxeo.conf
, filtering parameters with
#getChangedParametersMap(Map, Map)
changedParameters
- Maps of modified parametersConfigurationException
#saveConfiguration(Map, boolean)
,
#getChangedParametersMap(Map, Map)
public Map<String,String> getChangedParameters(Map<String,String> changedParameters)
changedParameters
- parameters to be filteredpublic String extractDatabaseTemplateName()
rebuildTemplatesStr(String)
public File getNuxeoConf()
public void initLogs()
public File getLogDir()
public File getPidDir()
public File getDataDir()
public void verifyInstallation() throws ConfigurationException
ConfigurationException
- If a deprecated directory has been
detected.ServerConfigurator.verifyInstallation()
public void checkJavaVersion() throws ConfigurationException
ConfigurationException
public void checkAddressesAndPorts() throws ConfigurationException
#bindAddress
must be set before.ConfigurationException
ServerConfigurator.checkNetwork()
public InetAddress getBindAddress() throws ConfigurationException
ConfigurationException
public static void checkAddressReachable(InetAddress address) throws ConfigurationException
address
- address to check for availabilityConfigurationException
public static void checkPortAvailable(InetAddress address, int port) throws ConfigurationException
port
- port to check for availabilityConfigurationException
- Throws an exception if address is
unavailable.public File getTmpDir()
public ArrayList<String> getLogFiles()
public boolean isWizardRequired()
public String rebuildTemplatesStr(String dbTemplate)
dbTemplate
- database template to use instead of current oneextractDatabaseTemplateName()
,
#changeDBTemplate(String)}
,
#changeTemplates(String)}
public File getConfigDir()
public void prepareWizardStart()
public void cleanupPostWizard()
public File getRuntimeHome()
public boolean isInstallInProgress()
public File getDistributionMPDir()
public File getInstallFile()
public void addTemplate(String template) throws ConfigurationException
PARAM_TEMPLATES_NAME
list if not already
presenttemplate
- Template to addConfigurationException
public void rmTemplate(String template) throws ConfigurationException
PARAM_TEMPLATES_NAME
listtemplate
- ConfigurationException
public String setProperty(String key, String value) throws ConfigurationException
key
- value
- ConfigurationException
public void checkDatabaseConnection(String databaseTemplate, String dbName, String dbUser, String dbPassword, String dbHost, String dbPort) throws FileNotFoundException, IOException, DatabaseDriverException, SQLException
databaseTemplate
- Nuxeo database templatedbName
- nuxeo.db.name parameter in nuxeo.confdbUser
- nuxeo.db.user parameter in nuxeo.confdbPassword
- nuxeo.db.password parameter in nuxeo.confdbHost
- nuxeo.db.host parameter in nuxeo.confdbPort
- nuxeo.db.port parameter in nuxeo.confDatabaseDriverException
IOException
FileNotFoundException
SQLException
public Environment getEnv()
Environment
initialized with a few basicspublic static Properties loadTrimmedProperties(File propsFile) throws IOException
props
- Properties object to be filledpropsFile
- Properties filepropsFile
IOException
public static void loadTrimmedProperties(Properties props, InputStream propsIS) throws IOException
props
- Properties object to be filledpropsIS
- Properties InputStreamIOException
public File getDumpedConfig()
Copyright © 2013 Nuxeo SA. All Rights Reserved.