users@javaee-spec.java.net

[javaee-spec users] Re: [jsr342-experts] Re: Configuration

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Fri, 15 Jul 2011 13:26:39 +0100

On 14 Jul 2011, at 21:53, Bill Shannon wrote:

> Thanks for the pointer, Reza. I've spent a little time trying to read it
> but I'm finding it very difficult to read. I feel like I've come in in the
> middle of the story.
>
> From my view about 10,000 feet up, it looks like this is the same as
> Seam Config, which is the same as what was originally proposed for CDI.
> As I understand it, the general idea is to associate XML namespaces
> with Java package or class names, then use elements in that namespace
> to reference (e.g.) methods or properties or fields of the class. The
> XML elements are then used to modify the configuration of those Java
> elements, e.g., by adding or removing the effective annotations applied
> to those elements, and by specifying the values to be injected into those
> elements, possibly by reference to other elements.
>
> Is that close?

That is how Seam Config (which is about 90% the same as the original proposal for CDI 1.0 XML) works.

>
> I kind of like that approach, and it seems to make a lot of sense for the
> cases that involve configuring particular Java classes.

Yes, if we could apply this to be able to configure all user classes in EE, it would be a massive win IMO.

>
> What I don't understand is how that approach would be used to replace the
> full range of things you can configure with our existing deployment
> descriptors. How would I use this to replace application.xml? How would
> I configure the location of the library directory? How would I list the
> modules included in the application? (I can imagine answers to these
> questions, but what I want to know is how *you* think this would work.)

AIUI the reason that XML config got dropped from CDI 1.0 was that it wasn't consistent with the rest of the deployment descriptors in EE (it used attributes and schema a lot, as opposed to dtd and elements). I personally think a simple update to "modern" xml would be a sufficient for these deployment descriptors. IOW add in schema support so we can merge files easily and make proper use of attributes for configuring elements which just have short text bodies.

>
> In any event, the basic "bean configuration" capability you describe seems
> like it would fit well with CDI, where it was first proposed. We know that
> we need a way to specify or override CDI configuration using XML, but
> unfortunately I don't see that in the CDI 1.1 JSR. Perhaps this is being
> deferred until CDI 2.0 and/or Java EE 8?

We didn't propose it for CDI 1.1 for these reasons:

* That the primary objection to the XML config in CDI 1.0 came from the Java EE EG as the design wasn't consistent with other dd's in Java EE, and that this is not something that the CDI EG (1.1) could resolve nor was there any mention in the EE7 JSR proposal to do a wholescale review of dd's. It would have been a worthless exercise to consider it IOW.
* That the CDI EG for 1.0 decided that they would prefer no XML config than a design that was consistent with the other dd's in EE 6, and that there has been no change of opinion here.
* That portable extensions fill the gap making it less relevant for CDI in isolation. If we could extend this XML approach to other specs as well, it suddenly becomes much more interesting again.

HTH