In my current project I had to create a simplistic ORM style generator (was
unable to use Hibernate or Torque for reasons I won't even get into...)
using annotations.  When the application starts up, it loads the jars it's
going to use for plugin functionality and introspects them.  Classes marked
with specific annotations are processed accordingly.  It's easy to do and
although it sounds as though it involves tons of processing (and obviously
for large numbers of jars, it can), it all takes place at startup and the
results are cached.

But since the classloaders are kept separate, specific questions can by
asked of any class in that classloader without worrying about hitting those
of the application itself.

Cheers.

On 4/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

 I've never tried something like "give me all classes annotated with X",
but I think it's possible.
For example the launcher of the Test-NG eclipse plugin does a good job in
offering you all classes annotated with @Test

 ------------------------------
*From:* Paul Cooley [mailto:[EMAIL PROTECTED]
*Sent:* Tuesday, April 10, 2007 4:04 PM
*To:* [email protected]
*Subject:* Re: HiveMind Site

Johan:
Perhaps I've misunderstood the issue.  However, let me blindly proceed in
ignorance.  :)

Regardless of when classes are loaded (hivemind runtime or for hivedoc),
each class can be introspected to determine its annotations, provided they
are marked as Runtime.  If the annotations are documentation only, then yes,
it obviously gets more difficult and a real parser will have to be used, but
this also means the source code will have to be available for all elements
to be hivedoc'd.  I assume that since the annotations are going to be used
in building the registry ( HM2.0??), that all these annotations will have
runtime marking.

Again, I hope I haven't misunderstood the issue.  And if I have, my
apologies.

Cheers.

On 4/10/07, Johan Lindquist <[EMAIL PROTECTED]> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Paul,
>
> But that is if you know the class already right?
>
> When you load the Hivemind registry using XML, it will do a
> getResources("META-INF/hivemodule.xml") on the class loader and
> processes a list of hivemodules.  Now, if you can do the same with
> annotations, then we are in the clear.
>
> Cheers,
>
> Johan
>
> Paul Cooley wrote:
> > Johan:
> > Discovering Annotations at runtime is fairly straightforward.  There
> are
> > some tricks, however, when you begin going across ClassLoaders (which
> I
> > assume is going to happen in this case since jars are being loaded at
> > runtime).  In these instances, it may be necessary to compare
> > annotations by name rather than Class, since they may not match (due
> to
> > different ClassLoaders).
> >
> > Cheers.
> >
> > On 4/10/07, *Johan Lindquist* < [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > Hi Marcus,
> >
> > Yes, I can admit the same for the verifier just now - but as you say,
> > the code is short ...
> >
> > As for parsing the code (and maybe Achim has some thoughts on this) to
> > create a registry - sounds like a good plan.  I guess it can be
> written
> > to raise events which the plugins can act on (similar to module
> loading
> > now i belive??).
> >
> > However, both plugins depend on runtime discovery of modules - and as
> I
> > understand it, this is something which is currently not supported by
> > 2.0?  Do I understand things correctly when I say that supporting such
>
> > discovery is currently not possible with JDK 1.5 and annotations?  I.e
> .
> > it is very hard (if not impossible) to "discover" classes which have
> > annotations on them?  Is the plan to solve this by creating a sort of
> > hybrid solution which uses both XML and annotations?
> >
> > Not sure if I am completely off the mark here :)
> >
> > Johan
> >
> > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote:
> >> Hi Johan,
> >
> >> I think, I used the Apache License - so no problem here.
> >
> >> However, I have to blushingly admit, that the hivedoc plugin is
> > quite a quick hack. So don't expect any clean abstraction from the
> > xml-Registry-Definition.
> >> On the positive side, the code is short and straightforward, so it
> > shouldn't be really difficult to pull apart the xml-parsing and the
> > output-generation.
> >> Unfortunately, I've not yet had the time to look into the new API.
> > Basically, one probably needs to search the source-files for
> > HiveMind-2.0 annotations.
> >> This annotation-parsing thing should be common for validator and
> > hivedoc mojos. The simplest thing might be to generate the good old
> > xml-registry as a temporary file from the annotations and use it as
> > input for both tools.
> >
> >> Marcus
> >
> >>> -----Original Message-----
> >>> From: Johan Lindquist [mailto:[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>]
> >>> Sent: Tuesday, April 10, 2007 9:04 AM
> >>> To: [email protected] <mailto:[email protected] >
> >>> Subject: Re: HiveMind Site
> >>>
> >> Hi,
> >
> >> For the verifier mojo, there are no issues - not sure about
> >> the HiveDoc one - Marcus?
> >
> >> And yes, HiveMind 2.0 integration should be considered.
> >> verifier should definately be possibly to re-use for XML
> >> descriptors but it needs to be retrofitted to handle
> >> annotated registries.  For HiveDoc, I would assume the same
> >> thing applies?
> >
> >> Johan
> >
> >> Achim Hügen wrote:
> >>>>> It would be great to add that plugin to the hivemind subversion
> >>>>> repository as an additional module.
> >>>>> Does any licensing issues or copyright speak against it?
> >>>>>
> >>>>> BTW, we will have to check how such plugins can be
> >> integrated with the
> >>>>> HiveMind 2 registry definition API.
> >>>>>
> >>>>> Achim
> >>>>>
> >>>>> Am Thu, 05 Apr 2007 10:09:17 +0200 schrieb Johan Lindquist
> >>>>> < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> Ok, I will take a look - and file the JIRA.
> >>>>>
> >>>>> About the plugin - basically there are two mojos that were
> >> mentioned
> >>>>> on the list - a hivedoc report plugin (written by Marcus
> >> Schulte) and
> >>>>> a hivemodule.xml verifier plugin (started by myself).  The
> thoughts
> >>>>> were to create one single hivemind plugin with these two
> >> sub-goals (if
> >>>>> that is the correct wording).  Then of course, any other sub-goals
>
> >>>>> that come along would slot in quite nicely as well.  Makes sense?
> >>>>>
> >>>>> Cheers,
> >>>>>
> >>>>> Johan
> >>>>>
> >>>>> Achim Hügen wrote:
> >>>>>>>> Your changes are very welcome.
> >>>>>>>> Please use JIRA for submitting the patches.
> >>>>>>>> Maybe the IE bug has already been fixed on the tapestry
> >> site where
> >>>>>>>> I copied the styles from.
> >>>>>>>>
> >>>>>>>> Could you give me a short update on the plugin subject?
> >>>>>>>> Did you create the plugins or who is the owner?
> >>>>>>>>
> >>>>>>>> Achim
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Am Tue, 03 Apr 2007 09:42:24 +0200 schrieb Johan Lindquist
> >>>>>>>> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
> >>>>>>>>
> >>>>>>>> Hi Achim,
> >>>>>>>>
> >>>>>>>> I think misunderstood the problem with the pom - thought it was
> >>>>>>>> related to the "root" source repository location as indicated
> by
> >>>>>>>> the project info on the homepage.  Apologies for my
> >> hasty conclusions.
> >>>>>>>> In any case, I think we all agree that the site should
> >> be updated
> >>>>>>>> and I understand fully if time prevents this .  And as far as
> >>>>>>>> committers go, I guess James is only one still active?
> >>>>>>>>
> >>>>>>>> On a different note - looks like the site doesn't work entirely
> >>>>>>>> correct on IE (at least for me, the left nav is not
> >> visible in IE -
> >>>>>>>> firefox works fine) - do you mind if I make one or two
> >> changes to
> >>>>>>>> the hivemind site project to correct this?  Would you
> >> want another
> >>>>>>>> JIRA for this to keep track?
> >>>>>>>>
> >>>>>>>> And lastly, was also hoping to incorpororate the Maven Hivemind
> >>>>>>>> plugins previously mentioned - module verification and
> >> hivedoc.  Thoughts?
> >>>>>>>> Cheers,
> >>>>>>>>
> >>>>>>>> Johan
> >>>>>>>>
> >>>>>>>> Achim Hügen wrote:
> >>>>>>>>>>> Johan, the bug refered to the HiveMind 2 poms and I fixed
> > it.
> >>>>>>>>>>> Nevertheless it would be nice if someone could apply
> >> the patches
> >>>>>>>>>>> to the 1.2 site and release it.
> >>>>>>>>>>> Unfortunately my time is limited and I focus on
> >> version 2.0 in
> >>>>>>>>>>> the moment.
> >>>>>>>>>>>
> >>>>>>>>>>> Anybody else?
> >>>>>>>>>>>
> >>>>>>>>>>> Achim
> >>>>>>>>>>>
> >>>>>>>>>>> Am Mon, 02 Apr 2007 09:17:01 +0200 schrieb Johan Lindquist
> >>>>>>>>>>> < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
> >>>>>>>>>>>
> >>>>>>>>>>> Hi All,
> >>>>>>>>>>>
> >>>>>>>>>>> Over the weekend there was a JIRA opened for the SVN
> > links on
> >>>>>>>>>>> the HiveMind site.  Looks like the current project info (as
> >>>>>>>>>>> generated by
> >>>>>>>>>>> Maven) uses the site scm URL (someone correct me if I
> >> am wrong)?
> >>>>>>>>>>> Now, to make sure that users don't get confused can I
> >> suggest we
> >>>>>>>>>>> try to get the updated site up for Hivemind?  The
> >> patch already
> >>>>>>>>>>> supplied will provide the new look and feel and other
> updates
> >>>>>>>>>>> that the maven build brings.  The 2.0 site should of course
> >>>>>>>>>>> still be there but I guess it
> >>>>>>>>>>> depends somewhat on how complete the documentation is
> >> - Achim?   If
> >>>>>>>>>>> there is some work required to complete it, anything someone
> >>>>>>>>>>> else can pick up?
> >>>>>>>>>>>
> >>>>>>>>>>> In any case, we should try to clean up the site and make
> sure
> >>>>>>>>>>> links (such as the SCM) works correctly.
> >>>>>>>>>>>
> >>>>>>>>>>> Only my two cents worth, but we don't want to confuse
> >> the users
> >>>>>>>>>>> further by having the (so far very good) documentation fall
> >>>>>>>>>>> apart on us.
> >>>>>>>>>>>
> >>>>>>>>>>> Thoughts?
> >>>>>>>>>>>
> >>>>>>>>>>> Cheers,
> >>>>>>>>>>>
> >>>>>>>>>>> Johan
> >>>>>>>>>>>
> >>>
> >
>
> > --
> > Gotta find my destiny, before it gets too late.-- Ian Curtis
>
> - --
> you too?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGG5HU1Tv8wj7aQ34RAlL8AJ9otA3LXDoFbqyubVFhCgvJLExdowCfUtRk
> SskpfAklKHcdI5m7Wfh7bLI=
> =LbBH
> -----END PGP SIGNATURE-----
>



--
Gotta find my destiny, before it gets too late.-- Ian Curtis




--
Gotta find my destiny, before it gets too late.-- Ian Curtis

Reply via email to