link
Avalon
Service Descriptors
Home PlanetProductsCentral
Service Defintion

The org.apache.avalon.meta.info.ServiceDefinition class describes a type of service. It supplements the classic Java interface with a version identifier and attributes. A ServiceDefinition may be referenced by multiple components that will typically supplement the definition in terms of additional attributes. References to a ServiceDefinition concern a component type declaration of dependencies, service access points, lifestyle extension ability, and lifestyle extension dependencies.

An instance of ServiceDescriptor is created using a ServiceBuilder. The following code fragment shows the creation of new ServiceBuilder and the creation of a ServiceDefinition using the builder.

  //
  // create the builder
  //

  ServiceBuilder builder = new ServiceBuilder();
  builder.enableLogging( m_logger );

  //
  // create the service definition
  //

  ServiceDefinition definition = builder.build( this.class() );
XML Schema

  <!--
  Example of a service definition.
  -->

  <service>

    <!--
    Declaration of service version.
    -->

    <version>3.2</version>
    
    <attributes>

      <!--
      Attribute declarations included in a service definition
      are independent of a particular service implementation.
      -->

      <attribute key="a-key" value="a-value"/>

    </attributes>

  </service>