org.tanukisoftware.wrapper
Class WrapperStartStopApp

java.lang.Object
  extended byorg.tanukisoftware.wrapper.WrapperStartStopApp
All Implemented Interfaces:
Runnable, WrapperListener

public class WrapperStartStopApp
extends Object
implements WrapperListener, Runnable

Version:
$Revision: 1.7 $
Author:
Leif Mortenson

Method Summary
 void controlEvent(int event)
          Called whenever the native wrapper code traps a system control signal against the Java process.
static void main(String[] args)
          Used to Wrapper enable a standard Java application.
 void run()
          Used to launch the application in a separate thread.
 Integer start(String[] args)
          The start method is called when the WrapperManager is signalled by the native wrapper code that it can start its application.
 int stop(int exitCode)
          Called when the application is shutting down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

run

public void run()
Used to launch the application in a separate thread.

Specified by:
run in interface Runnable

start

public Integer start(String[] args)
The start method is called when the WrapperManager is signalled by the native wrapper code that it can start its application. This method call is expected to return, so a new thread should be launched if necessary. If there are any problems, then an Integer should be returned, set to the desired exit code. If the application should continue, return null.

Specified by:
start in interface WrapperListener
Parameters:
args - List of arguments used to initialize the application.
Returns:
Any error code if the application should exit on completion of the start method. If there were no problems then this method should return null.

stop

public int stop(int exitCode)
Called when the application is shutting down.

Specified by:
stop in interface WrapperListener
Parameters:
exitCode - The suggested exit code that will be returned to the OS when the JVM exits.
Returns:
The exit code to actually return to the OS. In most cases, this should just be the value of exitCode, however the user code has the option of changing the exit code if there are any problems during shutdown.

controlEvent

public void controlEvent(int event)
Called whenever the native wrapper code traps a system control signal against the Java process. It is up to the callback to take any actions necessary. Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT, WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, or WRAPPER_CTRL_SHUTDOWN_EVENT

Specified by:
controlEvent in interface WrapperListener
Parameters:
event - The system control signal.

main

public static void main(String[] args)
Used to Wrapper enable a standard Java application. This main expects the first argument to be the class name of the application to launch. All remaining arguments will be wrapped into a new argument list and passed to the main method of the specified application.



Copyright 1999, 2003 TanukiSoftware.org. All Rights Reserved.