001/*
002 * (C) Copyright 2010-2014 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Julien Carsique
016 *
017 */
018
019package org.nuxeo.launcher.config;
020
021import java.io.File;
022
023import org.nuxeo.common.Environment;
024
025/**
026 * @author jcarsique
027 */
028public class JettyConfigurator extends ServerConfigurator {
029
030    public static final String JETTY_CONFIG = "config/sql.properties";
031
032    /**
033     * @since 5.4.2
034     */
035    public static final String LAUNCHER_CLASS = "org.nuxeo.runtime.launcher.Main";
036
037    /**
038     * @since 5.4.2
039     */
040    public static final String STARTUP_CLASS = "org.nuxeo.osgi.application.Main";
041
042    /**
043     * @since 5.6
044     */
045    public static final String JETTY_HOME = "jetty.home";
046
047    public JettyConfigurator(ConfigurationGenerator configurationGenerator) {
048        super(configurationGenerator);
049        log.info("Detected Jetty server.");
050    }
051
052    /**
053     * @return true if {@link #JETTY_CONFIG} file directory already exists
054     */
055    @Override
056    protected boolean isConfigured() {
057        return new File(generator.getNuxeoHome(), JETTY_CONFIG).exists();
058    }
059
060    @Override
061    public void checkPaths() throws ConfigurationException {
062        super.checkPaths();
063        // Currently no check for Jetty.
064    }
065
066    @Override
067    public File getLogConfFile() {
068        return new File(getConfigDir(), "log4j.xml");
069    }
070
071    @Override
072    public File getConfigDir() {
073        return new File(generator.getNuxeoHome(), Environment.DEFAULT_CONFIG_DIR);
074    }
075
076    @Override
077    protected File getRuntimeHome() {
078        return generator.getNuxeoHome();
079    }
080
081    @Override
082    public File getServerLibDir() {
083        return getNuxeoLibDir();
084    }
085
086}