001/*
002 * (C) Copyright 2010-2014 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 */
020
021package org.nuxeo.launcher.config;
022
023import java.io.File;
024
025import org.nuxeo.common.Environment;
026
027/**
028 * @author jcarsique
029 */
030public class JettyConfigurator extends ServerConfigurator {
031
032    public static final String JETTY_CONFIG = "config/sql.properties";
033
034    /**
035     * @since 5.4.2
036     */
037    public static final String LAUNCHER_CLASS = "org.nuxeo.runtime.launcher.Main";
038
039    /**
040     * @since 5.4.2
041     */
042    public static final String STARTUP_CLASS = "org.nuxeo.osgi.application.Main";
043
044    /**
045     * @since 5.6
046     */
047    public static final String JETTY_HOME = "jetty.home";
048
049    public JettyConfigurator(ConfigurationGenerator configurationGenerator) {
050        super(configurationGenerator);
051        log.info("Detected Jetty server.");
052    }
053
054    /**
055     * @return true if {@link #JETTY_CONFIG} file directory already exists
056     */
057    @Override
058    protected boolean isConfigured() {
059        return new File(generator.getNuxeoHome(), JETTY_CONFIG).exists();
060    }
061
062    @Override
063    public void checkPaths() throws ConfigurationException {
064        super.checkPaths();
065        // Currently no check for Jetty.
066    }
067
068    @Override
069    public File getLogConfFile() {
070        return new File(getConfigDir(), "log4j.xml");
071    }
072
073    @Override
074    public File getConfigDir() {
075        return new File(generator.getNuxeoHome(), Environment.DEFAULT_CONFIG_DIR);
076    }
077
078    @Override
079    protected File getRuntimeHome() {
080        return generator.getNuxeoHome();
081    }
082
083    @Override
084    public File getServerLibDir() {
085        return getNuxeoLibDir();
086    }
087
088}