/** * @since 5.7 */ public void verifyInstallation() throws ConfigurationException { checkPaths(); checkNetwork(); }
/** * Ensure the wizard won't be started and nuxeo is ready for use * * @since 5.4.2 */ public void cleanupPostWizard() { serverConfigurator.cleanupPostWizard(); }
/** * @return Nuxeo config directory * @since 5.4.2 */ public File getConfigDir() { return serverConfigurator.getConfigDir(); }
/** * @see Environment * @param key directory system key * @return Directory denoted by key * @since 5.4.2 */ public File getDirectory(String key) { if (org.nuxeo.common.Environment.NUXEO_DATA_DIR.equals(key)) { return getDataDir(); } else if (org.nuxeo.common.Environment.NUXEO_LOG_DIR.equals(key)) { return getLogDir(); } else if (org.nuxeo.common.Environment.NUXEO_PID_DIR.equals(key)) { return getPidDir(); } else if (org.nuxeo.common.Environment.NUXEO_TMP_DIR.equals(key)) { return getTmpDir(); } else if (org.nuxeo.common.Environment.NUXEO_MP_DIR.equals(key)) { return getPackagesDir(); } else { log.error("Unknown directory key: " + key); return null; } }
/** * Check server paths; warn if existing deprecated paths. Override this method to perform server specific checks. * * @throws ConfigurationException If deprecated paths have been detected * @since 5.4.2 */ public void checkPaths() throws ConfigurationException { File badInstanceClid = new File(generator.getNuxeoHome(), getDefaultDataDir() + File.separator + "instance.clid"); if (badInstanceClid.exists() && !getDataDir().equals(badInstanceClid.getParentFile())) { log.warn(String.format("Moving %s to %s.", badInstanceClid, getDataDir())); try { FileUtils.moveFileToDirectory(badInstanceClid, getDataDir(), true); } catch (IOException e) { throw new ConfigurationException("NXP-6722 move failed: " + e.getMessage(), e); } } File oldPackagesPath = new File(getDataDir(), getDefaultPackagesDir()); if (oldPackagesPath.exists() && !oldPackagesPath.equals(getPackagesDir())) { log.warn(String.format( "NXP-8014 Packages cache location changed. You can safely delete %s or move its content to %s", oldPackagesPath, getPackagesDir())); } }
protected void generateFiles() throws ConfigurationException { try { serverConfigurator.parseAndCopy(userConfig); serverConfigurator.dumpProperties(userConfig); log.info("Configuration files generated."); // keep true or false, switch once to false if (onceGeneration) { setOnceToFalse = true; writeConfiguration(); } } catch (FileNotFoundException e) { throw new ConfigurationException("Missing file: " + e.getMessage(), e); } catch (TemplateException | ParseException e) { throw new ConfigurationException("Could not process FreeMarker template: " + e.getMessage(), e); } catch (IOException e) { throw new ConfigurationException("Configuration failure: " + e.getMessage(), e); } }
try { conf.saveFilteredConfiguration(params); conf.getServerConfigurator().dumpProperties(conf.getUserConfig());
config.getProperty(ConfigurationGenerator.PARAM_TEMPLATES_FREEMARKER_EXTENSIONS, "nxftl")); deleteTemplateFiles(); File outputDirectory = (outputDirectoryStr != null) ? new File(generator.getNuxeoHome(), outputDirectoryStr) : getOutputDirectory(); for (File in : listFiles) { storeNewFilesList(newFilesList);
/** * @return Data directory * @since 5.4.2 */ public File getDataDir() { return serverConfigurator.getDataDir(); }
@Override public void checkPaths() throws ConfigurationException { super.checkPaths(); // Currently no check for Jetty. }
/** * @param userConfig Properties to dump into config directory * @since 5.4.2 */ public void dumpProperties(CryptoProperties userConfig) { Properties dumpedProperties = filterSystemProperties(userConfig); File dumpedFile = generator.getDumpedConfig(); try (OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(dumpedFile, false), "UTF-8")) { dumpedProperties.store(os, "Generated by " + getClass()); } catch (FileNotFoundException e) { log.error(e); } catch (IOException e) { log.error("Could not dump properties to " + dumpedFile, e); } }
/** * Check for deprecated parameters * * @since 5.6 */ protected void checkForDeprecatedParameters(Properties properties) { serverConfigurator.addServerSpecificParameters(parametersMigration); @SuppressWarnings("rawtypes") Enumeration userEnum = properties.propertyNames(); while (userEnum.hasMoreElements()) { String key = (String) userEnum.nextElement(); if (parametersMigration.containsKey(key)) { String value = properties.getProperty(key); properties.setProperty(parametersMigration.get(key), value); // Don't remove the deprecated key yet - more // warnings but old things should keep working // properties.remove(key); if (!hideDeprecationWarnings) { log.warn("Parameter " + key + " is deprecated - please use " + parametersMigration.get(key) + " instead"); } } } }
try { conf.saveFilteredConfiguration(params); conf.getServerConfigurator().dumpProperties(conf.getUserConfig());
/** * @return Install/upgrade file * @since 5.4.1 */ public File getInstallFile() { return new File(serverConfigurator.getDataDir(), INSTALL_AFTER_RESTART); }
@Override public void checkPaths() throws ConfigurationException { super.checkPaths(); File oldPath = new File(getRuntimeHome(), "data" + File.separator + "vcsh2repo"); String message = String.format("NXP-5370, NXP-5460. " + "Please rename 'vcsh2repo' directory from %s to %s", oldPath, new File(generator.getDataDir(), "h2" + File.separator + "nuxeo")); checkPath(oldPath, message); oldPath = new File(getRuntimeHome(), "data" + File.separator + "derby" + File.separator + "nxsqldirectory"); message = "NXP-5370, NXP-5460. " + "It is not possible to migrate Derby data." + System.getProperty("line.separator") + "Please remove 'nx*' directories from " + oldPath.getParent() + System.getProperty("line.separator") + "or edit templates/default/" + getTomcatConfig() + System.getProperty("line.separator") + "following https://github.com/nuxeo/nuxeo-distribution/blob/release-5.3.2/nuxeo-distribution-resources/src/main/resources/templates-tomcat/default/conf/Catalina/localhost/nuxeo.xml"; checkPath(oldPath, message); }