|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.kedwards.swt.ServiceWrapper
ServiceWrapper.java
A ServiceWrapper handles a number of chores related to being a service. In particular, it
Note that ServiceWrappers are used differently depending on whether the service backend is activatable or not. Most service backends are created and then passed to a wrapper for management. Activatable backends, though, create their own service wrappers internally.
See http://www.kedwards.com/jini
No warranty expressed or implied; use at your own risk; for educational purposes only.
Field Summary | |
static java.lang.String |
DEBUG
Property to control wrapper debugging. |
static java.lang.String |
SWT_NO_ADMIN_UI_ATTR
Set to any value to prevent the wrapper from adding a default admin UI to the service's registration. |
static java.lang.String |
SWT_NO_DEBUG_ATTRS
Set to any value to prevent the wrapper from adding its own debugging attributes to the service's registration. |
Constructor Summary | |
ServiceWrapper(ServiceBackend backend,
Persistifier persistifier,
ClassExporter exporter)
This is the most general form of the constructor. |
|
ServiceWrapper(ServiceBackend backend,
java.lang.String file)
Create a new wrapper to manage the provided backend. |
|
ServiceWrapper(ServiceBackend backend,
java.lang.String file,
ClassExporter exporter)
Create a new wrapper to manage the provided backend. |
Method Summary | |
static void |
__run(ServiceBackend backend,
java.lang.String checkpointLoc)
Subclasses can launch services in one of two ways. |
void |
checkpoint()
This is the top-level method that is called to initiate the checkpoint process. |
static java.lang.String |
declassify(java.lang.String classname)
|
void |
getCheckpointData(TaggedPersistentData data)
Called when the wrapper must checkpoint its state. |
net.jini.discovery.DiscoveryManagement |
getDiscoveryManager()
Returns the discovery management object in use by the wrapper. |
ClassExporter |
getExporter()
Returns the class exporter in use by the wrapper. |
protected net.jini.core.entry.Entry[] |
getInitialAttributes()
This method calls the backend to get any initial attributes. |
net.jini.lookup.JoinManager |
getJoinManager()
Returns the join manager in use by the wrapper. |
Persistifier |
getPersistifier()
Returns the persistifier in use by the wrapper. |
protected java.lang.Object |
getProxy()
This method calls out to the backend to get the proxy. |
protected net.jini.core.entry.Entry[] |
getWrapperProvidedAttributes()
The wrapper can optionally add its own attributes to the service's registration that are not directly provided by the backend. |
void |
initialize()
Initialize the wrapper. |
void |
restore()
This is the top-level method that is called to restore the state of the service from checkpointed data. |
static void |
run(ServiceBackend backend,
java.lang.String checkpointLoc)
|
static void |
run(ServiceBackend backend,
java.lang.String[] commandLineArgs)
|
void |
serviceIDNotify(net.jini.core.lookup.ServiceID id)
Called by the JoinManager when we've got a service ID. |
void |
setCheckpointData(TaggedPersistentData data)
Called when the wrapper must recover its state from checkpointed data. |
void |
shutdown()
administration will call this to shutdown. |
Field Detail |
public static final java.lang.String DEBUG
public static final java.lang.String SWT_NO_DEBUG_ATTRS
public static final java.lang.String SWT_NO_ADMIN_UI_ATTR
Constructor Detail |
public ServiceWrapper(ServiceBackend backend, java.lang.String file) throws java.io.IOException, ArgException
backend
- A service backend to be managed.file
- A file to use for checkpoint data.public ServiceWrapper(ServiceBackend backend, java.lang.String file, ClassExporter exporter) throws java.io.IOException, ArgException
backend
- A service backend to be managed.file
- A file to use for checkpoint data.exporter
- The class exporter to use to serve classfiles.public ServiceWrapper(ServiceBackend backend, Persistifier persistifier, ClassExporter exporter) throws java.io.IOException
backend
- A service backend to be managed.persistifier
- An object that will handle the service's
checkpoint/restore duties.exprter
- The exporter to use to serve classfiles.Method Detail |
public void shutdown()
public net.jini.lookup.JoinManager getJoinManager()
public net.jini.discovery.DiscoveryManagement getDiscoveryManager()
public Persistifier getPersistifier()
public ClassExporter getExporter()
public void serviceIDNotify(net.jini.core.lookup.ServiceID id)
public void getCheckpointData(TaggedPersistentData data) throws java.io.IOException
getCheckpointData
in interface Checkpointed
data
- The persistent data object to which the wrapper
adds the data it wants to be checkpointed.public void setCheckpointData(TaggedPersistentData data) throws java.io.IOException, java.lang.ClassNotFoundException
setCheckpointData
in interface Checkpointed
data
- The persistent data object from which the wrapper
will recover its state.public void checkpoint() throws java.io.IOException
public void restore() throws java.io.IOException, java.lang.ClassNotFoundException
protected java.lang.Object getProxy() throws java.io.IOException, java.lang.ClassNotFoundException
protected net.jini.core.entry.Entry[] getInitialAttributes() throws java.io.IOException, java.lang.ClassNotFoundException
protected net.jini.core.entry.Entry[] getWrapperProvidedAttributes()
public void initialize() throws java.lang.Exception
public static java.lang.String declassify(java.lang.String classname)
public static void __run(ServiceBackend backend, java.lang.String checkpointLoc)
public static void run(ServiceBackend backend, java.lang.String checkpointLoc)
public static void run(ServiceBackend backend, java.lang.String[] commandLineArgs) throws ArgException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |