Re: Client with multiple codebases

Mark Brouwer <[email protected]> Wed, 28 Nov 2007 18:16:24 +0100
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Calum Shaw-Mackay wrote:
> Hi -
> 
> I've got a Service with a ServiceUI - the Service Browser has it's own
> codebase(A).
> Part of the UI allows me to deploy an object into the service which
> has also has it's own, different, codebase(B).
> How do I push the object to the service with Codebase (B) without
> interfering with the Service Browsers codebase(A) - I don't want to
> use....
> 
> System.setProperty("java.rmi.server.codebase", B)
> //Deploy object to service
> System.setProperty("java.rmi.server.codebase", A)
> 
> ... because I;m sure this will get really messy and not have a nice ending.....
> 
> There is probably a really simple answer.....
> 

Hi Calum,

In case the JVM running your ServiceUI browser has the 
PreferredClassProvider installed you could define the objects in an 
instance of PreferredClassLoader (or any other class loader that 
implements ClassAnnotation) and create that class loader with a codebase 
annotation you think is right. A URLClassLoader should also work as the 
classes defined in that class loader have a codebase annotation that 
equals the URLs with which it has been created.

As I read the above I believe your ServiceUI could take care of the 
class loader creation, it probably need some permissions that are beyond 
the standard set of permissions but if you trust it I guess that won't 
be a problem.
-- 
Mark

--------------------------------------------------------------------------
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 [email protected]