Class ConfigurationChecker


  • public class ConfigurationChecker
    extends Object
    Since:
    11.5
    • Constructor Detail

      • ConfigurationChecker

        public ConfigurationChecker​(Properties systemProperties)
    • Method Detail

      • isConfigured

        public boolean isConfigured​(ConfigurationHolder configHolder)
        Returns:
        true if server configuration files already exist
      • 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
      • 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.
      • buildRetryPolicy

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