I'm working on something I came across at regular intervals the last few
years for some of the services I've created and that is the ability to
create class loaders from within a service that play nice in the Jini
environment, i.e. which have the right delegation model (the service as
parent), allow for proper codebase annotations and have the correct set
of permissions 'assigned' and take care of some of the 'versioning'
hassle with long running services that must be able to adopt to a
changing environment.

Due to my work for developing an improved web application server based
on Jetty that runs as a JSC Service in Seven and that can deploy and
reload plain WAR files and provides a seamless integration in a Jini
environment I came to the point I'm trying to experiment with a class
loader factory as part of Seven, as Seven provides all the class loader
tricks listed above that I need.

However there is one hurdle I can't seem to take [1] and that is
dynamically assigning permissions the the protection domains associated
with the class loaders due to the fact that Dynamicpolicy doesn't
provide a method in which you could pass in a class loader, all methods
take a class as argument. The funny thing is though that the semantics
for this methods make it clear the permissions are really assigned to
the protection domains associated with the class loader [2] for the
class passed in. The actual DynamicPolicy provider implementation also
indicates that there seems to be no reason why the DynamicPolicy
interface can't support passing in a class loader.

Any thought on this matter and if this is considered a "good thing" to
have this functionality how to approach this.

[1] I could play tricks to scan the class path of the newly created
class loader and try to get a class definition (without initializing the
class itself) and use that one to call into DynamicPolicy but this is
something I really would like to prevent.

[2] to be more correct this is "protection domains (including ones
not yet created) that are associated with the class loader of the given
class and possess at least the given set of principals"
--
Mark

Reply via email to