com.javageeks.gjas
Interface Service

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
ControlService
All Known Implementing Classes:
ThreadedServer

public interface Service
extends java.io.Serializable

Note: Service's Serializable interface should be honored, because Serialization is the basic means of exchange between JVMs in RMI calls, and if a Service is not Serializable then it cannot be transferred across JVMs.

If a Service needs to maintain "interim" data that should not be Serialized, then remember to mark the data members as transient. Also, remember that a given Serializable class can control what happens when it is serialized and deserialized by means of thewriteObject and readObject methods. This would allow, for example, those Services that make use of JDBC Connections (as an example) to close down and reopen the Connection upon serialization and subsequent deserialization.


Field Summary
static java.lang.String PAUSED
           
static java.lang.String PAUSING
           
static java.lang.String RESUMING
           
static java.lang.String RUNNING
           
static java.lang.String STARTING
           
static java.lang.String STOPPED
           
static java.lang.String STOPPING
           
 
Method Summary
 ConfigProperties getConfigInfo()
          Return the Properties configuration information
 java.lang.String getInstanceID()
          Return a String uniquely identifying this instance of the Service; this String must be unique not just to the Service class, but to the Service instance itself.
 java.lang.String getState()
          Get the current state of the Service; must be one of the following types: STOPPED, STARTING, RUNNING, STOPPING, PAUSING, PAUSED, or RESUMING.
 void pause()
          Pause the Service.
 void resume()
          Resume the Service.
 void setConfigInfo(ConfigProperties info)
          Set the Properties configuration information
 void start()
          Start the Service.
 void stop()
          Stop the Service.
 

Field Detail

STOPPED

public static final java.lang.String STOPPED

STARTING

public static final java.lang.String STARTING

RUNNING

public static final java.lang.String RUNNING

STOPPING

public static final java.lang.String STOPPING

PAUSING

public static final java.lang.String PAUSING

PAUSED

public static final java.lang.String PAUSED

RESUMING

public static final java.lang.String RESUMING
Method Detail

start

public void start()
           throws java.lang.Exception
Start the Service.

stop

public void stop()
          throws java.lang.Exception
Stop the Service.

pause

public void pause()
           throws java.lang.Exception
Pause the Service.

resume

public void resume()
            throws java.lang.Exception
Resume the Service.

getState

public java.lang.String getState()
Get the current state of the Service; must be one of the following types: STOPPED, STARTING, RUNNING, STOPPING, PAUSING, PAUSED, or RESUMING.

getInstanceID

public java.lang.String getInstanceID()
                               throws java.lang.Exception
Return a String uniquely identifying this instance of the Service; this String must be unique not just to the Service class, but to the Service instance itself. Suggested return format is something like: String instanceID = this.getClass().getName() + ":" + getClassVersion() + ":" + System.currentTimeMillis(); Note that maintaining an "instance count" of the number of instances of this class will fail, since all instances will be maintained within their own ClassLoader, and static members are stored on a per-ClassLoader basis.

getConfigInfo

public ConfigProperties getConfigInfo()
Return the Properties configuration information

setConfigInfo

public void setConfigInfo(ConfigProperties info)
Set the Properties configuration information