org.apache.avalon.meta.info
Class DependencyDescriptor

java.lang.Object
  extended byorg.apache.avalon.meta.info.Descriptor
      extended byorg.apache.avalon.meta.info.DependencyDescriptor
All Implemented Interfaces:
Serializable

public final class DependencyDescriptor
extends Descriptor

A descriptor that describes dependency information for a particular Component. This class contains information about;

Also associated with each dependency is a set of arbitrary attributes that can be used to store extra information about dependency. See InfoDescriptor for example of how to declare the container specific attributes.

Possible uses for the attributes are to declare container specific constraints of component. For example a dependency on a Corba ORB may also require that the Corba ORB contain the TimeServer and PersistenceStateService at initialization. Or it may require that the componenet be multi-thread safe or that it is persistent etc. These are all container specific demands.

Version:
$Revision: 1.3 $ $Date: 2004/02/10 16:30:16 $
Author:
Avalon Development Team
See Also:
Serialized Form

Constructor Summary
DependencyDescriptor(String role, ReferenceDescriptor service)
          Creation of a new dependency descriptor.
DependencyDescriptor(String role, ReferenceDescriptor service, boolean optional, Properties attributes)
          Creation of a new dependency descriptor.
DependencyDescriptor(String role, ReferenceDescriptor service, boolean optional, Properties attributes, int position)
          Creation of a new dependency descriptor.
DependencyDescriptor(String role, String service)
          Creation of a new dependency descriptor using the default 1.0 version
DependencyDescriptor(String role, String service, Version version)
          Creation of a new dependency descriptor.
 
Method Summary
 boolean equals(Object other)
          Compare this object with another for equality.
 String getKey()
          Return the name the component uses to lookup the dependency.
 int getPosition()
          Return the constructor position.
 ReferenceDescriptor getReference()
          Return the service class/interface descriptor that describes the dependency must fulfilled by a provider.
 ReferenceDescriptor getService()
          Deprecated. use getReference()
 int hashCode()
          Return the hashcode for the object.
 boolean isOptional()
          Return true if dependency is optional, false otherwise.
 boolean isRequired()
          Return true if dependency is required, false otherwise.
 String toString()
           
 
Methods inherited from class org.apache.avalon.meta.info.Descriptor
getAttribute, getAttribute, getAttributeNames, getProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DependencyDescriptor

public DependencyDescriptor(String role,
                            String service)
Creation of a new dependency descriptor using the default 1.0 version

Parameters:
role - the role name that will be used by the type when looking up a service
service - the interface service

DependencyDescriptor

public DependencyDescriptor(String role,
                            String service,
                            Version version)
Creation of a new dependency descriptor.

Parameters:
role - the role name that will be used by the type when looking up a service
service - the version insterface service reference

DependencyDescriptor

public DependencyDescriptor(String role,
                            ReferenceDescriptor service)
Creation of a new dependency descriptor.

Parameters:
role - the role name that will be used by the type when looking up a service
service - the version insterface service reference

DependencyDescriptor

public DependencyDescriptor(String role,
                            ReferenceDescriptor service,
                            boolean optional,
                            Properties attributes)
Creation of a new dependency descriptor.

Parameters:
role - the role name that will be used by the type when looking up a service
service - the version insterface service reference
optional - TRUE if this depedency is optional
attributes - a set of attributes to associate with the dependency

DependencyDescriptor

public DependencyDescriptor(String role,
                            ReferenceDescriptor service,
                            boolean optional,
                            Properties attributes,
                            int position)
Creation of a new dependency descriptor.

Parameters:
role - the role name that will be used by the type when looking up a service
service - the version insterface service reference
optional - TRUE if this depedency is optional
attributes - a set of attributes to associate with the dependency
position - constructor position
Method Detail

getKey

public String getKey()
Return the name the component uses to lookup the dependency.

Returns:
the name the component uses to lookup the dependency.

getService

public ReferenceDescriptor getService()
Deprecated. use getReference()

Return the service class/interface descriptor that describes the dependency that the provider provides.

Returns:
a reference to service reference that describes the fulfillment obligations that must be met by a service provider.

getReference

public ReferenceDescriptor getReference()
Return the service class/interface descriptor that describes the dependency must fulfilled by a provider.

Returns:
a reference to service reference that describes the fulfillment obligations that must be met by a service provider.

isOptional

public boolean isOptional()
Return true if dependency is optional, false otherwise.

Returns:
true if dependency is optional, false otherwise.

isRequired

public boolean isRequired()
Return true if dependency is required, false otherwise.

Returns:
true if dependency is required, false otherwise.

getPosition

public int getPosition()
Return the constructor position.

Returns:
-1 if not constructor else the value indicates the n'th public constructor

toString

public String toString()

equals

public boolean equals(Object other)
Compare this object with another for equality.

Overrides:
equals in class Descriptor
Parameters:
other - the object to compare this object with
Returns:
TRUE if the supplied object is a reference, service, or service descriptor that matches this objct in terms of classname and version

hashCode

public int hashCode()
Return the hashcode for the object.

Overrides:
hashCode in class Descriptor
Returns:
the hashcode value


Copyright © The Apache Software Foundation. All Rights Reserved.