net.sourceforge.esw.service
Interface IService

All Superinterfaces:
ISupportObject, java.io.Serializable
All Known Subinterfaces:
ILog, ILogDissemination
All Known Implementing Classes:
ADefaultService, AService, ServiceProxy, LifeSupport

public interface IService
extends ISupportObject

Describes the base abilities of a Service within the Services Framework.

IService instances maintain a priority property that indicates which service should be used first if there are more than one type of an IService implementor started within the enterprise. Changing the priority fires the appropriate PropertyChangeEvent. The predefined priorities used by the service framework are:

All IService instances have push and pull elements to help verify livliness of the service. Those elements can be exercised using the ping() and getHeartbeatGenerator() methods.

Each service has the ability to be started and stopped. Starting or stopping an IService instance also starts/stops the IHeartbeatGenerator instance, and fires the approprate PropertyChangeEvent.

An IService instance may be started and alive, yet not be sane. The final check for the valid livliness of an IService instance is the call to isSane(). As this may cause some computation to be performed on the service, use of this method should be restricted to need only.

See Also:
IHeartbeatGenerator, ISupportObject

Field Summary
static int PRIMARY
          The PRIMARY priority definition for this IService instance.
static int SECONDARY
          The SECONDARY priority definition for this IService instance.
static int TERTIARY
          The TERTIARY priority definition for this IService instance.
static int UNAVAILABLE
          The UNAVAILABLE priority definition for this IService instance.
 
Method Summary
 void die()
          Requests that this IService instance to kill itself.
 IHeartbeatGenerator getHeartbeatGenerator()
          Returns the IHeartbeatGenterator instance for this IService instance.
 int getPriority()
          Returns the priority of this IService instance.
 boolean isSane()
          States whether this IService instance is sane.
 boolean isStarted()
          States whether this IService instance is started.
 boolean ping()
          Allows checking of connection to this IService instance.
 void setPriority(int aPriority)
          Sets the priority of this IService instance.
 void start()
          Starts this IService instance and allows it to serve client requests.
 void stop()
          Stops this IService instance and keeps it from serving client requests.
 
Methods inherited from interface net.sourceforge.esw.util.ISupportObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getID, getProperty, getPropertySize, propertyKeys, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setID, setProperty
 

Field Detail

PRIMARY

public static final int PRIMARY
The PRIMARY priority definition for this IService instance.

SECONDARY

public static final int SECONDARY
The SECONDARY priority definition for this IService instance.

TERTIARY

public static final int TERTIARY
The TERTIARY priority definition for this IService instance.

UNAVAILABLE

public static final int UNAVAILABLE
The UNAVAILABLE priority definition for this IService instance.
Method Detail

start

public void start()
Starts this IService instance and allows it to serve client requests.

The service should be registered with a lookup server regardless of whether it is started or not.

Fires an IServiceResources.START_PROPERTY property change event.

See Also:
stop()

stop

public void stop()
Stops this IService instance and keeps it from serving client requests.

The service should be registered with a lookup server regardless of whether it is stopped or not.

Fires an IServiceResources.STOP_PROPERTY property change event.

See Also:
start()

isStarted

public boolean isStarted()
States whether this IService instance is started.

Returns:
whether this IService instance is started.

getHeartbeatGenerator

public IHeartbeatGenerator getHeartbeatGenerator()
Returns the IHeartbeatGenterator instance for this IService instance. The IHeartbeatGenerator is responsible for pushing telemetry for guaranteeing liveliness of this IService instance.

Returns:
the IHeartbeatGenerator instance for this IService instance.

isSane

public boolean isSane()
States whether this IService instance is sane. Sanity can only be determined by an IService implementor.

Returns:
whether this IService instance is sane.

die

public void die()
Requests that this IService instance to kill itself.

Fires an IServiceResources.DIE_PROPERTY property change event.


ping

public boolean ping()
Allows checking of connection to this IService instance. This is the pull element of verifying service liveliness.

Returns:
true if the Service is still accessable. Otherwise, an exception is normally thrown on the client.

setPriority

public void setPriority(int aPriority)
Sets the priority of this IService instance. Priority determines which IService instance should be used in an enterprise where multiple instances of the same IService implementor should be used.

Fires an IServiceResources.PRIORITY_PROPERTY property change event.

Parameters:
aPriority - the new priority of this IService instance.

getPriority

public int getPriority()
Returns the priority of this IService instance. Priority determines which IService instance should be used in an enterprise where multiple instances of the same IService implementor should be used.

Returns:
the priority of this IService instance.


Copyright 2002 Free Software Foundation. All Rights Reserved.