mcconnell    2003/02/17 04:12:23

  Modified:    merlin/src/java/org/apache/avalon/merlin/block/impl
                        DefaultBlockLoader.java
  Log:
  Updated to better leverage the appliance manager in url establishment.
  
  Revision  Changes    Path
  1.11      +23 -19    
avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java
  
  Index: DefaultBlockLoader.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultBlockLoader.java   16 Feb 2003 13:01:20 -0000      1.10
  +++ DefaultBlockLoader.java   17 Feb 2003 12:12:22 -0000      1.11
  @@ -254,6 +254,10 @@
           Configuration config = (Configuration) m_library.get( path );
           if( config != null )
           {
  +            if( getLogger().isDebugEnabled() )
  +            {
  +                getLogger().debug("located configuration override for: " + path );
  +            }
               return config;
           }
   
  @@ -287,6 +291,11 @@
   
           Configuration[] targets = config.getChildren( "target" );
   
  +        if( getLogger().isDebugEnabled() )
  +        {
  +            getLogger().debug("target override count: " + targets.length );
  +        }
  +
           for( int j=0; j<targets.length; j++ )
           {
               Configuration target = targets[j];
  @@ -312,7 +321,7 @@
           EngineClassLoader engine = null;
           try
           {
  -            engine = createEngine( m_engine, m_home, engineConfig, base, base );
  +            engine = createEngine( m_engine, m_home, engineConfig, name, base, base 
);
           }
           catch( Throwable e )
           {
  @@ -331,6 +340,10 @@
           return createBlock( engine, list, descriptor, name, 
Container.PATH_SEPERATOR, config );
       }
   
  +    //==============================================================
  +    // internals
  +    //==============================================================
  +
      /**
       * Read in the configuration file containing the customize configuration targets.
       * @param url the url to the targets configuration file (normally config.xml)
  @@ -431,11 +444,6 @@
           }
       }
   
  -
  -    //==============================================================
  -    // internals
  -    //==============================================================
  -
      /**
       * Create a descriptor of a container populated with the defintintion
       * of the components it is managing.
  @@ -511,11 +519,12 @@
           for( int i=0; i<children.length; i++ )
           {
               Configuration child = children[i];
  +            String name = getBlockName( child );
               EngineClassLoader loader;
               try
               {
                   Configuration conf = child.getChild("engine");
  -                loader = createEngine( engine, m_home, conf, base );
  +                loader = createEngine( engine, m_home, conf, name, base );
               }
               catch( EngineException ce )
               {
  @@ -524,7 +533,6 @@
                   throw new BlockException( error, ce );
               }
   
  -            String name = getBlockName( child );
               Block block = createContainmentBlock( 
                 loader, partition, name, child, custom, base, getLogger() );
               list.add( block );
  @@ -584,11 +592,6 @@
         String name, String partition, Configuration custom )
         throws BlockException
       {
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            getLogger().debug( "creating block: " + partition + name );
  -        }
  -
           //
           // create the appliance context for the container - the map
           // contains the context entries that will be provided to the 
  @@ -769,10 +772,10 @@
       * @exception EngineException if an engine establishment failure occurs
       */
       private EngineClassLoader createEngine( 
  -      EngineClassLoader parent, File home, Configuration config, URL base ) 
  +      EngineClassLoader parent, File home, Configuration config, String name, URL 
base ) 
         throws EngineException
       {
  -        return createEngine( parent, home, config, base, null );
  +        return createEngine( parent, home, config, name, base, null );
       }
   
      /**
  @@ -780,13 +783,14 @@
       * @param parent the parent engine
       * @param home the home directory
       * @param config the engine configuration
  +    * @param name the name to associate to the engine
       * @param base the URL from which classpath entries shall be resolved
       * @param target the URL of an implicit entry to include in the engine
       * @return the new engine
       * @exception EngineException if an engine establishment failure occurs
       */
       private EngineClassLoader createEngine( 
  -      EngineClassLoader parent, File home, Configuration config, URL base, URL 
target ) 
  +      EngineClassLoader parent, File home, Configuration config, String name, URL 
base, URL target ) 
         throws EngineException
       {
           LibraryDescriptor extensions = 
  @@ -797,11 +801,11 @@
   
           if( target != null )
           {
  -            return parent.newInstance( base, extensions, classpath, new URL[]{ 
target } );
  +            return parent.newInstance( name, base, extensions, classpath, new 
URL[]{ target } );
           }
           else
           {
  -            return parent.newInstance( base, extensions, classpath );
  +            return parent.newInstance( name, base, extensions, classpath );
           }
       }
   
  
  
  

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

Reply via email to