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 2002/06/07 12:57:27 UTC

cvs commit: jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metainfo ServiceReference.java AbstractServiceDescriptor.java

mcconnell    2002/06/07 03:57:27

  Added:       containerkit/src/java/org/apache/excalibur/containerkit/metainfo
                        ServiceReference.java
                        AbstractServiceDescriptor.java
  Log:
  no message
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metainfo/ServiceReference.java
  
  Index: ServiceReference.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.containerkit.metainfo;
  
  import org.apache.avalon.framework.Version;
  import java.util.Properties;
  
  /**
   * This service reference defines the type of service required
   * by a component. The type corresponds to the class name of the
   * class/interface implemented by component. Associated with each
   * classname is a version object so that different versions of same
   * interface can be represented.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/07 10:57:27 $
   */
  public final class ServiceReference extends AbstractServiceDescriptor
  {
      /**
       * Construct a service reference with specified name and version.
       *
       * @param name the name of the service
       * @param version the version of service
       */
      public ServiceReference( final String name, final Version version )
      {
          super( name, version );
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metainfo/AbstractServiceDescriptor.java
  
  Index: AbstractServiceDescriptor.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.containerkit.metainfo;
  
  import org.apache.avalon.framework.Version;
  
  /**
   * This class is an abstract base class for the <code>ServiceDescriptor</code>
   * and <code>ServiceReference</code>.  It descriptor defines the type of 
   * service offerend or required by a component. The type of service corresponds 
   * service descriptor name. Associated with each name is a version object so 
   * that different versions of same interface can be represented.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/07 10:57:27 $
   */
  public abstract class AbstractServiceDescriptor
  {
      /**
       * The name of service class.
       */
      protected final String m_name;
  
      /**
       * The version of service class.
       */
      protected final Version m_version;
  
      /**
       * Construct a service with specified name, version and attributes.
       *
       * @param name the name of the service
       * @param version the version of service
       * @param attributes the attributes of service
       */
      public AbstractServiceDescriptor( final String name, final Version version )
      {
          m_name = name;
          m_version = version;
      }
  
      /**
       * Return name of Service (which coresponds to the interface
       * name eg org.apache.block.WebServer)
       *
       * @return the name of the Service
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Return the version of interface
       *
       * @return the version of interface
       */
      public Version getVersion()
      {
          return m_version;
      }
  
      /**
       * Determine if specified service will match this service.
       * To match a service has to have same name and must comply with version.
       *
       * @param other the other ServiceInfo
       * @return true if matches, false otherwise
       */
      public boolean matches( final AbstractServiceDescriptor other )
      {
          return
              other.getName().equals( m_name ) &&
              other.getVersion().complies( m_version );
      }
  
      /**
       * Convert to a string of format name/version
       *
       * @return string describing service
       */
      public String toString()
      {
          return m_name + "/" + m_version;
      }
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>