net.sourceforge.esw.service
Class ADefaultService

java.lang.Object
  |
  +--net.sourceforge.esw.util.SupportObject
        |
        +--net.sourceforge.esw.service.AService
              |
              +--net.sourceforge.esw.service.ADefaultService
All Implemented Interfaces:
IService, ISupportObject, java.io.Serializable
Direct Known Subclasses:
ALog, LifeSupport

public abstract class ADefaultService
extends AService
implements IService

Base class for Jini Service implementors to extend.

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

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.

All IService implementors should register themselves during their creational pattern.

For environments that do not have multicast enabled (which Jini uses for discovery), or for enabling Unicast Discovery, create properties using the properties framework in the form of . . .

 
    hostNameOfAReggieService 
    hostNameOfAReggieService 
    hostNameOfAReggieService 
   . . .
 
 
. . . for as many Unicast Discovered Reggie services you wish to Discover. Multicast will still be used as well as Unicast.

See Also:
Serialized Form

Field Summary
protected  ClassServer classServer
          The internal HTTP Class Server for distributing classes.
protected  net.jini.lookup.JoinManager joinManager
          The JoinManager is a Jini class that provides automated Discovery and Joining of Lookup services.
protected  java.lang.Object proxy
          The Proxy for this ADefaultService implementor.
protected  net.jini.core.lookup.ServiceID serviceID
          The ServiceID is a Jini class that provides a unique identifier for a service.
 
Fields inherited from class net.sourceforge.esw.service.AService
bStarted, heartbeatGenerator, priority
 
Fields inherited from class net.sourceforge.esw.util.SupportObject
id, properties, propertyChildren, propertyListeners, vetoableChildren, vetoableListeners
 
Fields inherited from interface net.sourceforge.esw.service.IService
PRIMARY, SECONDARY, TERTIARY, UNAVAILABLE
 
Constructor Summary
ADefaultService()
          Creates a new ADefaultService
ADefaultService(java.lang.Object aId)
          Creates a new ADefaultService with the specified id.
 
Method Summary
 void die()
          Requests that this IService instance to kill itself.
protected  void persist(net.jini.core.lookup.ServiceID aID)
          Persists the ServiceID returned from Reggie that indicates the unique identifier for this IService instance.
protected  void register()
          Registers this IService implementor with any discovered Jini lookup services.
protected  void register(net.jini.core.entry.Entry[] aInitialAttributes)
          Registers this IService implementor with any discovered Jini lookup services.
protected  void register(java.lang.Object aProxy)
          Registers this IService implementor with any discovered Jini lookup services.
protected  void register(java.lang.Object aProxy, net.jini.core.entry.Entry[] aInitialAttributes)
          Registers this IService implementor with any discovered Jini lookup services.
protected  void register(java.lang.Object aProxy, net.jini.core.entry.Entry[] aInitialAttributes, java.lang.String[] aInitialGroups, net.jini.core.discovery.LookupLocator[] aInitialLocators)
          Registers this IService implementor with any discovered Jini lookup services.
protected  net.jini.core.lookup.ServiceID restore()
          Restores the ServiceID that indicates the unique identifier for this IService instance within Reggie.
 
Methods inherited from class net.sourceforge.esw.service.AService
getHeartbeatGenerator, getPriority, isSane, isStarted, ping, setPriority, start, stop
 
Methods inherited from class net.sourceforge.esw.util.SupportObject
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.service.IService
getHeartbeatGenerator, getPriority, isSane, isStarted, ping, setPriority, start, stop
 
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

proxy

protected java.lang.Object proxy
The Proxy for this ADefaultService implementor.

joinManager

protected net.jini.lookup.JoinManager joinManager
The JoinManager is a Jini class that provides automated Discovery and Joining of Lookup services.

serviceID

protected net.jini.core.lookup.ServiceID serviceID
The ServiceID is a Jini class that provides a unique identifier for a service.

classServer

protected ClassServer classServer
The internal HTTP Class Server for distributing classes.
Constructor Detail

ADefaultService

public ADefaultService()
Creates a new ADefaultService

ADefaultService

public ADefaultService(java.lang.Object aId)
Creates a new ADefaultService with the specified id. This id should be the name of the service, not the unique id of the service.

Parameters:
aID - the name of this ADefaultService
Method Detail

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
Overrides:
die in class AService

register

protected void register(java.lang.Object aProxy,
                        net.jini.core.entry.Entry[] aInitialAttributes,
                        java.lang.String[] aInitialGroups,
                        net.jini.core.discovery.LookupLocator[] aInitialLocators)
                 throws java.io.IOException
Registers this IService implementor with any discovered Jini lookup services. This method should be called during the creational pattern of implementors.

Parameters:
aProxy - the Proxy to be registered with the Jini lookup service.
aInitialAttributes - the array of Entries that describe this IService implementor.
aInitialGroups - the array of lookup groups to find and join.
aInitialLocators - the array of LookupLocators for UnicastDiscovery of lookup services.

register

protected void register(java.lang.Object aProxy,
                        net.jini.core.entry.Entry[] aInitialAttributes)
                 throws java.io.IOException
Registers this IService implementor with any discovered Jini lookup services. This method should be called during the creational pattern of implementors.

This register method will register with all lookup services it can discover.

Parameters:
aProxy - the Proxy to be registered with the Jini lookup service.
aInitialAttributes - the array of Entries that describe this IService implementor.

register

protected void register(net.jini.core.entry.Entry[] aInitialAttributes)
                 throws java.lang.Exception
Registers this IService implementor with any discovered Jini lookup services. This method should be called during the creational pattern of implementors.

This register method will register with all lookup services it can discover.

Parameters:
aInitialAttributes - the array of Entries that describe this IService implementor.

register

protected void register(java.lang.Object aProxy)
                 throws java.io.IOException
Registers this IService implementor with any discovered Jini lookup services. This method should be called during the creational pattern of implementors.

This register method will register with all lookup services it can discover.

Parameters:
aProxy - the Proxy to be registered with the Jini lookup service.

register

protected void register()
                 throws java.lang.Exception
Registers this IService implementor with any discovered Jini lookup services. This method should be called during the creational pattern of implementors.

This register method will register with all lookup services it can discover.


restore

protected net.jini.core.lookup.ServiceID restore()
Restores the ServiceID that indicates the unique identifier for this IService instance within Reggie.

Returns:
the ServiceID instance.

persist

protected void persist(net.jini.core.lookup.ServiceID aID)
Persists the ServiceID returned from Reggie that indicates the unique identifier for this IService instance.

Parameters:
aID - the ServiceID for this IService instance.


Copyright 2002 Free Software Foundation. All Rights Reserved.