Re: custom metatdata attributes

Peter Donald <[email protected]> Sat, 11 Jan 2003 12:08:28 +1100
Newsgroups gmane.comp.jakarta.avalon.apps.devel,gmane.comp.jakarta.avalon.devel
Message-ID <[email protected]>
On Sat, 11 Jan 2003 04:20, Jakob Praher wrote:
> Am Mit, 2003-01-08 um 06.23 schrieb Peter Donald:
> > Hi,
> >
> > On Wed, 8 Jan 2003 03:44, Leo Simons wrote:
> > > /** @attribute SomeClassNameAttribute("blaat") */
> >
> > I actually dislike that approach immensly ;) The way I have been doin=
g it
> > is basically runtime access to javadocs with two different styles.
> >
> > * Tags with parameters. ie
> >
> > @avalon.service type=3D"Foo" optional=3D"true"
> >
> > * Tags with raw text. ie
> >
> > @description Here is a description of the gratest song in the world.
>
> how should this work within a generic implementing of attributes as
> serialized objects ?

It doesn't. Oririginally when I started experimenting with this stuff I u=
sed=20
serialized objects but the problem was that to load the objects the .clas=
s=20
file for the attribute had to be present and resolvable which could be a=20
problem in some of the more complicated classloader setups.=20

In the end I decided that implementing of attributes as generic serialize=
d=20
objects was not worth the hassle. I also find that data-based specs tend =
to=20
be more resistent to change.=20

We could still support serialized objects and just interpret a string=20
attribute that had something like=20

org.apache.avalon.MyAttribute( x=3D"value" )

But I am not sure what we would really gain. I would much rather use=20
data-based attributes and have a schema to validate them against.

> > This is the same approach xdoclet uses and it seems to work well!
>
> I have used xdoclet only in the context of castor once - so I don't kno=
w
> enough about it.
> But I was reading they are doing a complete rewrite for version 2.0 ...

Yep. They have been going to do the rewrite for a year or more ;) It look=
s=20
like they will use qdox which rocks. It also looks like they will be usin=
g a=20
model like I described above.=20

They had plans for a XRAI (Runtime attribute retrieval) but I don't know =
if=20
they ever got started. I also don't know if they have any plans for schem=
a=20
language.

--=20
Cheers,

Peter Donald
*----------------------------------------------------*
|    "the mother of idiots is always pregnant."      |
*----------------------------------------------------*