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/composition-spi/src/java/org/apache/avalon/composition/model DependencyModel.java DeploymentModel.java Model.java
Date Sat, 19 Jul 2003 05:25:36 GMT
mcconnell    2003/07/18 22:25:35

  Modified:    merlin/composition/src/java/org/apache/avalon/composition/model/impl
                        DefaultDeploymentModel.java DefaultModel.java
                        DefaultModelFactory.java Resources.properties
               merlin/composition-spi/src/java/org/apache/avalon/composition/data
                        ClasspathDirective.java
               merlin/composition-spi/src/java/org/apache/avalon/composition/model
                        DeploymentModel.java Model.java
  Added:       merlin/composition/src/java/org/apache/avalon/composition/model/impl
                        DefaultDependencyModel.java
               merlin/composition/src/test/conf dependency.xml
               merlin/composition/src/test/org/apache/avalon/composition/model/test
                        DependencyTestCase.java
               merlin/composition-spi/src/java/org/apache/avalon/composition/model
                        DependencyModel.java
  Log:
  Add support to the composition model for explicit assembly directives.
  
  Revision  Changes    Path
  1.14      +47 -29    avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java
  
  Index: DefaultDeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultDeploymentModel.java	17 Jul 2003 21:21:57 -0000	1.13
  +++ DefaultDeploymentModel.java	19 Jul 2003 05:25:35 -0000	1.14
  @@ -58,6 +58,7 @@
   import java.util.Map;
   
   import org.apache.avalon.composition.model.ContextModel;
  +import org.apache.avalon.composition.model.DependencyModel;
   import org.apache.avalon.composition.model.DeploymentModel;
   import org.apache.avalon.composition.model.DeploymentContext;
   import org.apache.avalon.composition.model.ClassLoaderModel;
  @@ -116,6 +117,8 @@
   
       private final boolean m_contextDependent;
   
  +    private final DependencyModel m_dependencyModel;
  +
       //==============================================================
       // mutable state
       //==============================================================
  @@ -151,7 +154,6 @@
   
           m_context = context;
   
  -
           ClassLoader classLoader = m_context.getClassLoader();
   
           if( isConfigurable() )
  @@ -203,7 +205,22 @@
           {
               m_contextModel = null;
           }
  -    }
  +
  + 
  +        //
  +        // create the dependency model for subsequent assembly
  +        // management
  +        //
  +
  +        m_dependencyModel = 
  +          new DefaultDependencyModel( 
  +            context.getLogger().getChildLogger( "dependencies" ), 
  +            context.getPartitionName(), 
  +            context.getProfile().getName(), 
  +            context.getType().getDependencies(),
  +            context.getProfile().getDependencyDirectives() );
  +
  +   }
   
       //==============================================================
       // Model
  @@ -238,20 +255,10 @@
           return m_context.getType().getExtension( stage ) != null;
       }
   
  -   /**
  -    * Return the set of services that this model consumes.
  -    * @return the cumsumed depedencies
  -    */
  -    public DependencyDescriptor[] getDependencies()
  -    {
  -        return m_context.getType().getDependencies();
  -    }
  -
       //==============================================================
       // DeploymentModel
       //==============================================================
   
  -
      /**
       * Return the activation policy for the model. 
       * @return the activaltion policy
  @@ -489,13 +496,39 @@
       }
   
      /**
  +    * Return the context model for this deployment model.
  +    * 
  +    * @return the context model if this model is context dependent, else
  +    *   the return value is null
  +    */
  +    public ContextModel getContextModel()
  +    {
  +        return m_contextModel;
  +    }
  +
  +   /**
  +    * Return the dependency model for this component type.
  +    *
  +    * @return the dependency model
  +    */
  +    public DependencyModel getDependencyModel()
  +    {
  +        return m_dependencyModel;
  +    }
  +
  +
  +    //==============================================================
  +    // implementation
  +    //==============================================================
  +
  +   /**
       * Test if the component type backing the model requires the 
       * establishment of a runtime context.
       *
       * @param return TRUE if the component type requires a runtime
       *   context otherwise FALSE
       */
  -    public boolean getContextDependentState()
  +    private boolean getContextDependentState()
       {
           if( m_context.getType().getStages().length > 0 )
           {
  @@ -572,21 +605,6 @@
               return null;
           }
       }
  -
  -   /**
  -    * Return the context model for this deployment model.
  -    * 
  -    * @return the context model if this model is context dependent, else
  -    *   the return value is null
  -    */
  -    public ContextModel getContextModel()
  -    {
  -        return m_contextModel;
  -    }
  -
  -    //==============================================================
  -    // implementation
  -    //==============================================================
   
       private Configuration consolidateConfigurations( 
         final Configuration primary, final Configuration defaults )
  
  
  
  1.7       +13 -4     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModel.java
  
  Index: DefaultModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultModel.java	17 Jul 2003 21:21:57 -0000	1.6
  +++ DefaultModel.java	19 Jul 2003 05:25:35 -0000	1.7
  @@ -73,7 +73,7 @@
         ResourceManager.getPackageResources( DefaultModel.class );
   
       //==============================================================
  -    // state
  +    // immutable state
       //==============================================================
   
       private final String m_name;
  @@ -112,7 +112,7 @@
       }
   
       //==============================================================
  -    // public
  +    // Model
       //==============================================================
   
      /**
  @@ -134,6 +134,15 @@
       }
   
      /**
  +    * Return the model fully qualified name.
  +    * @return the fully qualified name
  +    */
  +    public String getQualifiedName()
  +    {
  +        return getPath() + getName();
  +    }
  +
  +   /**
       * Return the mode of establishment.
       * @return the mode
       */
  @@ -162,7 +171,7 @@
   
       public String toString()
       {
  -        return "[model: " + getPath() + getName() + "]";
  +        return "[model: " + getQualifiedName() + "]";
       }
   
   }
  
  
  
  1.5       +2 -2      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultModelFactory.java	17 Jul 2003 21:21:57 -0000	1.4
  +++ DefaultModelFactory.java	19 Jul 2003 05:25:35 -0000	1.5
  @@ -137,7 +137,7 @@
           catch( Throwable e )
           {
               final String error = 
  -              "Unable to create a containment model from the url: " + url;
  +              REZ.getString( "factory.containment.create-url.error", url.toString() );
               throw new ModelException( error, e );
           }
       }
  
  
  
  1.11      +3 -2      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Resources.properties,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Resources.properties	14 Jul 2003 22:03:43 -0000	1.10
  +++ Resources.properties	19 Jul 2003 05:25:35 -0000	1.11
  @@ -1,7 +1,8 @@
   
   #
  -# DefaultContainmentModelFactory
  -# ==============================
  +# DefaultModelFactory
  +# ===================
  +factory.containment.create-url.error=Unable to create a containment model from the url:
{0}
   factory.containment.create.error=Unable to construct a new containment model: {0}.
   
   
  
  
  
  1.1                  avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDependencyModel.java
  
  Index: DefaultDependencyModel.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.composition.model.impl;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.Enumeration;
  import java.util.Properties;
  import java.util.Hashtable;
  import java.util.Map;
  
  import org.apache.avalon.composition.model.DeploymentContext;
  import org.apache.avalon.composition.model.DependencyModel;
  import org.apache.avalon.composition.model.Model;
  import org.apache.avalon.composition.model.ModelException;
  import org.apache.avalon.composition.data.DependencyDirective;
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  
  /**
   * Default implementation of the deplendency model.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2003/07/19 05:25:35 $
   */
  public class DefaultDependencyModel extends AbstractLogEnabled implements DependencyModel
  {
      //==============================================================
      // static
      //==============================================================
  
      private static final Resources REZ =
              ResourceManager.getPackageResources( DefaultDependencyModel.class );
  
      //==============================================================
      // immutable state
      //==============================================================
  
      private final DependencyDescriptor[] m_descriptors;
  
      private final DependencyDirective[] m_directives;
  
      private final String m_partition;
  
      private final String m_name;
  
      //==============================================================
      // mutable state
      //==============================================================
  
      //==============================================================
      // constructor
      //==============================================================
  
     /**
      * Creation of a new dependency model.
      *
      * @param logger the logging channel
      * @param descriptors the dependency descriptors
      * @param directives the dependency directives
      */
      public DefaultDependencyModel( 
        final Logger logger, final String partition, final String name, 
        final DependencyDescriptor[] descriptors, DependencyDirective[] directives )
        throws ModelException
      {
          if( logger == null ) throw new NullPointerException( "logger" );
          if( descriptors == null ) throw new NullPointerException( "descriptors" );
          if( directives == null ) throw new NullPointerException( "directives" );
  
          enableLogging( logger );
          m_descriptors = descriptors;
          m_directives = directives;
          m_partition = partition;
          m_name = name;
  
      }
  
      //==============================================================
      // DependencyModel
      //==============================================================
  
     /**
      * Return the set of dependecies for the model.
      *
      * @return the the set of descriptors declaring the component 
      *    depedencies
      */
      public DependencyDescriptor[] getDependencies()
      {
          return m_descriptors;
      }
  
     /**
      * Select a model for a set of candidates taking into account the 
      * the dependency directives and dependency descriptors associated 
      * with the component type that this model is representing.
      *
      * @param key the dependency key
      * @param candidates the set of candidate models
      * @return the selected candidate 
      */
      public Model select( String key, Model[] candidates )
      {
          getLogger().debug( "handling dependency for key: " + key );
          DependencyDirective directive = getDirective( key );
          if( directive != null )
          {
              if( directive != null )
              {
                  if( directive.getSource() != null )
                  {
                      String path = directive.getSource();
                      getLogger().debug( "located path: " + path );
                      String source = resolvePath( m_partition, path );
                      getLogger().debug( "resolved path: " + source );
                      for( int i=0; i<candidates.length; i++ )
                      {
                          final Model candidate = candidates[i];
                          final String name = candidate.getQualifiedName();
                          getLogger().debug( "candidate: " + name );
                          if( source.equals( name ) )
                          {
                              return candidate;
                          }
                      }
                  }
              }
          }
          return null;
      }
  
      private String resolvePath( String partition, String path )
      {
          if( path.startsWith( "/" ) )
          {
              return path;
          }
          else if( path.startsWith( "../" ) )
          {
              final String parent = getParentPath( partition );
              return resolvePath( parent, path.substring( 3 ) );
          }
          else if( path.startsWith( "./" ) )
          {
              return resolvePath( partition, path.substring( 2 ) );
          }
          else
          {
              return partition + path;
          }
      }
  
      private String getParentPath( String partition )
      {
          int n = partition.lastIndexOf( "/" );
          if( n > 0 )
          {
              int index = partition.substring( 0, n-1 ).lastIndexOf( "/" );
              return partition.substring( 0, index );
          }
          else
          {
              final String error = 
                "Illegal attempt to reference a containment context above the root context.";
              throw new IllegalArgumentException( error );
          }
      }
  
      private DependencyDirective getDirective( final String key )
      {
          for( int i=0; i<m_directives.length; i++ )
          {
              final DependencyDirective directive = m_directives[i];
              if( directive.getKey().equals( key ) ) return directive;
          }
          return null;
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/composition/src/test/conf/dependency.xml
  
  Index: dependency.xml
  ===================================================================
  
  
  <container>
  
     <classloader>
       <classpath>
         <fileset dir="ext">
           <include>test-a.jar</include>
           <include>test-b.jar</include>
         </fileset>
         <fileset dir="lib">
           <include>test-c.jar</include>
         </fileset>
       </classpath>
     </classloader>
  
     <component name="test-a" class="org.apache.avalon.composition.model.testa.TestA">
       <context class="org.apache.avalon.composition.model.testa.DefaultFacade">
         <entry key="home">
           <constructor class="java.io.File">
             <param class="java.io.File">${urn:avalon:home.dir}</param>
             <param>xxx</param>
           </constructor>
         </entry>
         <entry key="time">
           <constructor class="java.util.Date"/>
         </entry>
         <entry key="path">
           <import key="urn:avalon:partition.name"/>
         </entry>
       </context>
     </component>
  
     <component name="test-b" class="org.apache.avalon.composition.model.testb.TestB"/>
  
     <component name="test-c" class="org.apache.avalon.composition.model.testc.TestC">
       <dependencies>
         <dependency key="a" source="test-a"/>
         <dependency key="b" source="test-b"/>
       </dependencies>
     </component>
  
  </container>
  
  
  
  1.1                  avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/test/DependencyTestCase.java
  
  Index: DependencyTestCase.java
  ===================================================================
  
  
  package org.apache.avalon.composition.model.test;
  
  import java.io.File;
  import java.io.IOException;
  import java.net.URL;
  import java.util.Date;
  
  import org.apache.avalon.composition.model.Model;
  import org.apache.avalon.composition.model.DeploymentModel;
  import org.apache.avalon.composition.model.DependencyModel;
  import org.apache.avalon.composition.model.AbstractTestCase;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  
  public class DependencyTestCase extends AbstractTestCase
  {      
     //-------------------------------------------------------
     // constructor
     //-------------------------------------------------------
  
      public DependencyTestCase( )
      {
          super( "dependency.xml" );
      }
  
     //-------------------------------------------------------
     // tests
     //-------------------------------------------------------
  
     /**
      * Validate the composition model.
      */
      public void testStandardDependencyModel() throws Exception
      {
          DeploymentModel a = (DeploymentModel) m_model.getModel( "test-a" );
          DeploymentModel b = (DeploymentModel) m_model.getModel( "test-b" );
  
          DeploymentModel model = (DeploymentModel) m_model.getModel( "test-c" );
  
          if( model == null )
          {
              fail( "null deployment model 'test-c'" );
          }
  
          DependencyModel dependencyModel = model.getDependencyModel();
          if( dependencyModel == null )
          {
              fail( "null dependency model" );
          }
  
          DependencyDescriptor[] deps = dependencyModel.getDependencies();
          if( deps != null )
          {
              assertTrue( "dependency count", deps.length == 2 );
          }
          else
          {
              fail( "null dependency descriptor array" );
          }
  
          Model[] candidates = new Model[]{ a, b };
          for( int i=0; i<deps.length; i++ )
          {
              String key = deps[i].getKey();
              try
              {
                  Model selection = dependencyModel.select( key, candidates );
                  System.out.println( "selection: " + selection );
              }
              catch( Throwable e )
              {
                  e.printStackTrace();
                  fail( "resolving explicit dependency directive failed for key: " + key );
              }
          }
      }
  }
  
  
  
  1.2       +2 -2      avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/ClasspathDirective.java
  
  Index: ClasspathDirective.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/ClasspathDirective.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClasspathDirective.java	17 Jul 2003 21:21:58 -0000	1.1
  +++ ClasspathDirective.java	19 Jul 2003 05:25:35 -0000	1.2
  @@ -160,7 +160,7 @@
               {
                   for( int j=0; j<includes.length; j++ )
                   {
  -                    File file = new File( anchor, includes[i].getPath() );
  +                    File file = new File( anchor, includes[j].getPath() );
                       list.add( file );
                   }
               }
  
  
  
  1.8       +8 -1      avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentModel.java
  
  Index: DeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentModel.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DeploymentModel.java	14 Jul 2003 04:41:36 -0000	1.7
  +++ DeploymentModel.java	19 Jul 2003 05:25:35 -0000	1.8
  @@ -181,4 +181,11 @@
       */
       ContextModel getContextModel();
   
  +   /**
  +    * Return the dependency model for this deployment model.
  +    *
  +    * @return the dependency model
  +    */
  +    DependencyModel getDependencyModel();
  +
   }
  
  
  
  1.6       +7 -10     avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/Model.java
  
  Index: Model.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/Model.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Model.java	17 Jul 2003 21:22:00 -0000	1.5
  +++ Model.java	19 Jul 2003 05:25:35 -0000	1.6
  @@ -80,6 +80,12 @@
       String getPath();
   
      /**
  +    * Return the model fully qualified name.
  +    * @return the fully qualified name
  +    */
  +    String getQualifiedName();
  +
  +   /**
       * Return the mode of model establishment.
       * @return the mode
       */
  @@ -109,13 +115,4 @@
       */
       boolean isaCandidate( StageDescriptor stage );
   
  -    //-----------------------------------------------------------
  -    // service consumption
  -    //-----------------------------------------------------------
  -    
  -   /**
  -    * Return the set of services that this model consumes.
  -    * @return the dependencies
  -    */
  -    DependencyDescriptor[] getDependencies();
   }
  
  
  
  1.1                  avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DependencyModel.java
  
  Index: DependencyModel.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.composition.model;
  
  import org.apache.avalon.meta.info.DependencyDescriptor;
  
  /**
   * Dependency model defintion.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2003/07/19 05:25:35 $
   */
  public interface DependencyModel
  {
  
     /**
      * Return the set of dependecies for the model.
      *
      * @return the the set of descriptors declaring the component 
      *    depedencies
      */
      DependencyDescriptor[] getDependencies();
  
      /**
       * Select a model for a set of candidates taking into account the 
       * the depedency directives and dependency descriptors associated 
       * with the component type that this model is representing.
       *
       * @param key the dependency key
       * @param candidates the set of candidate models
       * @return the selected candidate 
       */
       Model select( String key, Model[] candidates );
  
  }
  
  
  

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


Mime
View raw message