mcconnell    2004/01/07 04:48:12

  Modified:    
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
                        Tag: Ver_3_4 DefaultComponentModel.java
  Log:
  Addition of convinience operations support access to dependency and service provider 
models by descriptor.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.6   +47 -1     
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/Attic/DefaultComponentModel.java
  
  Index: DefaultComponentModel.java
  ===================================================================
  RCS file: 
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/Attic/DefaultComponentModel.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- DefaultComponentModel.java        6 Jan 2004 23:16:49 -0000       1.1.2.5
  +++ DefaultComponentModel.java        7 Jan 2004 12:48:12 -0000       1.1.2.6
  @@ -747,6 +747,29 @@
       }
   
      /**
  +    * Return a dependency model matching the supplied descriptor. If 
  +    * no model matches the supplied descriptor the implementation
  +    * will return null.
  +    *
  +    * @param dependency the dependency descriptor
  +    * @return the matching stage model
  +    */
  +    public DependencyModel getDependencyModel( DependencyDescriptor dependency )
  +    {
  +        DependencyModel[] models = getDependencyModels();
  +        for( int i=0; i<models.length; i++ )
  +        {
  +            DependencyModel model = models[i];
  +            if( dependency.equals( model.getDependency() ) )
  +            {
  +                return model;
  +            }
  +        }
  +        return null;
  +    }
  +
  +
  +   /**
       * Return the stage models for this component type.
       *
       * @return the stage models
  @@ -755,6 +778,29 @@
       {
           return m_stages;
       }
  +
  +   /**
  +    * Return a stage model matching the supplied descriptor. If 
  +    * no stage model matches the supplied descriptor the implementation
  +    * will return null.
  +    *
  +    * @param stage the stage descriptor
  +    * @return the matching stage model
  +    */
  +    public StageModel getStageModel( StageDescriptor stage )
  +    {
  +        StageModel[] stages = getStageModels();
  +        for( int i=0; i<stages.length; i++ )
  +        {
  +            StageModel model = stages[i];
  +            if( stage.equals( model.getStage() ) )
  +            {
  +                return model;
  +            }
  +        }
  +        return null;
  +    }
  +
   
      /**
       * Return the set of services produced by the model as a array of classes.
  
  
  

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

Reply via email to