001/*
002 * (C) Copyright 2010-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Julien Carsique
018 *
019 * $Id$
020 */
021
022package org.nuxeo.launcher;
023
024import java.util.ArrayList;
025import java.util.Collection;
026import java.util.List;
027
028import org.nuxeo.launcher.config.ConfigurationGenerator;
029import org.nuxeo.launcher.config.JettyConfigurator;
030
031/**
032 * Main Nuxeo server thread
033 *
034 * @author jcarsique
035 * @since 5.4.2
036 */
037public class NuxeoJettyLauncher extends NuxeoLauncher {
038
039    public NuxeoJettyLauncher(ConfigurationGenerator configurationGenerator) {
040        super(configurationGenerator);
041        throw new UnsupportedOperationException();
042    }
043
044    @Override
045    protected String getClassPath() {
046        String cp = ".";
047        cp = addToClassPath(cp, "lib");
048        cp = addToClassPath(cp, "nuxeo-runtime-launcher-*.jar");
049        cp = addToClassPath(cp, "bundles");
050        return cp;
051    }
052
053    @Override
054    protected void setServerStartCommand(List<String> command) {
055        command.add(JettyConfigurator.STARTUP_CLASS);
056        command.add("-home");
057        command.add(configurationGenerator.getNuxeoHome().getPath());
058    }
059
060    @Override
061    protected void setServerStopCommand(List<String> command) {
062        command.add(JettyConfigurator.STARTUP_CLASS);
063        command.add("stop");
064    }
065
066    @Override
067    protected Collection<? extends String> getServerProperties() {
068        return new ArrayList<>();
069    }
070
071    @Override
072    protected String getServerPrint() {
073        return JettyConfigurator.STARTUP_CLASS;
074    }
075
076    @Override
077    protected String getShutdownClassPath() {
078        return getClassPath();
079    }
080
081}