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/meta/src/java/org/apache/avalon/meta/info/builder XMLTypeCreator.java
Date Sat, 05 Apr 2003 11:55:02 GMT
mcconnell    2003/04/05 03:55:02

  Modified:    merlin/assembly/src/java/org/apache/avalon/assembly/engine/profile
                        DefaultProfileSelector.java
                        StandardProfileManager.java
               merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/profile
                        ProfileSelector.java
               merlin/meta/src/java/org/apache/avalon/meta/info/builder
                        XMLTypeCreator.java
  Log:
  Profile selection updates.
  
  Revision  Changes    Path
  1.2       +2 -4      avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/profile/DefaultProfileSelector.java
  
  Index: DefaultProfileSelector.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/profile/DefaultProfileSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultProfileSelector.java	13 Mar 2003 01:03:57 -0000	1.1
  +++ DefaultProfileSelector.java	5 Apr 2003 11:55:01 -0000	1.2
  @@ -55,7 +55,6 @@
   
   package org.apache.avalon.assembly.engine.profile;
   
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.meta.info.StageDescriptor;
   import org.apache.avalon.meta.info.DependencyDescriptor;
   import org.apache.avalon.meta.model.Profile;
  @@ -70,8 +69,7 @@
    * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
    * @version $Revision$ $Date$
    */
  -class DefaultProfileSelector extends AbstractLogEnabled
  -    implements ProfileSelector
  +class DefaultProfileSelector implements ProfileSelector
   {
   
       /**
  
  
  
  1.2       +30 -2     avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/profile/StandardProfileManager.java
  
  Index: StandardProfileManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/profile/StandardProfileManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StandardProfileManager.java	13 Mar 2003 01:03:58 -0000	1.1
  +++ StandardProfileManager.java	5 Apr 2003 11:55:01 -0000	1.2
  @@ -56,6 +56,7 @@
   import java.util.Enumeration;
   import java.util.Iterator;
   
  +import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.activity.Initializable;
  @@ -428,10 +429,36 @@
       * referenced by a supplied dependency descriptor using the default selector.
       * @param dependency a service depedency descriptor
       * @return a set of profiles capable of servicing the supplied dependency
  +    * @todo replace the code concerning selector establishment with full
  +    *   component support
       */
       public Profile getProfile( DependencyDescriptor dependency )
       {
  -        return getProfile( dependency, m_selector );
  +        String classname = dependency.getAttribute( "urn:avalon:profile.selector", null
);
  +        if( classname == null ) 
  +        {
  +            return getProfile( dependency, m_selector );
  +        }
  +        else
  +        {
  +            try
  +            {
  +                Class clazz = m_classloader.loadClass( classname );
  +                ProfileSelector selector = (ProfileSelector) clazz.newInstance();
  +                if( selector instanceof LogEnabled )
  +                {
  +                    ((LogEnabled)selector).enableLogging( getLogger().getChildLogger( "selector"
) );
  +                }
  +                return getProfile( dependency, selector );
  +            }
  +            catch( Throwable e )
  +            {
  +                final String error = 
  +                  "Unexpected error while attempting to create a custom seletor: " 
  +                  + classname;
  +                throw new ProfileRuntimeException( error, e );
  +            }
  +        }
       }
   
      /**
  @@ -452,6 +479,7 @@
       * referenced by a supplied stage descriptor usign the default selector.
       * @param stage a stage descriptor
       * @return a set of types that provide the supplied service
  +    * @todo add selector support
       */
       public Profile getProfile( StageDescriptor stage )
       {
  
  
  
  1.2       +3 -3      avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/profile/ProfileSelector.java
  
  Index: ProfileSelector.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/profile/ProfileSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfileSelector.java	13 Mar 2003 01:04:44 -0000	1.1
  +++ ProfileSelector.java	5 Apr 2003 11:55:01 -0000	1.2
  @@ -58,9 +58,9 @@
    * Interface implemented by a service selection implementation mechanism.  Classes
    * implementing the selector interface may be activated during the selection of
    * candidate service providers in an autom assembly process.  A selector my be
  - * declared via inclusion a implemetation class nameed <code>&lt;service-type&gt;Selector</code>.
  + * declared via inclusion a implemetation class named <code>&lt;service-type&gt;Selector</code>.
    * Alternatively, a component author may declare a selection class explicitly via a
  - * service dependency attribute with the attribute name of <code>urn:avalon:service.selector</code>.
  + * service dependency attribute with the attribute name of <code>urn:avalon:profile.selector</code>.
    *
    * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
    * @version $Revision$ $Date$
  
  
  
  1.4       +5 -1      avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java
  
  Index: XMLTypeCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLTypeCreator.java	29 Mar 2003 03:25:58 -0000	1.3
  +++ XMLTypeCreator.java	5 Apr 2003 11:55:02 -0000	1.4
  @@ -307,6 +307,10 @@
           throws ConfigurationException
       {
           String role = dependency.getAttribute( "role", null );
  +        if( role == null )
  +        {
  +            role = dependency.getAttribute( "key", null );
  +        }
           ReferenceDescriptor reference = 
             createReference( dependency.getAttribute( "type" ) );
           
  
  
  

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


Mime
View raw message