Javadoc Tags

Dependency Tag

Component types may declare multiple service dependencies through the service tag. Each service tag references a versioned service identifier that the container will supply to the component type on request relative to the declared dependency key.

package net.osm;

/**
 * Example of a component declaring multiple service dependencies.
 *
 * @avalon.meta.version 1.0
 * @avalon.meta.name demo
 */
public class Demo implements Serviceable
{
    ...

   /**
    * Supply of dependent services to this component by 
    *  the container.
    * @param manager the service manager
    * @avalon.meta.dependency key="home" type="Home" version="1.3" 
    * @avalon.meta.dependency type="Resource" version="5" optional="true"
    */
    public void service( ServiceManager manager ) 
      throws ServiceException
    {
        m_home = (Home) manager.lookup( "home" );
        try
        {
            m_resource = (Resource) manager.lookup( 
              Resource.getClass().getName() );
        }
        catch( ServiceException se )
        {
            // it's optional
        }
    }
}

Generated meta-info type descriptor:

<type>
  <info>
    <version>1.3.0</version>
    <name>demo</name>
  </info>
  <dependencies>
    <dependency key="home" type="Home" version="1.3.0"/>
    <dependency type="Resource" version="5.0.0" optional="true"/>
  </dependencies>
</type>