dev@jsr311.java.net

Re: Registering Resource Classes (bootstrap)

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 21 May 2007 14:25:38 +0200

Hi Dhanji,

One of the main advantages of using annotations is that a configuration
step using an explicit XML deployment descriptor is not required. We can
make use of the annotation processor. When used as part of compilation
the developer can work with their code and do not need to modify and
keep in sync information in a separate location, e.g. when a new root
resource is created.

For example, in the R2 of SWDP (R2 is the one that we provided as input
to the group, and i will blog about it soon as it has finally been
released), we generate a class in a specified package that returns the
set of root resources (Java classes annotated with UriTemplate whose URI
template begins with '/'). A container picks up this class from the
package name passed as an argument.

As Jerome mentions this also brings into question the dividing line
between the container and the API. I think it would be good to specify
something such that deployment can work with all the containers that are
required to be supported by the JSR (and that can also be used by other
containers) otherwise this will be a major pain point for developers if
(by default) deployment is tied to a specific container. But we should
rule (and i do not see how we can) the use of other deployment
mechanisms if so desired.

Paul.

Dhanji R. Prasanna wrote:
> Hi
>
> This may not sound like an immediate concern, but a lot of discussion
> around the ordering/overriding of resources and sub-resources have
> started so I thought it useful to start a thread on how the runtime
> recognizes resource classes and bootstraps itself.
>
> Common wisdom suggests an xml descriptor with properties and a list of
> resource classes in order. I suggest we abstract that with the optional
> use of a builder:
>
> Jaxrs.configure(props)
> .addPackage(" com.wideplay.webservices")
> .addConfiguration(XmlConfigurer.class, "atomservices.xml") //via
> a user-provided builder
>
> .addResource(Account.class) //override
> .addResource(Client.class ) //extend, etc.
> .buildRuntime()
> .start();
>
> An xml parser layer (or any other configuration mechanism) could be
> added easily. Thoughts, comments?
>
> Dhanji.

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