avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl DefaultBlock.java DefaultBlockLoader.java
Date Fri, 18 Apr 2003 21:06:11 GMT
mcconnell    2003/04/18 14:06:11

  Modified:    merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl
                        DefaultBlock.java DefaultBlockLoader.java
  Log:
  Updates to improve the configuration override handling (increased robustness).
  
  Revision  Changes    Path
  1.14      +1 -1      avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlock.java
  
  Index: DefaultBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlock.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultBlock.java	17 Apr 2003 05:55:45 -0000	1.13
  +++ DefaultBlock.java	18 Apr 2003 21:06:11 -0000	1.14
  @@ -334,7 +334,7 @@
               }
   
               Configuration config =
  -              m_library.getConfiguration( getPath() + "/" + profile.getName() );
  +              m_library.getConfiguration( getPath() + profile.getName() );
   
               DefaultApplianceContext context =
                  new DefaultApplianceContext( profile );
  
  
  
  1.16      +34 -9     avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java
  
  Index: DefaultBlockLoader.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultBlockLoader.java	17 Apr 2003 03:42:09 -0000	1.15
  +++ DefaultBlockLoader.java	18 Apr 2003 21:06:11 -0000	1.16
  @@ -222,6 +222,10 @@
        */
       public Configuration getConfiguration( String path, boolean create )
       {
  +        if( getLogger().isDebugEnabled() )
  +        {
  +            getLogger().debug("## lookup config: " + path );
  +        }
           Configuration config = (Configuration) m_library.get( path );
           if( config != null )
           {
  @@ -274,7 +278,8 @@
       {
           if( url == null )
           {
  -            return new DefaultConfiguration( "targets", DefaultBlockLoader.class.getName()
);
  +            return new DefaultConfiguration( 
  +              "targets", DefaultBlockLoader.class.getName() );
           }
           return createConfiguration( url.toString() );
       }
  @@ -937,9 +942,23 @@
           for( int j=0; j<targets.length; j++ )
           {
               Configuration target = targets[j];
  +            
               try
               {
  -                String key = path + target.getAttribute( "name" );
  +                String name = target.getAttribute( "name" );
  +                if( name.startsWith( "/" ) )
  +                {
  +                    name = name.substring( 1 );
  +                }
  +                String key;
  +                if( path.endsWith( "/" ) )
  +                {
  +                    key = path + name;
  +                }
  +                else
  +                {
  +                    key = path + "/" + name;
  +                }
                   m_library.put( key, target.getChild( "configuration" ) );
                   getLogger().debug( "registering configuration for key: " + key );
               }
  @@ -977,12 +996,14 @@
           catch( Throwable ioe )
           {
               final String error =
  -              "Unexpected Exception while reading jar file from url: " + xurl + " cause:
" + ioe;
  +              "Unexpected Exception while reading jar file from url: " 
  +              + xurl + " cause: " + ioe;
               throw new RuntimeException( error );
           }
       }
   
  -    private Configuration getSourceConfiguration( JarFile jar ) throws Exception
  +    private Configuration getSourceConfiguration( JarFile jar ) 
  +      throws Exception
       {
           if( jar == null )
           {
  @@ -1004,7 +1025,8 @@
               if( is == null )
               {
                   throw new RuntimeException(
  -                    "Could not load the configuration resource \"" + jar.getName() + "\""
);
  +                    "Could not load the configuration resource \"" 
  +                    + jar.getName() + "\"" );
               }
               return builder.build( is );
           }
  @@ -1015,7 +1037,8 @@
           }
       }
   
  -    protected Profile createProfile( String name, EngineClassLoader engine, Configuration
config )
  +    protected Profile createProfile( 
  +      String name, EngineClassLoader engine, Configuration config )
         throws ContainerException
       {
           String classname;
  @@ -1112,7 +1135,8 @@
       * @exception EngineException if an engine establishment failure occurs
       */
       private EngineClassLoader createEngine(
  -      EngineClassLoader parent, Configuration config, String name, URL base, URL target
)
  +      EngineClassLoader parent, Configuration config, String name, 
  +      URL base, URL target )
         throws EngineException
       {
           LibraryDescriptor extensions =
  @@ -1122,7 +1146,8 @@
           Configuration classpathConfig = config.getChild( "classpath", false );
           if( classpathConfig != null )
           {
  -            ClasspathDescriptor descriptor = createClasspathDescriptor( classpathConfig
);
  +            ClasspathDescriptor descriptor = 
  +              createClasspathDescriptor( classpathConfig );
               try
               {
                   classpath = new DefaultClasspath( m_root, base, descriptor );
  
  
  

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


Mime
View raw message