geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@gmail.com>
Subject AnnotationFinder 2.0
Date Tue, 22 Mar 2011 20:51:52 GMT
Some long needed changes/improvements to the finder API.

  XBEAN-165: Meta Annotation Support
  
  XBEAN-166 : Class Name Filtering for Optimized Scanning
   XBEAN-171: RegexFilteredArchive supporting regular expressions to include/exclude classes
from scanning
   XBEAN-172: PrefixFilteredArchive supports "startsWith" list of accepted prefixes
   XBEAN-173: PackageFilteredArchive supports strict list of accepted package names
  
  XBEAN-167:  Archive Interface for cleaner integration of Classpath and OSGi based systems
   XBEAN-168: ClassesArchive for static class list finder support
   XBEAN-169: ClasspathArchive for traditional java classpath finder support
   XBEAN-170: BundleArchive for OSGi bundle finder support

The first, meta annotations, is probably less interesting in Geronimo terms, but the second
two classes of changes are major improvements.

Rather than subclassing I've attempted to abstract out the few parts that are different and
switch us over to a delegation based model.  Once that was done adding wrapping/decorating
of the delegates to achieve filtering was a natural next step.  A bit reason I'm not fan of
subclassing as in that model doing this kind of shared filtering would require all the subclasses
to inherit from this new "filtering" parent which would in turn now subclass from the original
parent.  And that is an oversimplification as you can't really wrap abstract methods like
that -- a filtering parent class can't call "subclass.doThis()" and mutate the result in it's
own "doThis()" method, so you end up with more abstract methods.  Delegation is also composable,
whereas you can't dynamically change your parent class to use or not use the common filtering
parent class.

Anyway enough about that :)

So what we have now is a composable system.  You create your finder and feed it an archive,
like so:

  new AnnotationFinder(  new BundleArchive() );

If you want some filtering, you add that in:

  new AnnotationFinder(  new PackageFilteredArchive( new BundleArchive(), "org.foo" ) );

And if some day we decide we want to support some sort of mashing of OSGi and traditional
sources, we could create an Archive implementation to combine them, like so:

  new AnnotationFinder(
     new PackageFilteredArchive(
         new CompositeArchive( 
                new BundleArchive(),
                new ClasspathArchive()
         ),
         "org.foo" 
      ) 
  );

Sky is the limit.

Some concrete things I need help with.

  1)  Finishing the BundleArchive.  I have stub in there based on the subclass version.  But
the subclass "pushed" classes into the finder and the new approach is a "pull".  Anyone who
has any time, please grab XBEAN-170 and assign it to yourself.  It's up for grabs.

  2)  Converting all the code from AbstractFinder to AnnotationFinder.  Once we get #1 finished,
we'll need to roll the code over.  It should be fairly easy as the effective API is the same,
just the way we construct things is different.

Still in the works:

  1)  Tests for all the filters
  2)  An SAXParser style error handler -- the whole classesNotLoaded thing is going bye-bye
  3)  Finishing the ClasspathArchive and Meta Annotation support for fields


-David


Mime
View raw message