net.sourceforge.esw.service
Class ServiceProxy

java.lang.Object
  |
  +--net.sourceforge.esw.util.proxy.SupportObjectProxy
        |
        +--net.sourceforge.esw.service.ServiceProxy
All Implemented Interfaces:
IService, ISupportObject, java.io.Serializable
Direct Known Subclasses:
LogProxy

public class ServiceProxy
extends SupportObjectProxy
implements IService

See Also:
IHeartbeatGenerator, ISupportObject, Serialized Form

Fields inherited from interface net.sourceforge.esw.service.IService
PRIMARY, SECONDARY, TERTIARY, UNAVAILABLE
 
Constructor Summary
ServiceProxy(IService aDelegate)
          Creates a new ServiceProxy.
 
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 class net.sourceforge.esw.util.proxy.SupportObjectProxy
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getID, getProperty, getPropertySize, propertyKeys, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setID, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 

Constructor Detail

ServiceProxy

public ServiceProxy(IService aDelegate)
Creates a new ServiceProxy.

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.

Specified by:
start in interface IService
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.

Specified by:
stop in interface IService
See Also:
start()

isStarted

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

Specified by:
isStarted in interface IService
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.

Specified by:
getHeartbeatGenerator in interface IService
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.

This default implementation always returns true. Implementors should change this to do some useful sanity checking.

Specified by:
isSane in interface IService
Returns:
whether this IService instance is sane.

die

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

This default implementation calls System.exit(0).

Fires an IServiceResources.DIE_PROPERTY property change event.

Specified by:
die in interface IService

ping

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

Specified by:
ping in interface IService
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.

Specified by:
setPriority in interface IService
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.

Specified by:
getPriority in interface IService
Returns:
the priority of this IService instance.


Copyright 2002 Free Software Foundation. All Rights Reserved.