protected Collection<BackingChecker> getCheckers() throws ConfigurationException { if (checkers == null) { checkers = new HashSet<>(); for (String template : configurationGenerator.getTemplateList()) { try { File templateDir = configurationGenerator.getTemplateConf(template).getParentFile(); String classPath = getClasspathForTemplate(template); String checkClass = configurationGenerator.getUserConfig() .getProperty(template + PARAM_CHECK_SUFFIX); Optional<URLClassLoader> ucl = getClassLoaderForTemplate(templateDir, classPath); if (ucl.isPresent()) { Class<?> klass = Class.forName(checkClass, true, ucl.get()); checkers.add((BackingChecker) klass.newInstance()); } } catch (IOException e) { log.warn("Unable to read check configuration for template : " + template, e); } catch (ReflectiveOperationException | ClassCastException e) { throw new ConfigurationException("Unable to check configuration for backing service " + template, e); } } } return checkers; }
files.addAll(getJarsFromClasspathEntry(templateDir.toPath(), entry));
/** * Calls all BackingChecker if they accept the current configuration. * * @throws ConfigurationException */ public void verifyInstallation() throws ConfigurationException { RetryPolicy retryPolicy = buildRetryPolicy(); // Get all checkers for (BackingChecker checker : getCheckers()) { if (checker.accepts(configurationGenerator)) { try { Failsafe.with(retryPolicy) .onFailedAttempt(failure -> log.error(failure.getMessage())) // .onRetry((c, f, ctx) -> log.warn(String.format("Failure %d. Retrying....", ctx.getExecutions()))) // .run(() -> checker.check(configurationGenerator)); // } catch (FailsafeException e) { if (e.getCause() instanceof ConfigurationException) { throw ((ConfigurationException) e.getCause()); } else { throw e; } } } } }
serverConfigurator.initLogs(); backingServicesConfigurator = new BackingServiceConfigurator(this); String homeInfo = "Nuxeo home: " + nuxeoHome.getPath(); String confInfo = "Nuxeo configuration: " + nuxeoConf.getPath();
/** * Create needed directories. Check existence of old paths. If old paths have been found and they cannot be upgraded * automatically, then upgrading message is logged and error thrown. * * @throws ConfigurationException If a deprecated directory has been detected. * @since 5.4.2 * @see ServerConfigurator#verifyInstallation() */ public void verifyInstallation() throws ConfigurationException { checkJavaVersion(); ifNotExistsAndIsDirectoryThenCreate(getLogDir()); ifNotExistsAndIsDirectoryThenCreate(getPidDir()); ifNotExistsAndIsDirectoryThenCreate(getDataDir()); ifNotExistsAndIsDirectoryThenCreate(getTmpDir()); ifNotExistsAndIsDirectoryThenCreate(getPackagesDir()); checkAddressesAndPorts(); serverConfigurator.verifyInstallation(); backingServicesConfigurator.verifyInstallation(); }