/** * @since 5.4.2 * @return Path to Tomcat configuration of Nuxeo context */ public String getTomcatConfig() { return "conf" + File.separator + "Catalina" + File.separator + "localhost" + File.separator + getContextName() + ".xml"; }
@Override public File getConfigDir() { return new File(getRuntimeHome(), Environment.DEFAULT_CONFIG_DIR); }
@Override public File getLogConfFile() { return new File(getServerLibDir(), "log4j2.xml"); }
@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); }
@Override public void prepareWizardStart() { try { // remove Tomcat configuration of Nuxeo context File contextXML = new File(generator.getNuxeoHome(), getTomcatConfig()); contextXML.delete(); // deploy wizard WAR File wizardWAR = new File(generator.getNuxeoHome(), "templates" + File.separator + "nuxeo-wizard.war"); File nuxeoWAR = new File(generator.getNuxeoHome(), "webapps" + File.separator + getContextName() + ".war"); nuxeoWAR.delete(); FileUtils.copyFile(wizardWAR, nuxeoWAR); } catch (IOException e) { log.error("Could not change Tomcat configuration to run wizard instead of Nuxeo.", e); } }
/** * @return true if {@link #getTomcatConfig()} file already exists */ @Override protected boolean isConfigured() { return new File(generator.getNuxeoHome(), getTomcatConfig()).exists(); }
serverConfigurator = new TomcatConfigurator(this); } else if (isJetty) { serverConfigurator = new JettyConfigurator(this);
@Override public void cleanupPostWizard() { File nuxeoWAR = new File(generator.getNuxeoHome(), "webapps" + File.separator + getContextName()); if (nuxeoWAR.exists()) { try { FileUtils.deleteDirectory(nuxeoWAR); } catch (IOException e) { log.error("Could not delete " + nuxeoWAR, e); } } nuxeoWAR = new File(nuxeoWAR.getPath() + ".war"); if (nuxeoWAR.exists()) { if (!FileUtils.deleteQuietly(nuxeoWAR)) { log.warn("Could not delete " + nuxeoWAR); try { nuxeoWAR.deleteOnExit(); } catch (SecurityException e) { log.warn("Cannot delete " + nuxeoWAR); } } } }