package org.apache.tomcat.jsrvany; import org.apache.tomcat.shell.*; import net.sourceforge.jsrvany.*; /** * This class is a wrapper for the Tomcat Servlet Container, to allow it to interface correctly * with the Windows NT ServiceControlManager * *

Copyright (c) 2000 Damian Fauth

* *

 * 
* * @version 0.9 * @author Damian Fauth */ public class TomcatWrapper extends SimpleListener { private static ServiceControlManager manager = null; private static String[] args; /** * main method * * @param args are the arguments to the program as an array of Strings * @return void */ public static void main(String[] args) { // get the ServiceConrolManager manager = ServiceControlManager.getInstance(); // create an instance of this class TomcatWrapper main = new TomcatWrapper(args); // register this class as a listener manager.addServiceControlListener(main); // start Tomcat Startup.main(args); } /** * constructor with arguments * * @param args are the arguments to the program as an array of Strings */ public TomcatWrapper(String[] args) { // get a reference to the arguments this.args = args; } /** * handle a StopServiceControlEvent This method is called by the ServiceControlManager * when the appropriate event occurs * * @param e is the event as an instance of StopServiceControlEvent * @return void */ public void handleServiceControlEvent(StopServiceControlEvent e) { System.err.println("handleServiceControlEvent: (Stop) "+e); // shutdown Tomcat Shutdown.main(this.args); } }