Package jadex.platform.service
Class ServiceStarter
- java.lang.Object
- 
- jadex.platform.service.ServiceStarter
 
- 
- All Implemented Interfaces:
- org.apache.commons.daemon.Daemon
 - Direct Known Subclasses:
- TimeServiceStarter
 
 public class ServiceStarter extends java.lang.Object implements org.apache.commons.daemon.DaemonClass for starting/stopping jadex as a service / daemon.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.String[]argsThe arguments for starting jadex.protected static ServiceStarterinstanceSingleton of service handler.protected IExternalAccessplatformThe jadex platform.
 - 
Constructor SummaryConstructors Constructor Description ServiceStarter()Bean constructor for Unix daemon.ServiceStarter(java.lang.String[] args)Constructor for Windows service.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Frees any resources allocated by this daemon such as file descriptors or sockets.protected voiddoStart()Do the actual starting.protected voiddoStop()Do the actual starting.protected IPlatformConfigurationgetConfig()Get the platform configuration.voidinit(org.apache.commons.daemon.DaemonContext context)Initializes thisDaemoninstance.voidstart()Starts the operation of thisDaemoninstance.static voidstart(java.lang.String[] args)Static method called by prunsrv to start the Windows service.voidstop()Stops the operation of thisDaemoninstance.static voidstop(java.lang.String[] args)Static method called by prunsrv to stop the Windows service.
 
- 
- 
- 
Field Detail- 
instanceprotected static ServiceStarter instance Singleton of service handler.
 - 
platformprotected IExternalAccess platform The jadex platform.
 - 
argsprotected java.lang.String[] args The arguments for starting jadex.
 
- 
 - 
Method Detail- 
startpublic static void start(java.lang.String[] args) Static method called by prunsrv to start the Windows service.
 - 
stoppublic static void stop(java.lang.String[] args) Static method called by prunsrv to stop the Windows service.
 - 
initpublic void init(org.apache.commons.daemon.DaemonContext context) throws org.apache.commons.daemon.DaemonInitException, java.lang.ExceptionInitializes thisDaemoninstance.Daemon instance is created thru its empty public constructor. ServerSocket instances within the scope of this method, and perform all operations requiring Daemon (such as starting threads calling theServerSocket.accept()method) as this would impose some serious security hazards. The start of operation must be performed in thestart()method.- Specified by:
- initin interface- org.apache.commons.daemon.Daemon
- Parameters:
- context- A- DaemonContextobject used to communicate with the container.
- Throws:
- org.apache.commons.daemon.DaemonInitException- An exception that prevented initialization where you want to display a nice message to the user, rather than a stack trace.
- java.lang.Exception- Any exception preventing a successful initialization.
 - 
startpublic void start() throws java.lang.ExceptionStarts the operation of thisDaemoninstance. This method is to be invoked by the environment after the init() method has been successfully invoked and possibly the security level of the JVM has been dropped. Implementors of this method are free to start any number of threads, but need to return control after having done that to enable invocation of the stop()-method.- Specified by:
- startin interface- org.apache.commons.daemon.Daemon
- Throws:
- java.lang.Exception
 
 - 
stoppublic void stop() throws java.lang.ExceptionStops the operation of thisDaemoninstance. Note that the proper place to free any allocated resources such as sockets or file descriptors is in the destroy method, as the container may restart the Daemon by calling start() after stop().- Specified by:
- stopin interface- org.apache.commons.daemon.Daemon
- Throws:
- java.lang.Exception
 
 - 
destroypublic void destroy() Frees any resources allocated by this daemon such as file descriptors or sockets. This method gets called by the container after stop() has been called, before the JVM exits. The Daemon can not be restarted after this method has been called without a new call to the init() method.- Specified by:
- destroyin interface- org.apache.commons.daemon.Daemon
 
 - 
doStartprotected void doStart() Do the actual starting. Separate method to get rid of exception.
 - 
getConfigprotected IPlatformConfiguration getConfig() Get the platform configuration. Subclass and override for specific use cases.
 - 
doStopprotected void doStop() Do the actual starting. Separate method to get rid of exception.
 
 
- 
 
-