Package org.nuxeo.launcher.config
Class ConfigurationChecker
java.lang.Object
org.nuxeo.launcher.config.ConfigurationChecker
- Since:
- 11.5
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final Path
protected static final String[]
protected static final String
protected static final String
protected static final String
protected static final String
protected static final int
protected static final int
protected static final int
protected static final int
protected static final String
protected static final String
protected static final String
protected final Properties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected net.jodah.failsafe.RetryPolicy<Object>
buildRetryPolicy
(ConfigurationHolder configHolder) protected void
checkAddressesAndPorts
(ConfigurationHolder configHolder) Will check the configured addresses are reachable and Nuxeo required ports are available on those addresses.protected void
checkAddressReachable
(InetAddress address) void
checkBackingServices
(ConfigurationHolder configHolder) Calls allBackingChecker
if they accept the current configuration.static void
Checks that the process is executed with a supported Java version.static boolean
checkJavaVersion
(String version, String requiredVersion) Checks the java version compared to the required one.protected void
checkJavaVersion
(String version, String[] compliantVersions) Checks the given java version compared to the given compliant ones.protected boolean
checkJavaVersion
(String version, String requiredVersion, boolean allowNoFailFlag, boolean warnIfLooseCompliance) Checks the java version compared to the required one.protected void
Checks the java version present in system properties compared to compliant ones.protected void
checkPaths
(ConfigurationHolder configHolder) Checks server paths; warn if deprecated paths exist.protected void
checkPortAvailable
(InetAddress address, int port) Checks if port is available on given address.protected URL
convertToJarFileURL
(Path path) protected URLClassLoader
getBackingCheckerClassLoader
(ConfigurationHolder configHolder, String checker) Build a ClassLoader based on the classpath definition of a template.protected String
getBackingCheckerClasspath
(ConfigurationHolder configHolder, String template) Read the classpath parameter from the template and expand parameters with their value.protected InetAddress
getBindAddress
(ConfigurationHolder configHolder) Checks the userConfig bind address is not 0.0.0.0 and replaces it with 127.0.0.1 if neededprotected String
getContextName
(ConfigurationHolder configHolder) getJarsFromClasspathEntry
(ConfigurationHolder configHolder, Path templatePath, String entry) Given a single classpath entry, return the list of JARs referenced by it.
For instance : nxserver/lib -> ${templatePath}/nxserver/lib /somePath/someLib-*.jarprotected List<BackingChecker>
instantiateBackingCheckers
(ConfigurationHolder configHolder) boolean
isConfigured
(ConfigurationHolder configHolder) void
verify
(ConfigurationHolder configHolder) Verifies that the server is well configured and ready to be started.
-
Field Details
-
PARAM_RETRY_POLICY_ENABLED
- See Also:
-
PARAM_RETRY_POLICY_MAX_RETRIES
- See Also:
-
PARAM_RETRY_POLICY_DELAY_IN_MS
- See Also:
-
PARAM_POLICY_DEFAULT_DELAY_IN_MS
protected static final int PARAM_POLICY_DEFAULT_DELAY_IN_MS- See Also:
-
PARAM_RETRY_POLICY_DEFAULT_RETRIES
protected static final int PARAM_RETRY_POLICY_DEFAULT_RETRIES- See Also:
-
DEFAULT_CONTEXT_NAME
- See Also:
-
COMPLIANT_JAVA_VERSIONS
-
JVMCHECK_PROP
- See Also:
-
JVMCHECK_FAIL
- See Also:
-
JVMCHECK_NOFAIL
- See Also:
-
ADDRESS_PING_TIMEOUT_MS
protected static final int ADDRESS_PING_TIMEOUT_MS- See Also:
-
MIN_PORT
protected static final int MIN_PORT- See Also:
-
MAX_PORT
protected static final int MAX_PORT- See Also:
-
BAD_INSTANCE_CLID_PATH
-
systemProperties
-
-
Constructor Details
-
ConfigurationChecker
-
-
Method Details
-
isConfigured
- Returns:
- true if server configuration files already exist
-
getContextName
-
verify
Verifies that the server is well configured and ready to be started.- Throws:
ConfigurationException
-
checkJavaVersionIsCompliant
Checks the java version present in system properties compared to compliant ones.- Throws:
ConfigurationException
-
checkJavaVersion
protected void checkJavaVersion(String version, String[] compliantVersions) throws ConfigurationException Checks the given java version compared to the given compliant ones.- Parameters:
version
- the java versioncompliantVersions
- the compliant java versions- Throws:
ConfigurationException
-
checkJavaVersion
protected boolean checkJavaVersion(String version, String requiredVersion, boolean allowNoFailFlag, boolean warnIfLooseCompliance) Checks the java version compared to the required one.Loose compliance is assumed if the major version is greater than the required major version or a jvmcheck=nofail flag is set.
- Parameters:
version
- the java versionrequiredVersion
- the required java versionallowNoFailFlag
- iftrue
then check jvmcheck=nofail flag to always have loose compliancewarnIfLooseCompliance
- iftrue
then log a WARN if the is loose compliance- Returns:
- true if the java version is compliant (maybe loosely) with the required version
-
checkAddressesAndPorts
protected void checkAddressesAndPorts(ConfigurationHolder configHolder) throws ConfigurationException Will check the configured addresses are reachable and Nuxeo required ports are available on those addresses.- Throws:
ConfigurationException
-
getBindAddress
protected InetAddress getBindAddress(ConfigurationHolder configHolder) throws ConfigurationException Checks the userConfig bind address is not 0.0.0.0 and replaces it with 127.0.0.1 if needed- Parameters:
configHolder
- The configuration holding theConfigurationConstants.PARAM_BIND_ADDRESS
- Returns:
- the userConfig bind address if not 0.0.0.0 else 127.0.0.1
- Throws:
ConfigurationException
-
checkAddressReachable
- Parameters:
address
- address to check for availability- Throws:
ConfigurationException
-
checkPortAvailable
Checks if port is available on given address.- Parameters:
port
- port to check for availability- Throws:
ConfigurationException
- Throws an exception if address is unavailable.
-
checkPaths
Checks server paths; warn if deprecated paths exist.- Throws:
ConfigurationException
-
checkBackingServices
Calls allBackingChecker
if they accept the current configuration.- Throws:
ConfigurationException
-
buildRetryPolicy
-
instantiateBackingCheckers
protected List<BackingChecker> instantiateBackingCheckers(ConfigurationHolder configHolder) throws ConfigurationException - Throws:
ConfigurationException
-
getBackingCheckerClassLoader
protected URLClassLoader getBackingCheckerClassLoader(ConfigurationHolder configHolder, String checker) Build a ClassLoader based on the classpath definition of a template. -
getBackingCheckerClasspath
Read the classpath parameter from the template and expand parameters with their value. It allows classpath of the form ${nuxeo.home}/nxserver/bundles/... -
getJarsFromClasspathEntry
protected Stream<Path> getJarsFromClasspathEntry(ConfigurationHolder configHolder, Path templatePath, String entry) Given a single classpath entry, return the list of JARs referenced by it.
For instance :- nxserver/lib -> ${templatePath}/nxserver/lib
- /somePath/someLib-*.jar
-
convertToJarFileURL
-
checkJavaVersion
Checks that the process is executed with a supported Java version. See J2SE SDK/JRE Version String Naming Convention- Throws:
ConfigurationException
-
checkJavaVersion
Checks the java version compared to the required one.If major version is same as required major version and minor is greater or equal, it is compliant.
If major version is greater than required major version, it is compliant.
- Parameters:
version
- the java versionrequiredVersion
- the required java version- Returns:
- true if the java version is compliant with the required version
-