Class ConfigurationChecker

java.lang.Object
org.nuxeo.launcher.config.ConfigurationChecker

public class ConfigurationChecker extends Object
Since:
11.5
  • Field Details

  • Constructor Details

    • ConfigurationChecker

      public ConfigurationChecker(Properties systemProperties)
  • Method Details

    • isConfigured

      public boolean isConfigured(ConfigurationHolder configHolder)
      Returns:
      true if server configuration files already exist
    • getContextName

      protected String getContextName(ConfigurationHolder configHolder)
    • verify

      public void verify(ConfigurationHolder configHolder) throws ConfigurationException
      Verifies that the server is well configured and ready to be started.
      Throws:
      ConfigurationException
    • checkJavaVersionIsCompliant

      protected void checkJavaVersionIsCompliant() throws ConfigurationException
      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 version
      compliantVersions - 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 version
      requiredVersion - the required java version
      allowNoFailFlag - if true then check jvmcheck=nofail flag to always have loose compliance
      warnIfLooseCompliance - if true 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 the ConfigurationConstants.PARAM_BIND_ADDRESS
      Returns:
      the userConfig bind address if not 0.0.0.0 else 127.0.0.1
      Throws:
      ConfigurationException
    • checkAddressReachable

      protected void checkAddressReachable(InetAddress address) throws ConfigurationException
      Parameters:
      address - address to check for availability
      Throws:
      ConfigurationException
    • checkPortAvailable

      protected void checkPortAvailable(InetAddress address, int port) throws ConfigurationException
      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

      protected void checkPaths(ConfigurationHolder configHolder) throws ConfigurationException
      Checks server paths; warn if deprecated paths exist.
      Throws:
      ConfigurationException
    • checkBackingServices

      public void checkBackingServices(ConfigurationHolder configHolder) throws ConfigurationException
      Calls all BackingChecker if they accept the current configuration.
      Throws:
      ConfigurationException
    • buildRetryPolicy

      protected net.jodah.failsafe.RetryPolicy<Object> buildRetryPolicy(ConfigurationHolder configHolder)
    • 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

      protected String getBackingCheckerClasspath(ConfigurationHolder configHolder, String template)
      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

      protected URL convertToJarFileURL(Path path)
    • checkJavaVersion

      public static void checkJavaVersion() throws ConfigurationException
      Checks that the process is executed with a supported Java version. See J2SE SDK/JRE Version String Naming Convention
      Throws:
      ConfigurationException
    • checkJavaVersion

      public static boolean checkJavaVersion(String version, String requiredVersion)
      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 version
      requiredVersion - the required java version
      Returns:
      true if the java version is compliant with the required version