/* * (C) Copyright 2010-2011 Nuxeo SAS (http://nuxeo.com/) and contributors. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl.html * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * Contributors: * Julien Carsique * * $Id$ */ package org.nuxeo.launcher; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.nuxeo.launcher.config.ConfigurationGenerator; import org.nuxeo.launcher.config.TomcatConfigurator; /** * Main Nuxeo server thread * * @author jcarsique * @since 5.4.2 */ public class NuxeoTomcatLauncher extends NuxeoLauncher { /** * @param configurationGenerator */ public NuxeoTomcatLauncher(ConfigurationGenerator configurationGenerator) { super(configurationGenerator); } @Override protected Collection<? extends String> getServerProperties() { ArrayList<String> serverProperties = new ArrayList<>(); serverProperties.add("-Djava.util.logging.manager=" + "org.apache.juli.ClassLoaderLogManager"); File home = configurationGenerator.getNuxeoHome(); File endorsed = new File(home, "endorsed"); serverProperties.add("-Dcatalina.base=" + home.getPath()); serverProperties.add("-Dcatalina.home=" + home.getPath()); serverProperties.add("-Djava.endorsed.dirs=" + endorsed.getPath()); return serverProperties; } @Override protected String getClassPath() { String cp = "."; cp = addToClassPath(cp, "nxserver" + File.separator + "lib"); cp = addToClassPath(cp, "bin" + File.separator + "bootstrap.jar"); // Tomcat 7 needs tomcat-juli.jar for bootstrap as well cp = addToClassPath(cp, "bin" + File.separator + "tomcat-juli.jar"); return cp; } @Override protected void setServerStartCommand(List<String> command) { command.add(TomcatConfigurator.STARTUP_CLASS); command.add("start"); } @Override protected void setServerStopCommand(List<String> command) { command.add(TomcatConfigurator.STARTUP_CLASS); command.add("stop"); } @Override protected String getServerPrint() { return TomcatConfigurator.STARTUP_CLASS; } @Override protected String getShutdownClassPath() { return getClassPath(); } }