[webbeans-dev] Re: XML configuration format

Jim Knutson knutson at us.ibm.com
Wed Jan 7 16:16:53 EST 2009


As Mike has mentioned, I also prefer platform consistency and if there's
a problem with the platform view, we should fix it for the platform.

Let me throw out some potentials here:

* There is a general pattern existing in the platform today for sharing
  schemas across the technologies.  Web services, servlets, ejbs, and I
  believe JCA Adapters all use this.  Given that this metadata is likely
  to be shared across multiple technologies, it might be worth looking
  at reusing the platform schema sharing mechanism to encorporate the
  metadata into existing platform DDs.  This further emphasises the
  fact that this spec. is using the existing platform component model
  to enhance it.
* The implication of the above doesn't preclude the use of a unique
  namespaces, but the default should probably be a platform namespace
  for the well known cases.
* Any Java-XML mappings should not be defined by this spec.  JAXB already
  covers appropriate Java-XML mappings and we shouldn't define anything
  different.  It's a pain to do and get it right for all cases.

I'm going to have to dig deeper to fully understand the metadata and
Java-XML mappings, but I'm assuming the only real need for this is to
encorporate extensibility into the XML instances for programmer defined
stereotypes.

Thanks,
Jim Knutson
WebSphere J2EE Architect

Scott Ferguson <ferg at caucho.com> wrote on 12/21/2008 09:58:08 AM:

>
> On Dec 20, 2008, at 10:12 PM, Gavin King wrote:
>
> > I would like to open up a discussion about the XML format defined in
> > chapter 10.
> >
> > Mike is concerned that the XML format is different to the style used
> > in other Java EE specifications, where class/method names are
> > generally specified as strings in the body of XML elements, and that
> > the XML format may turn out to be confusing to users.
> >
> > On the other hand, the format currently defined by the specification
> > is typesafe, allowing tooling to provide validation and
> > auto-completion of all class/method names, and is also less verbose.
> > It's also consistent with the approach used by existing solutions in
> > the spec (Spring, Seam).
> >
> > I've recently discovered that it's possible to write a Java 6
> > Processor that would generate the XML schema for a package containing
> > web beans as part of the compilation process. (This is an awesome new
> > feature of javac, that used to be provided by the APT plugin.)
> >
> > One possible path to take would be to use hyphenated names in the XML
> > (i.e. <foo-bar> instead of <FooBar>) to make the XML more visually
> > consistent with other EE descriptors.
>
> I love the new format.  The urn:java:package namespace is brilliant,
> to the extent that I'd go postal if it reverted to the earlier draft.
> Among other advantages, it makes the XML so much more readable by
> emphasizing the bean's name.  The name change to <foo-bar> would be a
> good change, for consistency.
>
> Specifically, I just went through the process of changing our security
> tag/bean configuration to the new format, and the improvement is
> dramatic.  With the new format, the XML expresses exactly what the
> configuration means, and with no extraneous verbiage.  It's brilliant.
>
> There are a few things that I'd like tweaked, though:
>
>    1) The inline bean vs property needs to be simplified.  (9.5
> injection point declarations), specifically the existence of a child
> element should not affect the parsing.  Instead, it should follow the
> method model (9.2.6) where "has a direct child <Initializer>, ..., or
> binding type."  9.5 should be rewritten as:
>
>       a) If the Java type is a parameterized type .... is a type
> declaration
>       b) Otherwise if ... binding type ... is a type declaration
>       c) Otherwise, the injection point declaration is an inline Web
> Bean declaration, and the declared type ...
>
> i.e. removing the old 3rd rule because it was making things more
> confusing.  The slight extra verbosity by requiring <Current/> for an
> injected type is outweighed by the simplification, and consistency
> with 9.2.6.
>
> The specific problem is: when does an XML element refer to a type and
> when does it refer to a bean to be instantiated (9.6 vs 9.7), which
> isn't obvious from the spec (it's well-defined, but can be simplified.)
>
>    2) Property injection (bean-style setters) really need to be
> supported.  The bean pattern is historic and embedded in essentially
> all specifications, so it's not really something WebBeans can avoid.
> Aside from the historic value, property injection lets you validate
> input easily at the configuration point, which is very nice.
>
>    3) Argument vs field is somewhat visually confusing.  The spec
> logic works, but it's easy to confuse a constructor arg for a field
> and waste time.  I'm not sure it needs to be changed, but something to
> think about.  You could have field/property as <myapp:foo-bar> and
> types/annotations as <myapp:FooBar> or add an <arg> (I'm not sure
> these are good ideas or even if there needs to be a change.  I'm just
> throwing the idea out.)
>
>    4) Annotation declaration is great.  I would like the ability to
> add non-webbeans annotations (for service declarations/introspection),
> but that non-critical and could certainly be put off until a later spec.
>
> -- Scott
>
> >
> >
> > I would like to get everyone's thoughts on this issue:
> >
> > Do you like the existing format?
> > Do you find it confusing? In what way?
> > Have you used this approach in Spring or Seam? If so, how did it
> > compare?
> > How important is typesafety?
> >
> > --
> > Gavin King
> > gavin.king at gmail.com
> > http://in.relation.to/Bloggers/Gavin
> > http://hibernate.org
> > http://seamframework.org
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20090107/6c1645ec/attachment.html 


More information about the weld-dev mailing list