Hello Nicola.

Stephen may have some other points to add, but I wanted to chime in. :)

Quoting Nicola Ken Barozzi <[EMAIL PROTECTED]>:
> 
> >        - automated factory and criteria management (maybe)
> 
> please expand on this

The Avalon-Repository project provides an API for not only loading repository
artifacts and creating a classloader, but also a Factory API for easily building
an object/application from the loaded resources.  I'm not sure how familiar you
are with the details, but it's actually pretty simple:

avalon-repository specifies a ".meta" file that sits along side a regular
artifact (jar file).  The meta-file specifies a few things, perhaps most
importantly is the list of other resources required for building the
classloader.  An example is at:

http://www.ibiblio.org/maven/avalon-logging/jars/avalon-logkit-impl-1.0-SNAPSHOT.jar.meta

Notice this line:

avalon.artifact.factory = org.apache.avalon.logging.logkit.DefaultLoggingFactory

This DefaultLoggingFactory implements a Factory interface defined by the
avalon-repository API, and allows a user to load the Logging resource by doing
something like:

   File cache = new File( "local-repository" );
   InitialContext context = new DefaultInitialContext( cache );

   String spec =
     "artifact:avalon-logging/avalon-logkit?version=1.0-SNAPSHOT"
   Artifact artifact =
     Artifact.createArtifact( spec );

   Builder builder = m_context.newBuilder( artifact );
   Factory factory = builder.getFactory();
   Map criteria = factory.createDefaultCriteria();

   String key = "avalon.logging.configuration";
   File file = new File( "logging.xml" );
   criteria.put( key, file );

   LoggingManager manager = 
     (LoggingManager) factory.create( criteria );

The criteria is just a java.util.Map that allows repository clients to pass
parameters to the factory.

So avalon-repository not only loads the artifacts, but it also allows for object
initialization using the Factory pattern.  I don't know if you knew all of this
already, but perhaps it gives the rest of the depot/repository crew a better
understanding of our project.


> >> I think it's time to merge efforts :-)
> > 
> > Yep.

+1

---
  jaaron      <http://jadetower.org>

Reply via email to