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 DefaultBlockLoader.java
Date Wed, 02 Apr 2003 15:58:05 GMT
mcconnell    2003/04/02 07:58:05

  Modified:    merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl
                        DefaultBlockLoader.java
  Log:
  Addition of support for simulated package deployment.
  
  Revision  Changes    Path
  1.5       +39 -5     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultBlockLoader.java	29 Mar 2003 03:25:57 -0000	1.4
  +++ DefaultBlockLoader.java	2 Apr 2003 15:58:05 -0000	1.5
  @@ -347,7 +347,11 @@
           }
   
           URL base = getBasePath( path );
  -        Configuration implementation = block.getChild( "implementation" );
  +        Configuration implementation = block.getChild( "implementation", false );
  +        if( implementation == null )
  +        {
  +            implementation = block.getChild( "container" );
  +        }
           Configuration engineConfig = implementation.getChild( "engine" );
           EngineClassLoader engine = null;
           try
  @@ -523,9 +527,16 @@
               }
               catch( Throwable e )
               {
  -                final String error = 
  -                  "Unable to resolve block description on path: " + uri;
  -                throw new BlockException( error, e );
  +                try
  +                {
  +                    return createConfiguration( uri + "BLOCK-INF/block.xml" );
  +                }
  +                catch( Throwable ce )
  +                {
  +                    final String error = 
  +                      "Unable to resolve block description on path: " + uri;
  +                    throw new BlockException( error, e );
  +                }
               }
           }
       }
  @@ -567,6 +578,13 @@
           try
           {
               descriptor = CREATOR.createContainerDescriptor( type, config, name );
  +
  +            //
  +            // from the container implementor point of view a block is all 
  +            // about the creation of appliance instances - the following code
  +            // fragment pulls in all appliance declarations
  +            //
  +
               Configuration[] children = config.getChildren( "appliance" );
               for( int i=0; i<children.length; i++ )
               {
  @@ -575,6 +593,22 @@
                   engine.getRepository().getProfileManager().addProfile( profile );
                   descriptor.addComponent( profile );
               }
  +
  +            //
  +            // however, a user views a container as a thing that contains components
  +            // so we repeat the same process here using "component" instead of 
  +            // "appliance"
  +            //
  +
  +            children = config.getChildren( "component" );
  +            for( int j=0; j<children.length; j++ )
  +            {
  +                Configuration child = children[j];
  +                Profile profile = createProfile( name, engine, child );
  +                engine.getRepository().getProfileManager().addProfile( profile );
  +                descriptor.addComponent( profile );
  +            }
  +
               return descriptor;
           }
           catch( Exception e )
  
  
  

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


Mime
View raw message