You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/07/31 19:42:38 UTC

cvs commit: avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl DefaultContainmentModel.java DefaultModelFactory.java

mcconnell    2003/07/31 10:42:38

  Modified:    merlin   maven.xml
               merlin/composition/src/java/org/apache/avalon/composition/data/builder
                        ContainmentProfileBuilder.java
               merlin/composition/src/java/org/apache/avalon/composition/data/writer
                        XMLContainmentProfileWriter.java
               merlin/composition/src/java/org/apache/avalon/composition/model/impl
                        DefaultContainmentModel.java
                        DefaultModelFactory.java
  Log:
  Sync. with meta package updates.
  
  Revision  Changes    Path
  1.32      +1 -1      avalon-sandbox/merlin/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/maven.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- maven.xml	30 Jul 2003 14:45:35 -0000	1.31
  +++ maven.xml	31 Jul 2003 17:42:38 -0000	1.32
  @@ -287,7 +287,7 @@
       <maven:reactor
         basedir="${basedir}"
         includes="*/project.xml,merlin-extensions/*/project.xml"
  -      excludes="merlin-platform/*,activation-spi/*,activation/*"
  +      excludes="merlin-platform/*,activation-spi/*,activation/*,merlin-extensions/merlin-mgr/project.xml,merlin-extensions/merlin-jmx-agent/project.xml"
         goals="clean"
         banner="Cleaning subproject:"
         ignoreFailures="false"/>
  
  
  
  1.2       +16 -6     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/ContainmentProfileBuilder.java
  
  Index: ContainmentProfileBuilder.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/ContainmentProfileBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContainmentProfileBuilder.java	17 Jul 2003 21:21:56 -0000	1.1
  +++ ContainmentProfileBuilder.java	31 Jul 2003 17:42:38 -0000	1.2
  @@ -96,15 +96,25 @@
       public ContainmentProfile createContainmentProfile( InputStream inputStream )
           throws Exception
       {
  -        final ContainmentProfile profile = buildFromSerDescriptor( inputStream);
  -        if( null != profile )
  +        try
           {
  -            return profile;
  +            final ContainmentProfile profile = buildFromSerDescriptor( inputStream);
  +            if( null != profile )
  +            {
  +                return profile;
  +            }
           }
  -        else
  +        catch( Throwable e )
           {
  -            return buildFromXMLDescriptor( inputStream );
  +            // exception case here is not clear - basically we get a 
  +            // java.io.StreamCorruptedException if wthe input stream is 
  +            // referencing an XML stream - for the moment just go ahead
  +            // and see if we can resolve the source as an XML input but 
  +            // sooner or later we will need to update the serialized 
  +            // to return null if the source isn' a serialized source
           }
  +
  +        return buildFromXMLDescriptor( inputStream );
       }
   
       /**
  
  
  
  1.5       +3 -1      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLContainmentProfileWriter.java
  
  Index: XMLContainmentProfileWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLContainmentProfileWriter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLContainmentProfileWriter.java	30 Jul 2003 15:24:38 -0000	1.4
  +++ XMLContainmentProfileWriter.java	31 Jul 2003 17:42:38 -0000	1.5
  @@ -399,7 +399,9 @@
               }
               else
               {
  -                System.out.println( "UNRECOGNIZED PROFILE: " + profile );
  +                throw new IllegalArgumentException( 
  +                  "Unrecognized profile class: " 
  +                  + profile.getClass().getName() );
               }
           }
       }
  
  
  
  1.19      +55 -5     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
  
  Index: DefaultContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DefaultContainmentModel.java	27 Jul 2003 15:03:47 -0000	1.18
  +++ DefaultContainmentModel.java	31 Jul 2003 17:42:38 -0000	1.19
  @@ -58,6 +58,13 @@
   import java.util.ArrayList;
   import java.util.Map;
   
  +import org.apache.avalon.composition.data.BlockCompositionDirective;
  +import org.apache.avalon.composition.data.BlockIncludeDirective;
  +import org.apache.avalon.composition.data.ContainmentProfile;
  +import org.apache.avalon.composition.data.DeploymentProfile;
  +import org.apache.avalon.composition.data.Profile;
  +import org.apache.avalon.composition.data.ServiceDirective;
  +import org.apache.avalon.composition.data.builder.ContainmentProfileBuilder;
   import org.apache.avalon.composition.model.ClassLoaderContext;
   import org.apache.avalon.composition.model.ClassLoaderModel;
   import org.apache.avalon.composition.model.ContainmentModel;
  @@ -73,10 +80,6 @@
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.composition.data.ContainmentProfile;
  -import org.apache.avalon.composition.data.DeploymentProfile;
  -import org.apache.avalon.composition.data.Profile;
  -import org.apache.avalon.composition.data.ServiceDirective;
   import org.apache.avalon.meta.info.DependencyDescriptor;
   import org.apache.avalon.meta.info.ServiceDescriptor;
   import org.apache.avalon.meta.info.StageDescriptor;
  @@ -100,6 +103,9 @@
       private static final Resources REZ =
               ResourceManager.getPackageResources( DefaultContainmentModel.class );
   
  +    private static final ContainmentProfileBuilder BUILDER = 
  +      new ContainmentProfileBuilder();
  +
       private static String getName( ContainmentContext context )
       {
           if( context.getPartitionName() == null )
  @@ -245,6 +251,16 @@
               DeploymentProfile deployment = (DeploymentProfile) profile;
               return addDeploymentProfile( deployment );
           }
  +        else if( profile instanceof BlockIncludeDirective ) 
  +        {
  +            BlockIncludeDirective directive = (BlockIncludeDirective) profile;
  +            return addBlockIncludeDirective( directive );
  +        }
  +        else if( profile instanceof BlockCompositionDirective ) 
  +        {
  +            BlockCompositionDirective directive = (BlockCompositionDirective) profile;
  +            return addBlockCompositionDirective( directive );
  +        }
           else
           {
               //
  @@ -370,6 +386,40 @@
                   profile.getName() );
               throw new ModelException( error, e );
           }
  +    }
  +
  +   /**
  +    * Add a containment profile that is derived from an external resource.
  +    * @param directive the block composition directive
  +    * @return the containment model established by the include
  +    */
  +    private ContainmentModel addBlockCompositionDirective( BlockCompositionDirective directive )
  +    {
  +        //
  +        // TODO
  +        // construct an input stream from the repository resource
  +        // jar file /BLOCK_INF/block.xml and use this to create the 
  +        // containment profile and use the profile to create the model
  +        //
  +
  +        throw new UnsupportedOperationException();
  +    }
  +
  +   /**
  +    * Add a containment profile that is derived from an external source.
  +    * @param directive the block include directive
  +    * @return the containment model established by the include
  +    */
  +    private ContainmentModel addBlockIncludeDirective( BlockIncludeDirective directive )
  +    {
  +        //
  +        // TODO
  +        // construct an input stream from the directive
  +        // and use this to create the containment profile and 
  +        // use the profile to create the model
  +        //
  +
  +        throw new UnsupportedOperationException();
       }
   
      /**
  
  
  
  1.6       +9 -7      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java
  
  Index: DefaultModelFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultModelFactory.java	19 Jul 2003 05:25:35 -0000	1.5
  +++ DefaultModelFactory.java	31 Jul 2003 17:42:38 -0000	1.6
  @@ -51,7 +51,9 @@
   package org.apache.avalon.composition.model.impl;
   
   import java.io.File;
  +import java.io.InputStream;
   import java.net.URL;
  +import java.net.URLConnection;
   
   import org.apache.avalon.composition.model.ClassLoaderModel;
   import org.apache.avalon.composition.model.ClassLoaderContext;
  @@ -72,7 +74,7 @@
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.composition.data.ContainmentProfile;
   import org.apache.avalon.composition.data.ClassLoaderDirective;
  -import org.apache.avalon.composition.data.builder.XMLContainmentProfileCreator;
  +import org.apache.avalon.composition.data.builder.ContainmentProfileBuilder;
   
   /**
    * A factory enabling the establishment of new composition model instances.
  @@ -87,8 +89,8 @@
       // static
       //==============================================================
   
  -    private static final XMLContainmentProfileCreator CREATOR = 
  -      new XMLContainmentProfileCreator();
  +    private static final ContainmentProfileBuilder BUILDER = 
  +      new ContainmentProfileBuilder();
   
       private static final Resources REZ =
         ResourceManager.getPackageResources( DefaultModelFactory.class );
  @@ -129,9 +131,9 @@
       {
           try
           {
  -            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
  -            Configuration config = builder.build( url.toString() );
  -            ContainmentProfile profile = CREATOR.createContainmentProfile( config );
  +            final URLConnection connection = url.openConnection();
  +            final InputStream stream = connection.getInputStream();
  +            final ContainmentProfile profile = BUILDER.createContainmentProfile( stream );
               return createContainmentModel( profile );
           }
           catch( Throwable e )
  
  
  

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