com.kedwards.swt
Interface ServiceBackend

All Superinterfaces:
Checkpointed
All Known Implementing Classes:
ActivatableServiceBackend, UnicastServiceBackend

public interface ServiceBackend
extends Checkpointed

ServiceBackend.java

The stages in a service backend's life are:

Thus, the order is:

creation - preInit - (restore|init) -> postInit - shutdown

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

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

Author:
Keith Edwards

Method Summary
 java.lang.Object getAdmin()
          Optionally called by the service's to get the admin proxy when asked.
 net.jini.core.entry.Entry[] getInitialAttributes()
          Services can specify their initial attributes.
 java.lang.String[] getInitialGroups()
          Services can specify their initial lookup groups.
 net.jini.core.discovery.LookupLocator[] getInitialLocators()
          Services can specify their initial lookup locators.
 java.lang.Object getProxy()
          Called by the service wrapper to fetch the proxy for publication.
 java.lang.String getServiceName()
          Return a name for this service; this will likely be the same name attached in a Name attribute.
 ServiceWrapper getServiceWrapper()
          Gets the current service wrapper.
 void initialize()
          Called the first time the service is run, before a JoinManager is created.
 void postInitialize()
          Called by the service wrapper once the service ID has been set.
 void preInitialize()
          Called by the service wrapper for post-construction initialization after the sevice wrapper is all set to go.
 void setServiceID(net.jini.core.lookup.ServiceID serviceID)
          Called when the service's ID is available to inform the backend of its ID.
 void setServiceWrapper(ServiceWrapper wrapper)
          Sets the current service wrapper.
 void shutdown()
          Called by the service wrapper when the backend should be terminated.
 
Methods inherited from interface com.kedwards.swt.persist.Checkpointed
getCheckpointData, setCheckpointData
 

Method Detail

getServiceName

public java.lang.String getServiceName()
Return a name for this service; this will likely be the same name attached in a Name attribute.
Returns:
The name of the service.

getProxy

public java.lang.Object getProxy()
                          throws java.rmi.RemoteException
Called by the service wrapper to fetch the proxy for publication.
Returns:
The service's proxy.

getAdmin

public java.lang.Object getAdmin()
                          throws java.rmi.RemoteException
Optionally called by the service's to get the admin proxy when asked.
Returns:
An admin object for the service.

preInitialize

public void preInitialize()
                   throws java.lang.Exception
Called by the service wrapper for post-construction initialization after the sevice wrapper is all set to go.

initialize

public void initialize()
                throws java.lang.Exception
Called the first time the service is run, before a JoinManager is created.

postInitialize

public void postInitialize()
                    throws java.lang.Exception
Called by the service wrapper once the service ID has been set.

shutdown

public void shutdown()
Called by the service wrapper when the backend should be terminated.

setServiceWrapper

public void setServiceWrapper(ServiceWrapper wrapper)
Sets the current service wrapper. Should only be called once.

getServiceWrapper

public ServiceWrapper getServiceWrapper()
Gets the current service wrapper.

getInitialGroups

public java.lang.String[] getInitialGroups()
Services can specify their initial lookup groups. The value returned from this method will only be used on the initial run.

getInitialLocators

public net.jini.core.discovery.LookupLocator[] getInitialLocators()
Services can specify their initial lookup locators. The value returned from this method will only be used on the initial run.

getInitialAttributes

public net.jini.core.entry.Entry[] getInitialAttributes()
Services can specify their initial attributes. The value returned from this method will only be used on the initial run.

setServiceID

public void setServiceID(net.jini.core.lookup.ServiceID serviceID)
Called when the service's ID is available to inform the backend of its ID.