donaldp     2002/09/07 21:44:36

  Modified:    info/src/java/org/apache/avalon/framework/info
                        ComponentInfo.java DependencyDescriptor.java
                        ServiceDescriptor.java
               info/src/java/org/apache/avalon/framework/tools/infobuilder
                        XMLInfoCreator.java
  Removed:     info/src/java/org/apache/avalon/framework/info
                        ServiceDesignator.java
  Log:
  Fold ServiceDesignator into Depedency/Service Descriptors.
  
  Revision  Changes    Path
  1.3       +3 -5      
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ComponentInfo.java
  
  Index: ComponentInfo.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ComponentInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ComponentInfo.java        8 Sep 2002 04:32:51 -0000       1.2
  +++ ComponentInfo.java        8 Sep 2002 04:44:36 -0000       1.3
  @@ -8,7 +8,6 @@
   package org.apache.avalon.framework.info;
   
   import java.io.Serializable;
  -import org.apache.avalon.framework.info.ServiceDesignator;
   import org.apache.avalon.framework.info.ContextDescriptor;
   
   /**
  @@ -152,9 +151,8 @@
       {
           for( int i = 0; i < m_services.length; i++ )
           {
  -            final ServiceDesignator service =
  -                m_services[ i ].getServiceDesignator();
  -            if( service.getClassname().equals( classname ) )
  +            final String otherClassname = m_services[ i ].getImplementationKey();
  +            if( otherClassname.equals( classname ) )
               {
                   return m_services[ i ];
               }
  
  
  
  1.3       +10 -12    
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/DependencyDescriptor.java
  
  Index: DependencyDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/DependencyDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DependencyDescriptor.java 8 Sep 2002 04:32:51 -0000       1.2
  +++ DependencyDescriptor.java 8 Sep 2002 04:44:36 -0000       1.3
  @@ -8,7 +8,6 @@
   package org.apache.avalon.framework.info;
   
   import java.util.Properties;
  -import org.apache.avalon.framework.info.ServiceDesignator;
   
   /**
    * A descriptor that describes dependency information for
  @@ -46,7 +45,7 @@
       /**
        * The service class/interface that the dependency must provide.
        */
  -    private final ServiceDesignator m_service;
  +    private final String m_implementationKey;
   
       /**
        * True if dependency is optional, false otherwise.
  @@ -57,16 +56,16 @@
        * Constructor a dependency sans Attributes.
        */
       public DependencyDescriptor( final String role,
  -                                 final ServiceDesignator service )
  +                                 final String implementationKey )
       {
  -        this( role, service, false, null );
  +        this( role, implementationKey, false, null );
       }
   
       /**
        * Constructor that has all parts sans parent.
        */
       public DependencyDescriptor( final String key,
  -                                 final ServiceDesignator service,
  +                                 final String implementationKey,
                                    final boolean optional,
                                    final Properties attributes )
       {
  @@ -76,14 +75,13 @@
           {
               throw new NullPointerException( "key" );
           }
  -
  -        if( null == service )
  +        if( null == implementationKey )
           {
  -            throw new NullPointerException( "service" );
  +            throw new NullPointerException( "implementationKey" );
           }
   
           m_key = key;
  -        m_service = service;
  +        m_implementationKey = implementationKey;
           m_optional = optional;
       }
   
  @@ -104,9 +102,9 @@
        * @return a reference to service descriptor that describes the fulfillment
        *  obligations that must be met by a service provider.
        */
  -    public ServiceDesignator getService()
  +    public String getImplementationKey()
       {
  -        return m_service;
  +        return m_implementationKey;
       }
   
       /**
  
  
  
  1.3       +18 -17    
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ServiceDescriptor.java
  
  Index: ServiceDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ServiceDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServiceDescriptor.java    8 Sep 2002 03:35:20 -0000       1.2
  +++ ServiceDescriptor.java    8 Sep 2002 04:44:36 -0000       1.3
  @@ -8,7 +8,6 @@
   package org.apache.avalon.framework.info;
   
   import java.util.Properties;
  -import org.apache.avalon.framework.info.ServiceDesignator;
   
   /**
    * This descriptor defines the type of service offerend or required
  @@ -33,46 +32,48 @@
       extends FeatureDescriptor
   {
       /**
  -     * The service reference that descriptor is describing.
  +     * The implementationKey for the service.
  +     * This usually indicates the name of the service
  +     * class.
        */
  -    private final ServiceDesignator m_designator;
  +    private final String m_implementationKey;
   
       /**
        * Construct a service descriptor for specified ServiceDesignator.
        *
  -     * @param designator the ServiceDesignator
  +     * @param implementationKey the implementationKey of Service
        */
  -    public ServiceDescriptor( final ServiceDesignator designator )
  +    public ServiceDescriptor( final String implementationKey )
       {
  -        this( designator, null );
  +        this( implementationKey, null );
       }
   
       /**
  -     * Construct a service with specified name, version and attributes.
  +     * Construct a service with specified name and attributes.
        *
  -     * @param designator the ServiceDesignator
  +     * @param implementationKey the implementationKey of Service
        * @param attributes the attributes of service
        */
  -    public ServiceDescriptor( final ServiceDesignator designator,
  +    public ServiceDescriptor( final String implementationKey,
                                 final Properties attributes )
       {
           super( attributes );
   
  -        if( null == designator )
  +        if( null == implementationKey )
           {
  -            throw new NullPointerException( "designator" );
  +            throw new NullPointerException( "implementationKey" );
           }
   
  -        m_designator = designator;
  +        m_implementationKey = implementationKey;
       }
   
       /**
  -     * Retrieve the service that service descriptor refers to.
  +     * Return the implementationKey of service.
        *
  -     * @return the service that service descriptor refers to.
  +     * @return the implementationKey of service.
        */
  -    public ServiceDesignator getServiceDesignator()
  +    public String getImplementationKey()
       {
  -        return m_designator;
  +        return m_implementationKey;
       }
   }
  
  
  
  1.4       +8 -24     
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoCreator.java
  
  Index: XMLInfoCreator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoCreator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLInfoCreator.java       8 Sep 2002 04:32:51 -0000       1.3
  +++ XMLInfoCreator.java       8 Sep 2002 04:44:36 -0000       1.4
  @@ -23,7 +23,6 @@
   import org.apache.avalon.framework.info.EntryDescriptor;
   import org.apache.avalon.framework.info.LoggerDescriptor;
   import org.apache.avalon.framework.info.ServiceDescriptor;
  -import org.apache.avalon.framework.info.ServiceDesignator;
   import org.xml.sax.InputSource;
   
   /**
  @@ -201,8 +200,8 @@
                                                     final Configuration dependency )
           throws ConfigurationException
       {
  -        final ServiceDesignator service =
  -            buildServiceDesignator( dependency.getChild( "service-ref" ) );
  +        final String implementationKey =
  +            dependency.getChild( "service-ref" ).getAttribute( "type" );
           final boolean optional =
               dependency.getAttributeAsBoolean( "optional", false );
   
  @@ -214,13 +213,13 @@
           //default to name of service if key unspecified
           if( null == key )
           {
  -            key = service.getClassname();
  +            key = implementationKey;
           }
           else
           {
               //If key is specified and it is the same as
               //service name then warn that it is redundent.
  -            if( key.equals( service.getClassname() ) )
  +            if( key.equals( implementationKey ) )
               {
                   final String message =
                       REZ.getString( "builder.redundent-key.notice",
  @@ -230,7 +229,7 @@
               }
           }
   
  -        return new DependencyDescriptor( key, service, optional, attributes );
  +        return new DependencyDescriptor( key, implementationKey, optional, 
attributes );
       }
   
       /**
  @@ -321,21 +320,6 @@
       }
   
       /**
  -     * A utility method to build a {@link ServiceDesignator}
  -     * object from specified configuraiton data.
  -     *
  -     * @param service the service Configuration
  -     * @return the created ServiceDesignator
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    private ServiceDesignator buildServiceDesignator( final Configuration service )
  -        throws ConfigurationException
  -    {
  -        final String name = service.getAttribute( "type" );
  -        return new ServiceDesignator( name );
  -    }
  -
  -    /**
        * A utility method to build a {@link ServiceDescriptor}
        * object from specified configuraiton data.
        *
  @@ -347,10 +331,10 @@
           throws ConfigurationException
       {
           final Configuration serviceRef = service.getChild( "service-ref" );
  -        final ServiceDesignator designator = buildServiceDesignator( serviceRef );
  +        final String implementationKey = serviceRef.getAttribute( "type" );
           final Properties attributes =
               buildAttributes( service.getChild( "attributes" ) );
  -        return new ServiceDescriptor( designator, attributes );
  +        return new ServiceDescriptor( implementationKey, attributes );
       }
   
       /**
  
  
  

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

Reply via email to