org.apache.avalon.fortress.impl.role
Class ServiceMetaManager

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.fortress.impl.role.AbstractMetaInfoManager
          extended byorg.apache.avalon.fortress.impl.role.ServiceMetaManager
All Implemented Interfaces:
Initializable, LogEnabled, MetaInfoManager

public final class ServiceMetaManager
extends AbstractMetaInfoManager
implements Initializable

ServiceMetaManager follows some simple rules to dynamically gather all services and the meta-information into one role manager. This really gets rid of the need of multiple role managers. It uses a set of entries in your JARs to do its magic.

/services.list

This lists all the services that are defined in this jar.

/META-INF/services/my.class.Name

One entry for each service where there are implementations for a role. This follows the JAR services mechanism.

/my/class/Implementation.meta

There is one entry sitting right beside every implementation class. This holds all the meta information for the associated class. It is a simple properties file.

ANT Tasks available

We have a couple of ANT tasks to make this really easy. If you add this to your ANT build script (customizing it to make it work in your environment), it will make your life alot easier:

   <taskdef name="collect-metainfo" classname="org.apache.avalon.fortress.tools.ComponentMetaInfoCollector">
     <classpath>
       <path refid="project.class.path"/>
       <pathelement path="${tools.dir}/guiapp-tools.jar"/>
     </classpath>
   </taskdef>

   <collect-metainfo destdir="${build.classes}">
      <fileset dir="${src.dir}"/>
   </collect-metainfo>
 

Version:
CVS $Revision: 1.12 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.fortress.MetaInfoManager
ROLE
 
Constructor Summary
ServiceMetaManager()
          Create a ServiceMetaManager.
ServiceMetaManager(MetaInfoManager parent)
          Create a ServiceMetaManager with a parent RoleManager.
ServiceMetaManager(MetaInfoManager parent, java.lang.ClassLoader loader)
          Create a ServiceMetaManager with the supplied classloader and parent RoleManager.
ServiceMetaManager(RoleManager parent)
          Create a ServiceMetaManager with a parent RoleManager.
 
Method Summary
 void initialize()
          Initialize the ServiceMetaManager by looking at all the services and classes available in the system.
 
Methods inherited from class org.apache.avalon.fortress.impl.role.AbstractMetaInfoManager
addComponent, getLoader, getMetaInfoForClassname, getMetaInfoForShortName, isAlreadyAdded
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceMetaManager

public ServiceMetaManager()
Create a ServiceMetaManager.


ServiceMetaManager

public ServiceMetaManager(RoleManager parent)
Create a ServiceMetaManager with a parent RoleManager.

Parameters:
parent -

ServiceMetaManager

public ServiceMetaManager(MetaInfoManager parent)
Create a ServiceMetaManager with a parent RoleManager.

Parameters:
parent -

ServiceMetaManager

public ServiceMetaManager(MetaInfoManager parent,
                          java.lang.ClassLoader loader)
Create a ServiceMetaManager with the supplied classloader and parent RoleManager.

Parameters:
parent -
loader -
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Initialize the ServiceMetaManager by looking at all the services and classes available in the system.

Specified by:
initialize in interface Initializable
Throws:
java.lang.Exception - if there is a problem


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.