com.kedwards.swt
Class ActivatableServiceBackend

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.activation.Activatable
                    |
                    +--com.kedwards.swt.ActivatableServiceBackend
All Implemented Interfaces:
Checkpointed, java.rmi.Remote, RemoteAdmin, java.io.Serializable, ServiceBackend

public abstract class ActivatableServiceBackend
extends java.rmi.activation.Activatable
implements ServiceBackend, RemoteAdmin

ActivatableServiceBackend.java

See http://www.kedwards.com/jini

No warranty expressed or implied; use at your own risk; for educational purposes only.

Author:
Keith Edwards
See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ActivatableServiceBackend(java.rmi.activation.ActivationID id, java.rmi.MarshalledObject data)
           
 
Method Summary
 java.lang.Object getAdmin()
          Returns the administration object for this service.
 java.rmi.activation.ActivationID getID()
          Makes the ActivationID accessible publically.
 net.jini.core.entry.Entry[] getInitialAttributes()
          Returns the set of entries that will initially be associated with the service.
 java.lang.String[] getInitialGroups()
          Returns the initial set of groups that the service will discover.
 net.jini.core.discovery.LookupLocator[] getInitialLocators()
          Returns the initial set of locators that the service will discover.
abstract  java.lang.Object getProxy()
          Subclasses should override to return their proxy.
 java.lang.String getServiceName()
          Unless overridden by a subclass, this returns the de-packaged name of the class.
 ServiceWrapper getServiceWrapper()
          Return the wrapper used to host this service, if it has been set.
abstract  void initialize()
          Called the first time the service is run to set up init values
abstract  void postInitialize()
          Called when the ServiceID is available
abstract  void preInitialize()
          Called when the wrapper is available
 void setServiceID(net.jini.core.lookup.ServiceID serviceID)
          Called to set the ID of the service.
 void setServiceWrapper(ServiceWrapper wrapper)
          Should only be called once to set the wrapper.
abstract  void shutdown()
          Called when the service must be terminated
 
Methods inherited from class java.rmi.activation.Activatable
exportObject, exportObject, exportObject, exportObject, inactive, register, unexportObject, unregister
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.kedwards.swt.persist.Checkpointed
getCheckpointData, setCheckpointData
 

Constructor Detail

ActivatableServiceBackend

public ActivatableServiceBackend(java.rmi.activation.ActivationID id,
                                 java.rmi.MarshalledObject data)
                          throws java.rmi.RemoteException
Method Detail

getServiceName

public java.lang.String getServiceName()
Unless overridden by a subclass, this returns the de-packaged name of the class.
Specified by:
getServiceName in interface ServiceBackend
Returns:
Name of the service

getID

public java.rmi.activation.ActivationID getID()
Makes the ActivationID accessible publically.
Overrides:
getID in class java.rmi.activation.Activatable
Returns:
The activation ID.

getServiceWrapper

public ServiceWrapper getServiceWrapper()
Return the wrapper used to host this service, if it has been set.
Specified by:
getServiceWrapper in interface ServiceBackend
Returns:
The service's wrapper.

setServiceWrapper

public final void setServiceWrapper(ServiceWrapper wrapper)
Should only be called once to set the wrapper. Final because subclasses should do initializion in preInitialize
Specified by:
setServiceWrapper in interface ServiceBackend

getAdmin

public java.lang.Object getAdmin()
                          throws java.rmi.RemoteException
Returns the administration object for this service. Default implementation returns a basic admin stub.
Specified by:
getAdmin in interface ServiceBackend
Returns:
The admin object for this service.

getProxy

public abstract java.lang.Object getProxy()
Subclasses should override to return their proxy.
Specified by:
getProxy in interface ServiceBackend
Following copied from interface: com.kedwards.swt.ServiceBackend
Returns:
The service's proxy.

preInitialize

public abstract void preInitialize()
                            throws java.lang.Exception
Called when the wrapper is available
Specified by:
preInitialize in interface ServiceBackend

initialize

public abstract void initialize()
                         throws java.lang.Exception
Called the first time the service is run to set up init values
Specified by:
initialize in interface ServiceBackend

postInitialize

public abstract void postInitialize()
                             throws java.lang.Exception
Called when the ServiceID is available
Specified by:
postInitialize in interface ServiceBackend

shutdown

public abstract void shutdown()
Called when the service must be terminated
Specified by:
shutdown in interface ServiceBackend

setServiceID

public final void setServiceID(net.jini.core.lookup.ServiceID serviceID)
Called to set the ID of the service. Final because subclasses should do initialization in postInitialize
Specified by:
setServiceID in interface ServiceBackend

getInitialLocators

public net.jini.core.discovery.LookupLocator[] getInitialLocators()
Returns the initial set of locators that the service will discover. By default, returns an empty list. Subclasses can override to return a different set of locators to discover.
Specified by:
getInitialLocators in interface ServiceBackend
Returns:
The locators to discover on the initial run.

getInitialGroups

public java.lang.String[] getInitialGroups()
Returns the initial set of groups that the service will discover. By default, returns only the public group. Subclasses can override to return a different set of locators to discover.
Specified by:
getInitialGroups in interface ServiceBackend
Returns:
The groups to discover on the initial run.

getInitialAttributes

public net.jini.core.entry.Entry[] getInitialAttributes()
Returns the set of entries that will initially be associated with the service. By default, an empty list is returned. Subclasses can override to return a different set of entries.
Specified by:
getInitialAttributes in interface ServiceBackend
Returns:
The initial set of entries to be associated with the service.