001: //** Copyright Statement ***************************************************
002: //The Salmon Open Framework for Internet Applications (SOFIA)
003: // Copyright (C) 1999 - 2002, Salmon LLC
004: //
005: // This program is free software; you can redistribute it and/or
006: // modify it under the terms of the GNU General Public License version 2
007: // as published by the Free Software Foundation;
008: //
009: // This program 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
012: // GNU General Public License for more details.
013: //
014: // You should have received a copy of the GNU General Public License
015: // along with this program; if not, write to the Free Software
016: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: //
018: // For more information please visit http://www.salmonllc.com
019: //** End Copyright Statement ***************************************************
020: // ====================================================================
021: //
022: // The Apache Software License, Version 1.1
023: //
024: // Copyright (c) 1999 The Apache Software Foundation. All rights
025: // reserved.
026: //
027: // Redistribution and use in source and binary forms, with or without
028: // modification, are permitted provided that the following conditions
029: // are met:
030: //
031: // 1. Redistributions of source code must retain the above copyright
032: // notice, this list of conditions and the following disclaimer.
033: //
034: // 2. Redistributions in binary form must reproduce the above copyright
035: // notice, this list of conditions and the following disclaimer in
036: // the documentation and/or other materials provided with the
037: // distribution.
038: //
039: // 3. The end-user documentation included with the redistribution, if
040: // any, must include the following acknowlegement:
041: // "This product includes software developed by the
042: // Apache Software Foundation (http://www.apache.org/)."
043: // Alternately, this acknowlegement may appear in the software itself,
044: // if and wherever such third-party acknowlegements normally appear.
045: //
046: // 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
047: // Foundation" must not be used to endorse or promote products derived
048: // from this software without prior written permission. For written
049: // permission, please contact apache@apache.org.
050: //
051: // 5. Products derived from this software may not be called "Apache"
052: // nor may "Apache" appear in their names without prior written
053: // permission of the Apache Group.
054: //
055: // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
056: // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
057: // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
058: // DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
059: // ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
060: // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
061: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
062: // USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
063: // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
064: // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
065: // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
066: // SUCH DAMAGE.
067: // ====================================================================
068: //
069: // This software consists of voluntary contributions made by many
070: // individuals on behalf of the Apache Software Foundation. For more
071: // information on the Apache Software Foundation, please see
072: // <http://www.apache.org/>.
073:
074: package com.salmonllc.ideTools;
075:
076: import com.salmonllc.util.MessageLog;
077:
078: import java.lang.reflect.Method;
079:
080: /**
081: * Boostrap loader for Catalina. This was copied from Catalina 4.03 source and modified to run from the IDETool
082: */
083:
084: public final class TomcatBootstrap {
085:
086: public static int START = 1;
087: public static int STOP = 2;
088: public static int RESTART = 3;
089:
090: public static void execute(int process, String browserPath,
091: String webPage, String serverType) {
092: try {
093: Class types[] = { Integer.TYPE, String.class, String.class };
094: Object args[] = { new Integer(process), browserPath,
095: webPage };
096: String className = "com.salmonllc.ideTools.Tomcat40Bootstrap";
097: if (serverType == IDETool.SERVER_TOMCAT41)
098: className = "com.salmonllc.ideTools.Tomcat41Bootstrap";
099: else if (serverType == IDETool.SERVER_TOMCAT50)
100: className = "com.salmonllc.ideTools.Tomcat50Bootstrap";
101: Class c = Class.forName(className);
102: Method m = c.getMethod("execute", types);
103: m.invoke(null, args);
104:
105: } catch (Exception e) {
106: MessageLog.writeErrorMessage("Tomcat4Bootstrap.execute()",
107: e, null);
108: }
109: }
110: }
|