mcconnell    2002/12/27 08:42:27

  Modified:    merlin/src/java/org/apache/avalon/merlin/container
                        ContainerLoader.java
  Log:
  Ratiuonalization relative to keneral functionality.
  
  Revision  Changes    Path
  1.8       +5 -130    
avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/ContainerLoader.java
  
  Index: ContainerLoader.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/ContainerLoader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContainerLoader.java      21 Dec 2002 03:30:24 -0000      1.7
  +++ ContainerLoader.java      27 Dec 2002 16:42:27 -0000      1.8
  @@ -102,7 +102,10 @@
   import org.apache.excalibur.configuration.ConfigurationUtil;
   
   /**
  - * An abstract utility class that provides support for  
  + * An abstract utility class that provides support for the creation of 
subsidiary
  + * component management engines and utilities for he creation of component 
profiles
  + * (used with container descriptor creation).
  + *
    * @author <a href="mailto:avalon-dev@jakarta.apache.org";>Avalon Development 
Team</a>
    * @version $Revision$ $Date$
    */
  @@ -119,133 +122,6 @@
       // ContainerLoader
       //==============================================================
   
  -   /**
  -    * Creation of a new appliance holding a container.
  -    * @param engine the component classloader to assign to the container
  -    * @param name the container name
  -    * @param home the root directory against which the classpath and 
extensions 
  -    *    will be resolved
  -    * @param config the container configuration
  -    * @param logger the logging channel to assign to the container
  -    */
  -    protected Appliance createContainer( 
  -      EngineClassLoader engine, Registry registry, String name, File home, 
Configuration config, Logger logger )
  -      throws Exception
  -    {
  -        return createContainer( engine, registry, name, home, config, 
logger, "/" );
  -    }
  -
  -   /**
  -    * Creation of a new appliance holding a container.
  -    * @param engine the component classloader to assign to the container
  -    * @param name the container name
  -    * @param home the root directory against which the classpath and 
extensions 
  -    *    will be resolved
  -    * @param config the container configuration
  -    * @param logger the logging channel to assign to the container
  -    * @param partition if null, this is a root container of a block in which 
case 
  -    *   the block's engine, logging channel, and name are applied to the 
container
  -    */
  -    protected Appliance createContainer( 
  -      EngineClassLoader engine, Registry registry, String name, File home, 
Configuration config, Logger logger, String partition )
  -      throws Exception
  -    {
  -        String classname = config.getAttribute( "class", 
DefaultContainer.class.getName() );
  -        Type type = engine.getRepository().getTypeManager().getType( 
classname );
  -        ContainerDescriptor descriptor = CREATOR.createContainerDescriptor( 
type, config, name );
  -
  -        Configuration[] components = config.getChildren( "component" );
  -        for( int i=0; i<components.length; i++ )
  -        {
  -            Profile profile = createProfile( name, engine, components[i] );
  -            engine.getRepository().getProfileManager().addProfile( profile );
  -            descriptor.addComponent( profile );
  -        }
  -
  -        ArrayList list = new ArrayList();
  -        Configuration[] containers = config.getChildren( "container" );
  -        for( int i=0; i<containers.length; i++ )
  -        {
  -            // 
  -            // create a classloader that will be supplied to the 
  -            // container (including resolution of the container level 
classpath
  -            // and extension path additions), logger, and container name
  -            //
  -
  -            Configuration childConfig = containers[i];
  -            Configuration engineConfig = childConfig.getChild( "engine" );
  -            String childName;
  -            Logger childLogger;
  -            EngineClassLoader childEngine;
  -            String childPartition;
  -            Registry childRegistry;
  -
  -            if( partition == null )
  -            {
  -                childPartition = name + "/";
  -            }
  -            else
  -            {
  -                childPartition = partition + name + "/";
  -            }
  -            childName = childConfig.getAttribute( "name", "untitled" );
  -            childLogger = logger.getChildLogger( childName );
  -            childEngine = childEngine = createChildEngine( engine, home, 
childConfig, childLogger );
  -            childRegistry = registry.createChild( name );
  -
  -            //
  -            // recursively call this method to create the subsidiary 
containers
  -            //
  -
  -            Appliance container = 
  -              createContainer( 
  -                childEngine, childRegistry, childName, home, childConfig, 
childLogger, childPartition );
  -            list.add( container );
  -        }
  -
  -        //
  -        // create the appliance context for the container
  -        //
  -
  -        Map map = new Hashtable();
  -        map.put("urn:assembly:engine.classloader", engine );
  -        map.put("urn:merlin:container.containers", list );
  -        map.put("urn:merlin:container.descriptor", descriptor );
  -        map.put("urn:merlin:container.registry", registry );
  -        if( partition != null )
  -        {
  -            map.put("urn:avalon:partition.name", partition );
  -        }
  -        else
  -        {
  -            map.put("urn:avalon:partition.name", "" );
  -        }
  -
  -        DefaultApplianceContext context = new DefaultApplianceContext( 
descriptor );
  -        context.setName( name );
  -        context.setDeploymentContext( map );
  -        if( partition != null )
  -        {
  -            context.setPartitionName( partition );
  -        }
  -
  -        //
  -        // create the containement appliance
  -        //
  -
  -        try
  -        {
  -            context.makeReadOnly();
  -            return engine.createAppliance( context, false );
  -        }
  -        catch( Throwable e )
  -        {
  -            final String error = 
  -              "Unable to create containment appliance: " + name;
  -            throw new ContainerException( error, e );
  -        }
  -    }
  -
       protected Profile createProfile( String name, EngineClassLoader engine, 
Configuration config )
         throws ContainerException
       {
  @@ -354,5 +230,4 @@
                throw new ContainerException( error, e );
           }
       }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to