[webbeans-dev] Re: XML configuration format

Gavin King gavin at hibernate.org
Thu Jan 8 09:22:37 EST 2009


On Thu, Jan 8, 2009 at 10:38 AM, Jim Knutson <knutson at us.ibm.com> wrote:

>> * but it is *not* more difficult for beginners to understand how to
>> configure a third-party library containing web beans - in fact it is
>> much easier since they don't need to go off and look at the Java code
>
> I think we could look at what the servlet EG is doing for web.xml fragments
> and do something similar.  I don't think they require unique namespaces
> to handle that.  If this is something we really need, then we should push
> the EJB EG for something similar and utilize it.

That's a different problem, Jim.

What they're trying to do is let framework developers configure the
servlet engine w/o messing with the central XML file.

Our usecase is the exact opposite: we're trying to let you configure
third-party frameworks from a central file!

:-)


>> However, I'm aware that there are some developers who still prefer to
>> use XML for everything. I'm not sure exactly how many of them there
>> are, nor to what extent we should to cater to their needs, nor which
>> of the XML formats they prefer.
>
> Given they already have build tools in place for generating DDs, a
> syntactical change of this magnitude would require significant rewrites
> for them to take advantage of this spec.  Adding elements is not as
> big a deal.

I don't really know what you mean here. I'm not aware of anyone who is
using tooling to generate metadata relating to dependency injection.
I'm sure someone, somewhere has done this, but I don't believe it's at
all common.


> I think the point is that you need to know XML Schema with this spec.
> whereas you follow patterns for the platform DDs.  Assuming you use
> an IDE and get content assist, most IDE DD editors will preset the
> DD namespaces so you can get content assist whereas generated XML schemas
> require knowledge of how to add additional namespaces and configure
> IDEs to use them.  That's not exactly trivial if all you want to do
> is develop and use business logic.

My IDE (Eclipse) automagically understands XML schema. There's no
configuration needed. Yes, I need to add the list of namespaces at the
top of my file but that's really not very difficult. I'm inclined to
think that pretty much everyone already knows how to do this. For one
thing, Spring uses the namespace-based approach, and a big chunk of EE
developers use Spring.

And the point is that the new-style XML gives you context assist and
validation for much more stuff than the old-style XML. With the old
style XML you get content assist for <class> and <method>, elements
that simply don't exist in the new-style XML! The old-style doesn't
help you at all when you start typing the actual class and method
names - which are more or less the *only* things you need to type in
the new-style XML (where they *can* be autocompleted).


> The only caveat to this is that this spec. is supposed to integrate
> JSF and EJB, so JSF developers are more likely to be familiar with
> dealing with namespaces.  However, I got the impression that the
> developers this spec. would be most targetted at would be the business
> logic developers.

Thanks Jim, this is a point that I had missed: that the approach in
the current spec *is* already used in the platform, in both JSF and
JSP ! :-)


>> Say I'm using a library written by someone else, that can be
>> configured using a web beans XML schema. How is this schema any
>> different from any other XML schema that is used by developers today
>> to configure stuff? Remember, the XML author is not required to know
>> anything at all about the underlying Java classes and methods to
>> author this configuration document. They get a schema, and they write
>> XML using the elements defined by that schema. They don't know that
>> the element names are actually Java class and method names.
>
> A typical component developer doesn't knowingly deal with XML schema
> unless they are a web services component developer.

I don't believe that's right. All the EE XML formats are defined using
schemas. Every EE developer today deals with schemas every day.

It's certainly true that the vast majority of developers don't
*define* schemas, but the whole point of this is that they don't need
to in web beans either: the schema can be generated by javac.


>> If you're a *user* of the XML schema, a document author, you don't
>> need to know anything at all about how the Java classes relate to the
>> XML schema. If you're the provider of the XML schema, you also don't
>> need to know much about the rules, since the schema will be generated
>> for you.
>
> But either you need to have knowledge of how XML Schema translates into
> a syntactically and semantically correct XML document instance or you
> have to have knowledge of how to setup tools to use XML schema to do
> that for you.  Either way, you have to know more than the average
> developer does today.

Right, you would use tools, and what I'm saying is that there's just
nothing to set up these days. Todays tooling handles XML as well as
yesterday's tooling handled plain text.


-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list