dev@jersey.java.net

Re: ResourceClass scanner <was> Re: I am here again ......

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 06 Nov 2007 10:30:07 +0100

Aaron Anderson wrote:
>
>
> */Paul Sandoz <Paul.Sandoz_at_Sun.COM>/* wrote:
>
>
> The latter, so perhaps the naming is not appropriate. What would you
> prefer ?
>
> DynamicResourceConfig is fine, or maybe RuntimeResourceConfig
>

I think i prefer the latter :-)


> A ResourceConfig is a separate thing from a WebApplication and you may
> want to dynamically add a new resource independently of the resource
> config implementation. So i think it best to keep the things separate
> and have methods exposed on WebApplication directly.
>
> Do you require removal as well as addition of a resource class?
>
> If I were to start a Jersey wish list, then yes :) I am working with a
> framework where I wish to dynamically "provision" individual resource
> classes to a web application "endpoint" without a container restart. I
> understand that the Jersey framework follows the JavaEE web application
> framework pattern of deploying a pre-defined set of artifacts as an
> atomic web application to a given container. My requirements may be
> outside the normal intended use of Jersey. I am content with maintaining
> my existing approach of managing the set of resource classes assigned to
> a Jersey web application and then just simply re-creating the web
> application if the set of resource classes changes, which should not
> occur often.
>

Being outside of EE is fine. Jersey is meant to work on SE and EE but
should be flexible enough to adapt to other deployment environments
(e.g. like integration into ESBs etc).

You are empowered to influence things :-) Do you want to take a stab at
modifying WebApplication and RootResourceClass i.e. create a branch to
start working on this?

There are some synchronization issues for the meta class map, but i
think that can easily solved be "clone and replace" so that no
synchronization is required for something that is holding on to the old
reference (IIUC assignment of fields is thread safe).

RootResourceClass required functionality to clone the object referenced
in the field:

    BaseResourceClass.uriResolver

modify it and update that field.

Such work might actually lead to something interesting w.r.t. dynamic
modification of a web application when prototyping. This is completely
theoretical but, for example, say we are scripting a web app in Groovy
and we add a new script, change or delete a script. We could have a file
monitor that gets notified to changes of certain directories and could
update WebApplication accordingly. I would like to ensure it is at least
possible to be dynamic with view technologies so why not for the
resources (the controllers) as well?

Paul.

> Thanks,
>
> Aaron
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109