We can exclude the Service API packages with ClassDep. If there are Service API classes in a DL jar they'll be superfluous, they won't be loaded by the Smart Proxy ClassLoader, provided the Service API has been loaded in the parent ClassLoader first.

Dennis Reedy wrote:
Since we will be formalizing the convention of creating a service.jar, service-api.jar and service-dl jar, what I was musing about really was the creation of perhaps an extra an unnecessary jar in the case where a service does not use a smart proxy. I agree with Greg, in that a client should always depend on the API jar, and not the DL jar.
The client will have the service-api.jar in it's classpath, and the service 
will have an export codebase set to serve the service-d.jar. The service may 
also create some variant of the previously discussed DLEntry, and the 
service-dl.jar may be provisioned to the client as an option (whether a maven 
repository is used or not).

If the particular service does end up having 2 jars with identical content, oh 
well. It preserves the approach and allows flexibility going forward.

Regards

Dennis

On May 23, 2010, at 450PM, Peter Firmstone wrote:

Dennis Reedy wrote:
Oops, but no. If the service does not have a DL jar, the ServiceItem will not 
be able to be loaded by reggie, so joining the network is a problem
Hi Greg & Dennis,

Reggie's Smart Proxy performs unmarshalling (I realise this is what Dennis 
meant, sorry Dennis, I was thinking of the Service {Registrar}). Reggie's proxy 
also uses com.sun.proxy.MarshalledWrapper to check integrity.

However I've recently added net.jini.core.lookup.MarshalledServiceItem which 
will assist in delayed unmarshalling, giving the client the opportunity to 
pre-download the required classes.  MarshalledServiceItem is abstract, to allow 
the implementation of unmarshalling to be separate from the Jini Platform.

It will still be Reggie's proxy that does the unmarshalling, by extending 
MarshalledServiceItem, however we could pass a CodeSource object to 
getService(CodeSource cs)?  If cs is null, Reggie's proxy can fall back to 
using MarshalledInstance's codebase URL annotation.

That means a CodeSource Entry list could be provided to the client, the client 
then gets a choice, which smart proxy to use, based on the local environment, 
and after local installation.

Due to ClassLoader isolation, the client, although it knows the CodeSource, 
will only be able to interact with the smart proxy via it's Service API.

A Malicious client could download and modify a codebase for the proxy, and 
there's not much we can do about that, it's still possible with 
MarshalledInstance, however using good Serialization practices like, 
defensively copying fields with writeObject() and requiring client 
authentication, we can be reasonable confident.

/**
* MarshalledServiceItem extends ServiceItem and can be used anywhere a
* ServiceItem can.  A MarshalledServiceItem implementation instance
* contains the marshalled form of a Service and it's Entry's,
* the corresponding superclass ServiceItem however contains null values
* for the service and can exclude any Entry's.
*
* The ServiceID shall be in unmarshalled form always in the ServiceItem super 
class.
*
* Since the ServiceItem.service is null, use of this class in existing software
* will not return the service, however it will not break that software as
* ServiceItem's contract is to set service or Entry's to null when they cannot
* be unmarshalled.
*
* ServiceItem's toString() method will return a different result for
* MarshalledServiceItem instances.
*
* If required, a new ServiceItem that is fully unmarshalled
* can be constructed from this class's methods and ServiceID.
*
* @author Peter Firmstone.
*/
public abstract class MarshalledServiceItem extends ServiceItem{
  private static final long SerialVersionUID = 1L;
  protected MarshalledServiceItem(ServiceID id, Entry[] unmarshalledEntries){
      super(id, (Object) null, unmarshalledEntries);
  }
  /**
   * Unmarshall the service proxy.
   * @return the service proxy, null if class not found.
   */
  public abstract Object getService();
  /**
   * Unmarshall the Entry's
   * @return array of Entry's, null entry in array for any class not found.
   */
  public abstract Entry[] getEntries();
}



Reply via email to