When I wanted a way of returning marshalled or semi marshalled
ServiceItem results from StreamServiceRegistrar, I chose to extend
ServiceItem, and add two methods:
Object getService()
Entry[] getEntries()
I called this class MarshalledServiceItem.
Here's a new method from StreamServiceRegistrar:
ResultStream<ServiceItem> lookup(ServiceTemplate tmpl,
Class<? extends Entry>[] unmarshalledEntries, int maxBatchSize)
throws RemoteException;
The array of unmarshalledEntries is to request these entry classes be
unmarshalled and available in ServiceItem.attributeSets.
ServiceItem.serviceID is always unmarshalled.
ServiceItem.service is null, if delayed unmarshalling is supported.
I chose to make MarshalledServiceItem abstract, the reason: ServiceItem
implements Serializable, which would cause the Registrar's
implementation to be published in Jini's API, so while
MarshalledServiceItem extends ServiceItem, none of its methods are
mutator methods and only return the unmarshalled service and complete
Entry's.
I have another utility class that constructs an unmarshalled
ServiceItem, from MarshalledServiceItem.
Check out the code.
Cheers,
Peter.