com.artima.place
Class MarshalledServiceItemLink
java.lang.Object
|
+--com.artima.place.MarshalledServiceItemLink
- All Implemented Interfaces:
- Link, java.io.Serializable
- public final class MarshalledServiceItemLink
- extends java.lang.Object
- implements Link
A Link that contains a reference to a marshalled Jini ServiceItem.
The reference is stored via a MarshalledObject so that deserialization
of the service item occurs only when the service is retrieved from this link for
the first time. Once the service item is deserialized, retrieveService
will just return that service item (it will not attempt to deserialize it again).
This class in effect adapts the interface of a ServiceItem
to the Link interface.
- See Also:
- Serialized Form
|
Constructor Summary |
MarshalledServiceItemLink(java.rmi.MarshalledObject marsha)
Construct a MarshalledServiceItemLink with the passed
MarshalledObject. |
MarshalledServiceItemLink(net.jini.core.lookup.ServiceItem item)
Construct a MarshalledServiceItemLink with the passed
ServiceItem. |
|
Method Summary |
boolean |
equals(java.lang.Object o)
Two MarshalledServiceItemLinks are equal only if they
produce a semantically identical ServiceItem. |
net.jini.core.lookup.ServiceItem |
retrieveService()
Retrieve this service. |
void |
stopRetrieval()
Requests a service retrieval to stop. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MarshalledServiceItemLink
public MarshalledServiceItemLink(java.rmi.MarshalledObject marsha)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Construct a
MarshalledServiceItemLink with the passed
MarshalledObject. The MarshalledObject must contain the
serialized service item. (This constructor will unmarshal the passed
MarshalledObject just to make sure it contains a
ServiceItem.
- Parameters:
marsha - the MarshalledObject form of the service item
MarshalledServiceItemLink
public MarshalledServiceItemLink(net.jini.core.lookup.ServiceItem item)
throws java.io.IOException
- Construct a
MarshalledServiceItemLink with the passed
ServiceItem.
- Parameters:
factory - the URLFactory to place in a ServiceItem
retrieveService
public net.jini.core.lookup.ServiceItem retrieveService()
throws java.rmi.RemoteException,
StoppedException
- Retrieve this service.
This method will return the unmarshalled
ServiceItem.
- Specified by:
retrieveService in interface Link
- Returns:
- the
ServiceItem the retrieved service item - Throws:
RemoteException - to indicate a failure in retrieving the serviceStoppedException - to indicate that the request was stopped
stopRetrieval
public void stopRetrieval()
- Requests a service retrieval to stop. Since invocations
of
retrieveService in this class always returns
immediately with a reference to the unmarshalled ServiceItem,
this method does nothing.
- Specified by:
stopRetrieval in interface Link
equals
public boolean equals(java.lang.Object o)
- Two
MarshalledServiceItemLinks are equal only if they
produce a semantically identical ServiceItem.
- Overrides:
equals in class java.lang.Object