Bootstrap stubs with fixed UUIDs

View: New views
6 Messages — Rating Filter:   Alert me  

Bootstrap stubs with fixed UUIDs

by Esmond Pitt FACS :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How do you construct these? e.g. if I want to build a JERI Registry, or
export the Activation System via JERI, how do I build the local bootstrap stub?

EJP

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Re: Bootstrap stubs with fixed UUIDs

by Peter Jones - JavaSoft East :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Mar 15, 2009 at 01:54:53AM -0600, Esmond Pitt wrote:
> How do you construct these? e.g. if I want to build a JERI Registry,
> or export the Activation System via JERI, how do I build the local
> bootstrap stub?

You can construct it from the bottom up: first create an Endpoint,
then create an ObjectEndpoint (with the fixed UUID) containing that
Endpoint, then an InvocationHandler containing that ObjectEndpoint,
finally wrapping the result in a dynamic proxy.

-- Peter

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Parent Message unknown Re: Bootstrap stubs with fixed UUIDs

by Esmond Pitt FACS :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Peter. So assuming my remote interface is RemoteSubject, it would go
something like this?

        Class<?>[] intfs = {
                // fill in the remote interface(s) to be implemented
                RemoteMethodControl.class,
                RemoteSubject.class
        };
        // Build a bootstrap stub
        Endpoint ep = SslEndpoint.getInstance("localhost", RemoteSubject.PORT);
        ObjectEndpoint oe = new BasicObjectEndpoint(ep, RemoteSubject.UUID, true);
        InvocationHandler ih = new BasicInvocationHandler(oe, clientConstraints);
        Remote proxy =
(Remote)Proxy.newProxyInstance(RemoteMethodControl.class.getClassLoader(),
intfs, ih);
        RemoteSubject rs = (RemoteSubject)pp.prepareProxy(proxy);

Seems to work.

TIA

EJP

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Re: Bootstrap stubs with fixed UUIDs

by Peter Jones - JavaSoft East :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Something like that, yes.  You may want to include TrustEquivalence in
the proxy interfaces as well, at least BasicInvocationHandler supports
it.  Also, for a remote object with a fixed/well-known port and UUID,
you probably don't mean to enable DGC (i.e. pass true for the third
argument to the BasicObjectEndpoint constructor).

-- Peter


On Tue, Mar 17, 2009 at 04:35:36PM -0600, Esmond Pitt wrote:

> Thanks Peter. So assuming my remote interface is RemoteSubject, it would go
> something like this?
>
> Class<?>[] intfs = {
> // fill in the remote interface(s) to be implemented
> RemoteMethodControl.class,
> RemoteSubject.class
> };
> // Build a bootstrap stub
> Endpoint ep = SslEndpoint.getInstance("localhost", RemoteSubject.PORT);
> ObjectEndpoint oe = new BasicObjectEndpoint(ep, RemoteSubject.UUID, true);
> InvocationHandler ih = new BasicInvocationHandler(oe, clientConstraints);
> Remote proxy =
> (Remote)Proxy.newProxyInstance(RemoteMethodControl.class.getClassLoader(),
> intfs, ih);
> RemoteSubject rs = (RemoteSubject)pp.prepareProxy(proxy);
>
> Seems to work.
>
> TIA
>
> EJP

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Parent Message unknown Re: Bootstrap stubs with fixed UUIDs

by Esmond Pitt FACS :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Should ProxyTrust also be in the list of interfaces?

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Re: Bootstrap stubs with fixed UUIDs

by Peter Jones - JavaSoft East :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Mar 18, 2009 at 06:43:24PM -0600, Esmond Pitt wrote:
> Should ProxyTrust also be in the list of interfaces?

Partly, it depends on whether the target remote object supports
supplying a proxy trust verifier to clients, either by implementing
ProxyTrust itself or by implementing ServerProxyTrust.  If it
implements ProxyTrust, then inclusion of that interface would follow
from it being one of the object's remote interfaces.  If it implements
ServerProxyTrust and was exported with a BasicInvocationDispatcher
(like through ProxyTrustILFactory), then it would also be appropriate,
because BasicInvocationDispatcher forwards ProxyTrust.getProxyVerifier
to ServerProxyTrust.getProxyVerifier on the remote object.  If it was
exported with ProxyTrustExporter-- well, you probably wouldn't be in
that situation with a remote object that you expected clients to
synthesize their own such bootstrap stubs to.[*]

On the other hand, if this bootstrap stub is simply a dynamic proxy
defined by a trusted class loader and only contains instances of local
JERI classes-- it's not a "smart proxy" with downloaded code-- and it
is not intended to be passed to another JVM, then the local JERI trust
verifiers should be sufficient for a trust verification operation, and
ProxyTrustVerifier shouldn't be needed, so whether the stub implements
ProxyTrust is likely moot.

-- Peter

[*] But for completeness, the top-level invocation handler in that
case would be a ProxyTrustInvocationHandler, and it would be the
contained "bootstrap proxy"-- in the other sense of bootstrapping
proxy trust verification-- that would need to implement ProxyTrust.

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...