public class ConfigurationGenerator extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ADDRESS_PING_TIMEOUT |
static String |
BOUNDARY_BEGIN |
static String |
BOUNDARY_END |
static List<String> |
DB_LIST |
boolean |
isJBoss |
boolean |
isJetty |
boolean |
isTomcat |
static int |
MAX_PORT |
static int |
MIN_PORT |
static String |
NUXEO_CONF |
static String |
NUXEO_HOME |
static String |
PARAM_BIND_ADDRESS |
static String |
PARAM_CONTEXT_PATH |
static String |
PARAM_FAKE_WINDOWS |
static String |
PARAM_FORCE_GENERATION |
static String |
PARAM_HTTP_PORT |
static String |
PARAM_LOOPBACK_URL |
static String |
PARAM_STATUS_KEY |
static String |
PARAM_TEMPLATE_DBNAME |
static String |
PARAM_TEMPLATE_NAME
Deprecated.
use
PARAM_TEMPLATES_NAME instead |
static String |
PARAM_TEMPLATES_NAME
Absolute or relative PATH to the user chosen templates (comma separated
list)
|
static String |
PARAM_TEMPLATES_NODB |
static String |
PARAM_TEMPLATES_PARSING_EXTENSIONS |
static String |
PARAM_WIZARD_DONE |
static String |
PARAM_WIZARD_RESTART_PARAMS |
Constructor and Description |
---|
ConfigurationGenerator() |
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) |
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 a list of templates.
|
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() |
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() |
boolean |
init()
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 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 . |
void |
saveFilteredConfiguration(Map<String,String> changedParameters)
Save changed parameters in
nuxeo.conf , filtering parameters with
#getChangedParametersMap(Map, Map) and calculating templates if
changedParameters contains a value for PARAM_TEMPLATE_DBNAME |
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 NUXEO_HOME
public static final String NUXEO_CONF
@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_TEMPLATES_NODB
public static final String PARAM_TEMPLATES_PARSING_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 boolean isJBoss
public boolean isJetty
public boolean isTomcat
public boolean isConfigurable()
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 void changeTemplates(String newTemplates)
public void changeDBTemplate(String dbTemplate)
dbTemplate
- new database templatepublic void setDirectoryWithProperty(String key)
key
- Directory system keyEnvironment
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
.
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)
and calculating templates if
changedParameters contains a value for PARAM_TEMPLATE_DBNAME
changedParameters
- Maps of modified parametersConfigurationException
getChangedParameters(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.public void checkAddressesAndPorts() throws ConfigurationException
#bindAddress
must be set
before.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 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
Copyright © 2011 Nuxeo SA. All Rights Reserved.