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: Codebase service?
Date Sun, 23 May 2010 20:50:26 GMT
> 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 
 * 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 
 * 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[] 
        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 
    public abstract Entry[] getEntries();

View raw message