avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/fortress/src/ng/org/apache/excalibur/fortress/util AssemblyMap.java StaticAssemblyMap.java
Date Fri, 08 Nov 2002 06:06:12 GMT
donaldp     2002/11/07 22:06:12

  Modified:    fortress build.xml
               fortress/src/java/org/apache/excalibur/fortress/lookup
                        FortressServiceManager.java
  Added:       fortress/src/ng/org/apache/excalibur/fortress Kernel.java
               fortress/src/ng/org/apache/excalibur/fortress/container
                        MetaDataContainer.java
               fortress/src/ng/org/apache/excalibur/fortress/container/commands
                        CheckTypeInfoCommand.java
                        CommandFinishedListener.java
               fortress/src/ng/org/apache/excalibur/fortress/util
                        AssemblyMap.java StaticAssemblyMap.java
  Removed:     fortress/src/java/org/apache/excalibur/fortress/container
                        MetaDataContainer.java
               fortress/src/java/org/apache/excalibur/fortress/container/commands
                        CheckTypeInfoCommand.java
                        CommandFinishedListener.java
               fortress/src/java/org/apache/excalibur/fortress/util
                        AssemblyMap.java StaticAssemblyMap.java
  Log:
  Move Kernel and Meta stuff into ng directory in preparation for a release.
  
  Revision  Changes    Path
  1.56      +12 -1     jakarta-avalon-excalibur/fortress/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/build.xml,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- build.xml	3 Oct 2002 03:36:06 -0000	1.55
  +++ build.xml	8 Nov 2002 06:06:12 -0000	1.56
  @@ -94,7 +94,6 @@
             <attribute name="Specification-Version" value="1.0"/>
             <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
             <attribute name="Implementation-Version" value="${package-version}"/>
  -          <attribute name="Main-Class" value="org.apache.excalibur.merlin.Main"/>
           </manifest>
           <zipgroupfileset dir="${build.dir}/tempjars">
             <include name="*.jar"/>
  @@ -175,6 +174,18 @@
               <exclude name="**/*Type*.java" unless="include.meta"/>
               <exclude name="**/*Meta*.java" unless="include.meta"/>
               <exclude name="**/*Assembly*.java" unless="include.meta"/>
  +        </javac>
  +
  +        <javac srcdir="src/ng"
  +            destdir="${build.classes}"
  +            debug="${build.debug}"
  +            optimize="${build.optimize}"
  +            deprecation="${build.deprecation}"
  +            target="1.2">
  +            <classpath refid="build.path"/>
  +            <include name="**/*.java"/>
  +            <exclude name="**/util/**/*.java" unless="include.meta"/>
  +            <exclude name="**/container/**/*.java" unless="include.meta"/>
           </javac>
   
           <!-- copy resources to same location as .class files -->
  
  
  
  1.21      +12 -13    jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java
  
  Index: FortressServiceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- FortressServiceManager.java	8 Nov 2002 02:20:43 -0000	1.20
  +++ FortressServiceManager.java	8 Nov 2002 06:06:12 -0000	1.21
  @@ -94,34 +94,33 @@
           m_used = new StaticBucketMap();
       }
   
  -    protected Object obtainService( String role )
  +    protected Object obtainService( final String key )
           throws ServiceException
       {
  -        if( !m_container.has( role, null ) )
  +        if( !m_container.has( key, null ) )
           {
               return null;
           }
   
  -        Object temp = m_container.get( role, null );
  -
  -        if( temp instanceof ServiceSelector )
  +        final Object result = m_container.get( key, null );
  +        if( result instanceof ServiceSelector )
           {
  -            return temp;
  +            return result;
           }
   
  -        if( temp instanceof ComponentSelector )
  +        if( result instanceof ComponentSelector )
           {
  -            return new WrapperServiceSelector( role, (ComponentSelector)temp );
  +            return new WrapperServiceSelector( key, (ComponentSelector)result );
           }
   
  -        if( !( temp instanceof ComponentHandler ) )
  +        if( !( result instanceof ComponentHandler ) )
           {
  -            throw new ServiceException( role, "Invalid entry in component manager" );
  +            throw new ServiceException( key, "Invalid entry in component manager" );
           }
   
           try
           {
  -            final ComponentHandler handler = (ComponentHandler)temp;
  +            final ComponentHandler handler = (ComponentHandler)result;
               if( !handler.isInitialized() )
               {
                   ContainerUtil.initialize( handler );
  @@ -137,7 +136,7 @@
           }
           catch( final Exception e )
           {
  -            throw new ServiceException( role, "Could not return a reference to the Component", e );
  +            throw new ServiceException( key, "Could not return a reference to the Component", e );
           }
       }
   
  
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/ng/org/apache/excalibur/fortress/Kernel.java
  
  Index: Kernel.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
      must not be used to endorse or promote products derived from this  software
      without  prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.excalibur.fortress;
  
  import java.util.Iterator;
  import java.util.Map;
  import org.apache.avalon.excalibur.logger.LoggerManager;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
  import org.apache.avalon.framework.container.ContainerUtil;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.DefaultContext;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.logger.NullLogger;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.service.DefaultServiceManager;
  import org.apache.commons.collections.StaticBucketMap;
  import org.apache.excalibur.event.command.CommandManager;
  import org.apache.excalibur.event.command.TPCThreadManager;
  import org.apache.excalibur.event.command.ThreadManager;
  import org.apache.excalibur.instrument.InstrumentManager;
  import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
  import org.apache.excalibur.mpool.DefaultPoolManager;
  import org.apache.excalibur.mpool.PoolManager;
  
  /**
   * The Kernel sets up the Fortress containers and core services that are
   * shared between the containers.  It is very easy to set up and use, and
   * its settings are all derived from a configuration file.  Here is a
   * typical usage:
   *
   * <pre>
   *   public class Main
   *   {
   *      public static int main( String[] )
   *      {
   *          Kernel kernel = new Kernel();
   *          kernel.initialize();
   *
   *          // do whatever in the main loop.
   *          MyRootContainer container = (MyRootContainer) kernel.getRootContainer();
   *          container.doStuff();
   *
   *          // When we are done we dispose of everything.
   *          kernel.dispose();
   *      }
   *   }
   * </pre>
   *
   * <p>
   *   The configuration location will be set up in specific locations in a
   *   Context object.
   * </p>
   *
   * @author <a href="bloritsch@apache.org">Berin Loritsch</a>
   * @version CVS $Revision: 1.1 $ $Date: 2002/11/08 06:06:12 $
   */
  public final class Kernel implements Disposable, Initializable
  {
      // Only used on startup--need to make them unnecessary.
      private Configuration m_kernelConfig;
  
      private Map m_rootContainers;
      private TPCThreadManager m_threadManager;
      private CommandManager m_commandManager;
      private PoolManager m_poolManager;
      private LoggerManager m_loggerManager;
      private InstrumentManager m_instrumentManager;
      private Context m_rootContext;
      private DefaultServiceManager m_serviceManager;
  
      /**
       * Initialize the kernel with the default location for the kernel.xconf
       * file.  The default location and name for the "kernel.xconf" file is
       * <code>"../conf/kernel.xconf"</code>.  This constructor also suppresses
       * any and all debug information that may occur before the
       * {@link LoggerManager} is set up.
       */
      public Kernel()
          throws Exception
      {
          this( "../conf/kernel.xconf" );
      }
  
      /**
       * Initialize the kernel with the supplied location of the kernel.xconf
       * file.  If the supplied location is a JAR file, then the Kernel will
       * look inside the JAR with the following path:
       * <code>"META-INF/fortress/kernel.xconf"</code>.  This constructor also
       * suppresses any and all debug information that may occur before the
       * {@link LoggerManager} is set up.
       */
      public Kernel( String configURI )
          throws Exception
      {
          this( configURI, new NullLogger() );
      }
  
      /**
       * Initialize the kernel with the supplied location of the kernel.xconf
       * file.  If the supplied location is a JAR file, then the Kernel will
       * look inside the JAR with the following path:
       * <code>"META-INF/fortress/kernel.xconf"</code>.  This constructor also
       * allows you to pass in a Logger object so that you can see what is
       * happening while the Kernel is going through its initialization stages.
       */
      public Kernel( String configURI, Logger logger )
          throws Exception
      {
          if( null == logger )
              throw new IllegalArgumentException( "You must pass in a logger for " +
                                                  getClass().getName() + "'s constructor" );
          if( null == configURI )
              throw new IllegalArgumentException( "You must pass in a configuration URI for " +
                                                  getClass().getName() + "'s constructor" );
          m_rootContainers = new StaticBucketMap( 17 );
          m_rootContext = new DefaultContext();
          m_kernelConfig = loadKernelConfig( logger, configURI );
          m_loggerManager = initializeLoggerManager( logger );
          m_serviceManager = new DefaultServiceManager();
      }
  
      public void initialize()
          throws Exception
      {
          Configuration[] containers = m_kernelConfig.getChildren( "container" );
          if( containers.length == 0 )
              throw new ConfigurationException( "There must be at least one container!" );
  
          m_serviceManager.put( LoggerManager.class.getName(), m_loggerManager );
  
          // Set up the ThreadManager
          Configuration threadManagerConfig = m_kernelConfig.getChild( "thread-manager" );
          m_threadManager = new TPCThreadManager();
          initializeService( m_threadManager, "thread-manager", threadManagerConfig );
          m_serviceManager.put( ThreadManager.class.getName(), m_threadManager );
  
          // Set up the CommandManager and PoolManager
          m_commandManager = new CommandManager();
          m_threadManager.register( m_commandManager );
          m_poolManager = new DefaultPoolManager( m_commandManager.getCommandSink() );
          m_serviceManager.put( CommandManager.class.getName(), m_commandManager );
          m_serviceManager.put( PoolManager.class.getName(), m_poolManager );
  
          m_instrumentManager = new DefaultInstrumentManager();
          initializeService( m_instrumentManager, "instrument-manager", m_kernelConfig );
          m_serviceManager.put( InstrumentManager.class.getName(), m_instrumentManager );
          m_serviceManager.makeReadOnly();
  
          for( int i = 0; i < containers.length; i++ )
          {
              Class klass = getClass().getClassLoader().loadClass( containers[ i ].getAttribute( "class" ) );
              Object container = klass.newInstance();
              initializeService( container, containers[ i ].getAttribute( "name" ), containers[ i ] );
          }
      }
  
      public void dispose()
      {
          disposeService( m_instrumentManager );
  
          Iterator it = m_rootContainers.keySet().iterator();
          while( it.hasNext() )
          {
              disposeService( it.next() );
              it.remove();
          }
  
          disposeService( m_poolManager );
          disposeService( m_commandManager );
          m_threadManager.deregisterAll();
          disposeService( m_threadManager );
      }
  
      /**
       * Get the default root container.  This is the most common case.
       *
       * @return the default container
       */
      public Object getRootContainer()
      {
          return getRootContainer( "default" );
      }
  
      /**
       * Get a named root container.  This only has any real effect if there are
       * more than one root container.
       *
       * @param name  The name of the root container
       * @return the container we want--or <code>null</code> if there is no matching container
       */
      public Object getRootContainer( String name )
      {
          return m_rootContainers.get( name );
      }
  
      private Configuration loadKernelConfig( final Logger initLogger, final String configURI )
          throws ConfigurationException
      {
          Configuration config = null;
          String uri = configURI;
  
          if( configURI.endsWith( ".jar" ) )
          {
              initLogger.debug( "The configuration URI is a jar file, looking inside..." );
              uri = "jar:" + uri + "!/META-INF/fortress/kernel.xconf";
          }
  
          config = loadConfig( initLogger, uri );
  
          return config;
      }
  
      private Configuration loadConfig( Logger initLogger, String configURI )
          throws ConfigurationException
      {
          Configuration config = null;
  
          if( initLogger.isDebugEnabled() )
              initLogger.debug( "Looking for the config here: " + configURI );
  
          try
          {
              DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
              config = builder.build( configURI );
          }
          catch( ConfigurationException ce )
          {
              throw ce;
          }
          catch( Exception e )
          {
              throw new ConfigurationException( "Could not load configuration", e );
          }
  
          if( initLogger.isDebugEnabled() )
              initLogger.debug( "Found and loaded configuration successfully" );
  
          return config;
      }
  
      private Configuration getLoggerManagerConfig( Logger initLogger )
          throws ConfigurationException
      {
          Configuration config = m_kernelConfig.getChild( "logger-manager" );
          String loggerConfigURI = config.getAttribute( "config-uri", "" );
  
          if( loggerConfigURI.equals( "" ) )
          {
              initLogger.debug( "The logger configuration was completely local" );
          }
          else
          {
              initLogger.debug( "The logger configuration is external to the kernel config" );
              config = loadConfig( initLogger, loggerConfigURI );
          }
  
          return config;
      }
  
      private LoggerManager initializeLoggerManager( Logger logger )
          throws Exception
      {
          Configuration config = getLoggerManagerConfig( logger );
          LoggerManager logManager = (LoggerManager)getClass().getClassLoader()
              .loadClass( config.getAttribute( "class" ) ).newInstance();
          initializeService( logManager, logger, config );
          return logManager;
      }
  
      /**
       * Start up a service with all the necessary pieces.
       *
       * @param service  The service to start up
       * @param config   The configuration for the service
       *
       * @throws Exception  when someting goes wrong during startup.
       */
      private void initializeService( Object service, String name, Configuration config )
          throws Exception
      {
          initializeService( service, m_loggerManager.getLoggerForCategory( name ), config );
      }
  
      /**
       * Start up a service with all the necessary pieces.
       *
       * @param service  The service to start up
       * @param logger   The intended Logger
       * @param config   The configuration for the service
       *
       * @throws Exception  when someting goes wrong during startup.
       */
      private void initializeService( Object service, Logger logger, Configuration config )
          throws Exception
      {
          ContainerUtil.enableLogging( service, logger );
          ContainerUtil.contextualize( service, m_rootContext );
          ContainerUtil.service( service, m_serviceManager );
          ContainerUtil.configure( service, config );
          ContainerUtil.parameterize( service, Parameters.fromConfiguration( config ) );
          ContainerUtil.initialize( service );
      }
  
      /**
       * Close down the service.
       *
       * @param service  The service to be disposed of.
       */
      private void disposeService( Object service )
      {
          try
          {
              ContainerUtil.stop( service );
          }
          catch( Exception e )
          {
              m_loggerManager.getDefaultLogger().error( "Can't stop service, will attempt to discontinue anyway", e );
          }
  
          ContainerUtil.dispose( service );
      }
  }
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/ng/org/apache/excalibur/fortress/container/MetaDataContainer.java
  
  Index: MetaDataContainer.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
      must not be used to endorse or promote products derived from this  software
      without  prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.excalibur.fortress.container;
  
  import java.util.HashMap;
  import java.util.Map;
  import org.apache.avalon.excalibur.logger.LoggerManager;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.excalibur.container.classloader.ComponentClassLoader;
  import org.apache.excalibur.container.classloader.JarEntries;
  import org.apache.excalibur.container.classloader.JarScanner;
  import org.apache.excalibur.event.Queue;
  import org.apache.excalibur.event.SinkException;
  import org.apache.excalibur.event.command.Command;
  import org.apache.excalibur.fortress.ContainerConstants;
  import org.apache.excalibur.fortress.ContainerManagerConstants;
  import org.apache.excalibur.fortress.container.commands.CheckTypeInfoCommand;
  import org.apache.excalibur.fortress.container.commands.CommandFinishedListener;
  import org.apache.excalibur.fortress.lifecycle.LifecycleExtensionManager;
  import org.apache.excalibur.instrument.InstrumentManager;
  import org.apache.excalibur.mpool.PoolManager;
  
  /**
   * The MetaDataContainer is the wave of the future.  While the
   * @link{DefaultContainer} provides a way to upgrade your legacy systems to
   * the Fortress containers, Avalon is moving towards Meta Data.  In order to
   * describe which services the MetaDataContainer will instantiate, that
   * information will be placed in an Assembly XML file.  Usually the Assembly
   * file is located within the JAR that holds your application.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   * @version CVS $Revision: 1.1 $ $Date: 2002/11/08 06:06:12 $
   */
  public class MetaDataContainer
      extends AbstractLogEnabled
      implements Configurable, Contextualizable, Initializable, Disposable, Serviceable,
      CommandFinishedListener
  {
      protected final JarEntries m_jarEntries;
      protected Context m_context;
      protected Configuration m_config;
      protected Configuration m_assemblyInfo;
      protected ServiceManager m_parentManager;
      protected ClassLoader m_loader;
      protected LoggerManager m_logManager;
      protected PoolManager m_poolManager;
      protected Queue m_commandQueue;
      protected InstrumentManager m_instrumentManager;
      protected LifecycleExtensionManager m_extManager;
  
      protected final Map m_services;
      protected final Map m_types;
      protected volatile boolean m_typeInfoChecked;
  
      public MetaDataContainer()
      {
          m_jarEntries = JarScanner.getSystemJarEntries();
          m_services = new HashMap();
          m_types = new HashMap();
          m_typeInfoChecked = false;
      }
  
      public void commandCompleted( Command cmd )
      {
          if( cmd instanceof CheckTypeInfoCommand )
          {
              m_typeInfoChecked = true;
          }
      }
  
      /**
       * Pull all the associated helper classes from the Context.
       */
      public void contextualize( Context context ) throws ContextException
      {
          m_context = context;
          m_assemblyInfo = (Configuration)
              context.get( ContainerManagerConstants.ASSEMBLY_CONFIGURATION );
  
          try
          {
              m_loader = (ClassLoader)m_context.get( ContainerConstants.CONTEXT_CLASSLOADER );
          }
          catch( ContextException ce )
          {
              m_loader = Thread.currentThread().getContextClassLoader();
          }
  
          if( m_loader instanceof ComponentClassLoader )
          {
              m_jarEntries.merge( ( (ComponentClassLoader)m_loader ).getEntries() );
          }
  
          m_logManager = (LoggerManager)m_context.get( ContainerConstants.LOGGER_MANAGER );
          m_poolManager = (PoolManager)m_context.get( ContainerConstants.POOL_MANAGER );
  
          try
          {
              m_extManager =
                  (LifecycleExtensionManager)m_context.get( ContainerConstants.EXTENSION_MANAGER );
          }
          catch( ContextException ce )
          {
              m_extManager = new LifecycleExtensionManager();
  
              if( getLogger().isDebugEnabled() )
              {
                  getLogger().debug( "No Container.EXTENSION_MANAGER is given, installing default "
                                     + "lifecycle extension manager with 0 extensions" );
              }
          }
  
          m_extManager.enableLogging( getLogger() );
  
          try
          {
              m_commandQueue = (Queue)m_context.get( ContainerConstants.COMMAND_QUEUE );
  
              m_commandQueue.enqueue( new CheckTypeInfoCommand( m_jarEntries,
                                                                m_services, m_types, m_loader, this,
                                                                getLogger().getChildLogger( "type-checker" ) ) );
          }
          catch( ContextException ce )
          {
              getLogger().warn( "No Container.COMMAND_QUEUE is given, all management will be "
                                + "performed synchronously", ce );
          }
          catch( SinkException se )
          {
              getLogger().error( "The CommandQueue is unable to enqueue the command", se );
          }
  
          m_instrumentManager = (InstrumentManager)m_context.get( ContainerConstants.INSTRUMENT_MANAGER );
      }
  
      public void service( ServiceManager manager ) throws ServiceException
      {
          m_parentManager = manager;
      }
  
      public void configure( Configuration config ) throws ConfigurationException
      {
          m_config = config;
      }
  
      public void initialize() throws Exception
      {
      }
  
      public void dispose()
      {
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/ng/org/apache/excalibur/fortress/container/commands/CheckTypeInfoCommand.java
  
  Index: CheckTypeInfoCommand.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
      must not be used to endorse or promote products derived from this  software
      without  prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.excalibur.fortress.container.commands;
  
  import java.util.Iterator;
  import java.util.Map;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.logger.NullLogger;
  import org.apache.excalibur.container.classloader.JarEntries;
  import org.apache.excalibur.event.command.Command;
  import org.apache.excalibur.meta.info.ServiceDescriptor;
  import org.apache.excalibur.meta.info.StageDescriptor;
  import org.apache.excalibur.meta.info.Type;
  import org.apache.excalibur.meta.info.builder.BlockBuilder;
  import org.apache.excalibur.meta.info.builder.ServiceBuilder;
  import org.apache.excalibur.meta.info.builder.TypeBuilder;
  import org.apache.excalibur.meta.verifier.ComponentVerifier;
  
  /**
   * Execute this command to verify all the entries in a @link{JarEntries} object.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   * @version CVS $Revision: 1.1 $ $Date: 2002/11/08 06:06:12 $
   */
  public final class CheckTypeInfoCommand implements Command
  {
      private final JarEntries m_jarEntries;
      private final Map m_services;
      private final Map m_types;
      private final ClassLoader m_loader;
      private final CommandFinishedListener m_listener;
      private final Logger m_logger;
  
      public CheckTypeInfoCommand( JarEntries entries,
                                   Map services,
                                   Map types,
                                   ClassLoader loader,
                                   CommandFinishedListener listener,
                                   Logger logger )
      {
          if( null == entries ||
              null == services ||
              null == types ||
              null == loader ||
              null == listener )
          {
              throw new NullPointerException( "All arguments must be supplied to the CheckTypeInfoCommand" );
          }
  
          m_jarEntries = entries;
          m_services = services;
          m_types = types;
          m_loader = loader;
          m_listener = listener;
          m_logger = ( null == logger ) ? new NullLogger() : logger;
      }
  
      public void execute()
          throws Exception
      {
          BlockBuilder blockBuilder = new BlockBuilder();
          TypeBuilder typeBuilder = new TypeBuilder();
          ServiceBuilder serviceBuilder = new ServiceBuilder();
          ComponentVerifier verifier = new ComponentVerifier();
  
          blockBuilder.enableLogging( getLogger().getChildLogger( "builder.block" ) );
          typeBuilder.enableLogging( getLogger().getChildLogger( "builder.type" ) );
          serviceBuilder.enableLogging( getLogger().getChildLogger( "builder.service" ) );
          verifier.enableLogging( getLogger().getChildLogger( "verifier" ) );
  
          Iterator it = m_jarEntries.getServiceEntries().iterator();
          while( it.hasNext() )
          {
              String name = (String)it.next();
              try
              {
                  Class service = m_loader.loadClass( name );
                  m_services.put( service, serviceBuilder.build( service ) );
                  verifier.verifyService( service.getName(), service );
              }
              catch( Exception e )
              {
                  getLogger().debug( "Could not read the descriptor for " + name, e );
              }
          }
  
          it = m_jarEntries.getBlockEntries().iterator();
          while( it.hasNext() )
          {
              String name = (String)it.next();
              try
              {
                  Class block = m_loader.loadClass( name );
                  m_types.put( block, blockBuilder.build( block ) );
  
                  Type check = (Type)m_types.get( block );
                  ServiceDescriptor[] serviceDescriptors = check.getServices();
  
                  Class[] services = new Class[ serviceDescriptors.length ];
                  for( int i = 0; i < serviceDescriptors.length; i++ )
                  {
                      services[ i ] = m_loader.loadClass(
                          serviceDescriptors[ i ].getReference().getClassname()
                      );
                  }
  
                  StageDescriptor[] phaseDescriptors = check.getStages();
  
                  Class[] phases = new Class[ phaseDescriptors.length ];
                  for( int i = 0; i < phaseDescriptors.length; i++ )
                  {
                      phases[ i ] = m_loader.loadClass(
                          phaseDescriptors[ i ].getReference().getClassname()
                      );
                  }
  
                  verifier.verifyType( block.getName(), block, services, phases );
              }
              catch( Exception e )
              {
                  getLogger().debug( "Could not read the descriptor for " + name, e );
              }
          }
  
          it = m_jarEntries.getTypeEntries().iterator();
          while( it.hasNext() )
          {
              String name = (String)it.next();
              try
              {
                  Class type = m_loader.loadClass( name );
                  m_types.put( type, typeBuilder.build( type ) );
  
                  Type check = (Type)m_types.get( type );
                  ServiceDescriptor[] serviceDescriptors = check.getServices();
  
                  Class[] services = new Class[ serviceDescriptors.length ];
                  for( int i = 0; i < serviceDescriptors.length; i++ )
                  {
                      services[ i ] = m_loader.loadClass(
                          serviceDescriptors[ i ].getReference().getClassname()
                      );
                  }
  
                  StageDescriptor[] phaseDescriptors = check.getStages();
  
                  Class[] phases = new Class[ phaseDescriptors.length ];
                  for( int i = 0; i < phaseDescriptors.length; i++ )
                  {
                      phases[ i ] = m_loader.loadClass(
                          phaseDescriptors[ i ].getReference().getClassname()
                      );
                  }
  
                  verifier.verifyType( type.getName(), type, services, phases );
              }
              catch( Exception e )
              {
                  getLogger().debug( "Could not read the descriptor for " + name, e );
              }
          }
  
          m_listener.commandCompleted( this );
      }
  
      private final Logger getLogger()
      {
          return m_logger;
      }
  }
  
  
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/ng/org/apache/excalibur/fortress/container/commands/CommandFinishedListener.java
  
  Index: CommandFinishedListener.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
      must not be used to endorse or promote products derived from this  software
      without  prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.excalibur.fortress.container.commands;
  
  import org.apache.excalibur.event.command.Command;
  
  /**
   * Implement this interface so that a Command object can let the listener know
   * when it has been completed.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   * @version CVS $Revision: 1.1 $ $Date: 2002/11/08 06:06:12 $
   */
  public interface CommandFinishedListener
  {
      void commandCompleted( Command arg );
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/ng/org/apache/excalibur/fortress/util/AssemblyMap.java
  
  Index: AssemblyMap.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
      must not be used to endorse or promote products derived from this  software
      without  prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.excalibur.fortress.util;
  
  import org.apache.excalibur.meta.info.DependencyDescriptor;
  import org.apache.excalibur.meta.info.Type;
  
  /**
   * The AssemblyMap takes care of the mapping logic for the assembly files.  The
   * assembly file format is the same for all AssemblyMaps to allow for a system
   * to upgrade from static mapping (where all mappings *must* be provided) to
   * dynmic mapping (where a mapping will be generated if it does not exist).
   */
  public interface AssemblyMap
  {
      /**
       * Get the name that this particular Type is bound to for a configuration
       * file.  It assists in "self-healing" configuration files.
       */
      String getNameForType( Type component );
  
      /**
       * Get the Type boud to a particular name for a configuration file.  It
       * assists in "self-healing" configuration files.
       */
      Type getTypeForName( String name );
  
      /**
       * Get the Type that is mapped to a particular DependencyDescriptor for a
       * particular Type.  It helps the AssemblyMap return the proper Type
       * reference for the dependency since different components may have different
       * mappings.
       */
      Type getMappedType( DependencyDescriptor dependency, Type forType );
  
      /**
       * Get the Type that is mapped to a particular DependencyDescriptor.
       */
      Type getMappedType( DependencyDescriptor dependency );
  
      /**
       * Get the array of DependencyDescriptors that are required to make a system
       * work.  They are made to evaluate the system once the components are loaded.
       * If any of the required services are not loaded, we can use the
       * DependencyDescriptor to find the best solution.
       */
      DependencyDescriptor[] getRequiredServices();
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/ng/org/apache/excalibur/fortress/util/StaticAssemblyMap.java
  
  Index: StaticAssemblyMap.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
      must not be used to endorse or promote products derived from this  software
      without  prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.excalibur.fortress.util;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Properties;
  import org.apache.avalon.framework.Version;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.excalibur.meta.info.DependencyDescriptor;
  import org.apache.excalibur.meta.info.ReferenceDescriptor;
  import org.apache.excalibur.meta.info.ServiceDescriptor;
  import org.apache.excalibur.meta.info.Type;
  
  /**
   * The AssemblyMap takes care of the mapping logic for the assembly files.  The
   * assembly file format is the same for all AssemblyMaps to allow for a system
   * to upgrade from static mapping (where all mappings *must* be provided) to
   * dynmic mapping (where a mapping will be generated if it does not exist).
   */
  public class StaticAssemblyMap
      extends AbstractLogEnabled
      implements AssemblyMap, Configurable, Contextualizable
  {
      private Map m_types;
      private Map m_services;
      private final Map m_serviceMap;
      private final Map m_typeMap;
      private final Map m_nameMap;
      private final List m_requiredServices;
  
      public StaticAssemblyMap()
      {
          m_serviceMap = new HashMap();
          m_typeMap = new HashMap();
          m_nameMap = new HashMap();
          m_requiredServices = new ArrayList();
      }
  
      public void contextualize( Context context )
          throws ContextException
      {
          m_services = (Map)context.get( "available-services" );
          m_types = (Map)context.get( "available-types" );
  
          Iterator it = m_services.values().iterator();
          while( it.hasNext() )
          {
              m_serviceMap.put( it.next(), new ArrayList() );
          }
  
          it = m_types.values().iterator();
          while( it.hasNext() )
          {
              Type type = (Type)it.next();
              ServiceDescriptor[] serviceDescriptors = type.getServices();
  
              for( int i = 0; i < serviceDescriptors.length; i++ )
              {
                  List typeList = (List)m_serviceMap.get( serviceDescriptors[ i ].getReference() );
  // DEBUG
                  System.out.println( typeList );
                  typeList.add( type );
              }
          }
      }
  
      public void configure( Configuration config )
          throws ConfigurationException
      {
          Configuration[] components = config.getChildren( "component" );
          Configuration[] requiredServices = config.getChildren( "required-service" );
  
          for( int i = 0; i < components.length; i++ )
          {
              String name = components[ i ].getAttribute( "name" );
              String klass = components[ i ].getAttribute( "class" );
              m_nameMap.put( name, klass );
              m_nameMap.put( klass, name );
  
              Type type = (Type)m_types.get( klass ); // I need to make it a Class
  
              Configuration[] supplied = components[ i ].getChildren( "supply" );
              List typeList = new ArrayList( supplied.length );
              m_typeMap.put( type, typeList );
  
              for( int s = 0; s < supplied.length; s++ )
              {
                  typeList.add( supplied[ s ].getAttribute( "name" ) );
              }
          }
  
          for( int i = 0; i < requiredServices.length; i++ )
          {
              Configuration serviceConfig = requiredServices[ i ].getChild( "service" );
              String className = serviceConfig.getAttribute( "name" );
              Version version = Version
                  .getVersion( serviceConfig.getAttribute( "version" ) );
  
              Properties attributes = new Properties();
              Configuration[] attrs = requiredServices[ i ].getChild( "attributes" )
                  .getChildren( "attribute" );
  
              for( int at = 0; at < attrs.length; at++ )
              {
                  attributes.setProperty( attrs[ at ].getAttribute( "name" ),
                                          attrs[ at ].getAttribute( "value" )
                  );
              }
  
              ReferenceDescriptor service = new ReferenceDescriptor( className, version );
              String role = service.getClassname();
              DependencyDescriptor descriptor = new DependencyDescriptor(
                  role, service, false, attributes
              );
  
              m_requiredServices.add( descriptor );
          }
      }
  
      /**
       * Get the name that this particular Type is bound to for a configuration
       * file.  It assists in "self-healing" configuration files.
       */
      public String getNameForType( Type component )
      {
          return (String)m_nameMap.get( component.getInfo().getImplementationKey() );
      }
  
      /**
       * Get the Type boud to a particular name for a configuration file.  It
       * assists in "self-healing" configuration files.
       */
      public Type getTypeForName( String name )
      {
          throw new UnsupportedOperationException();
      }
  
      /**
       * Get the Type that is mapped to a particular DependencyDescriptor for a
       * particular Type.  It helps the AssemblyMap return the proper Type
       * reference for the dependency since different components may have different
       * mappings.
       */
      public Type getMappedType( DependencyDescriptor dependency, Type forType )
      {
          throw new UnsupportedOperationException();
      }
  
      /**
       * Get the Type that is mapped to a particular DependencyDescriptor.
       */
      public Type getMappedType( DependencyDescriptor dependency )
      {
          throw new UnsupportedOperationException();
      }
  
      /**
       * Get the array of DependencyDescriptors that are required to make a system
       * work.  They are made to evaluate the system once the components are loaded.
       * If any of the required services are not loaded, we can use the
       * DependencyDescriptor to find the best solution.
       */
      public DependencyDescriptor[] getRequiredServices()
      {
          throw new UnsupportedOperationException();
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message