/*

 * The Gemma project

 * 

 * Copyright (c) 2006 University of British Columbia

 * 

 * Licensed under the Apache License, Version 2.0 (the "License");

 * you may not use this file except in compliance with the License.

 * You may obtain a copy of the License at

 *

 *       http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

 *

 */

package edu.columbia.gemma.web.jetty;

import java.net.URL;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mortbay.jetty.Server;

/**
 * Start Jetty from a run configuration
 * 
 * @author keshav
 * @version $Id$
 */
public class Start {
    /**
     * Used for logging.
     */
    private static Log log = LogFactory.getLog( Start.class );

    /**
     * Construct.
     */
    Start() {
        super();
    }

    /**
     * Main function, starts the jetty server.
     * 
     * @param args
     */
    public static void main( String[] args ) {
        Server jettyServer = null;
        try {
            URL jettyConfig = new URL( "file:etc/jetty/jetty.xml" );
            
            log.debug("jetty config:" + jettyConfig);
            
            if ( jettyConfig == null ) {
                log.fatal( "Unable to locate jetty-test-config.xml on the classpath" );
            }
            jettyServer = new Server(jettyConfig);
            jettyServer.start();
        } catch ( Exception e ) {
            log.fatal( "Could not start the Jetty server: " + e );
            if ( jettyServer != null ) {
                try {
                    jettyServer.stop();
                } catch ( Exception e1 ) {
                    log.fatal( "Unable to stop the jetty server: " + e1 );
                }
            }
        }
    }
}

@@ -1380,28 +1380,16 @@
 xml%22 );%0A
-            
 %0A       
@@ -1403,16 +1403,17 @@
 g.debug(
+ 
 %22jetty c
@@ -1433,31 +1433,20 @@
 tyConfig
+ 
 );%0A
-            
 %0A       
@@ -1563,24 +1563,58 @@
 asspath%22 );%0A
+                System.exit( 0 );%0A
             
@@ -1652,16 +1652,17 @@
  Server(
+ 
 jettyCon
@@ -1664,16 +1664,17 @@
 tyConfig
+ 
 );%0A     
@@ -2047,32 +2047,62 @@
 %7D%0A            %7D%0A
+            System.exit( 0 );%0A
         %7D%0A    %7D%0A

add system.exit(0)