river-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Firmstone <j...@zeus.net.au>
Subject Re: Jini Spec API changes - Design Decision
Date Fri, 30 Apr 2010 23:14:01 GMT
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 

I have another utility class that constructs an unmarshalled 
ServiceItem, from MarshalledServiceItem.

Check out the code.



View raw message