Rio Project 4.2 API Documentation



org.rioproject.associations
Class AssociationDescriptor

java.lang.Object
  extended by org.rioproject.associations.AssociationDescriptor
All Implemented Interfaces:
Serializable

public class AssociationDescriptor
extends Object
implements Serializable

The AssociationDescriptor defines the attributes needed to create, manage and monitor Association instances.

Author:
Dennis Reedy
See Also:
Serialized Form

Field Summary
static String CGLIB_PROXY
           
static String JDK_PROXY
           
static String NO_NAME
          If an AssociationDescriptor is created with a null for the name property, the AssociationDescriptor name property will be set to this value
 
Constructor Summary
AssociationDescriptor()
          Create an AssociationDescriptor
AssociationDescriptor(AssociationType type)
          Create an AssociationDescriptor
AssociationDescriptor(AssociationType type, String name)
          Create an AssociationDescriptor
AssociationDescriptor(AssociationType type, String name, String opStringName, String propertyName)
          Create an AssociationDescriptor
 
Method Summary
static AssociationDescriptor create(String name, Class serviceClass, String... groups)
          Creates a "uses" AssociationDescriptor for a service, matching on the service name
static AssociationDescriptor create(String name, String setter, Class serviceClass, AssociationType type, String... groups)
          Creates an AssociationDescriptor for a service, matching on the service name
static AssociationDescriptor create(String name, String setter, Class serviceClass, String... groups)
          Creates a "uses" AssociationDescriptor for a service, matching on the service name
 boolean equals(Object obj)
          An AssociationDescriptor is equal to another AssociationDescriptor if their name, opStringName and AssociationType attributes are equal
 String getAssociationMatchFilter()
          Get the association match filter class name
 AssociationType getAssociationType()
          Get the AssociationDescriptor type
 ClassBundle getFaultDetectionHandlerBundle()
          Get a FaultDetectionHandler from the Configuration
 String[] getGroups()
          Returns an array consisting of the names of the groups whose members are the lookup services to discover.
 String[] getInterfaceNames()
          Get the the Array of public interfaces the associated service implements
 LookupLocator[] getLocators()
          Returns an array consisting of instances of LookupLocator in which each instance corresponds to a specific lookup service to discover
 String getName()
          Get the associated service's name
 String getOperationalStringName()
          Get the associated service's OperationalString name
 String getPropertyName()
          Get the propertyName
 String getProxyClass()
          Get the proxy factory
 String getProxyType()
          Get the proxy type to create for the Association
 long getServiceDiscoveryTimeout()
          Get the service discovery timeout
 TimeUnit getServiceDiscoveryTimeUnits()
          Get the unit of time for the service discovery timeout
 String getServiceSelectionStrategy()
          Get the ServiceSelectionStrategy classname to use for selecting associated services.
 int hashCode()
          Override hashCode to return the hashCode of the name, opStringName and AssociationType hashCodes
 boolean isLazyInject()
          Get the association injection style
 boolean matchOnName()
          If this method returns true then the name of the service is used in addition to the interfaces implemented by the service or service proxy to track service instances.
 void setAssociationMatchFilter(String associationMatchFilter)
          Set the association match filter class name
 void setFaultDetectionHandlerBundle(ClassBundle fdhBundle)
          Set the FaultDetectionHandler ClassBundle
 void setGroups(String... groups)
          Set the Lookup groups the used to discover the associated service.
 void setInterfaceNames(String... interfaces)
          Set the Array of public interface names the associated service implements
 void setLazyInject(boolean lazyInject)
          Set the association injection style
 void setLocators(LookupLocator... lookupLocators)
          This method provides the ability to set the array of locators that this ServiceBean would like to join.
 void setMatchOnName(boolean matchOnName)
          Set the matchOnName property
 void setName(String name)
          Set the associated service's name
 void setOperationalStringName(String opStringName)
          Set the associated service's OperationalString name
 void setPropertyName(String propertyName)
          Set the propertyName
 void setProxyClass(String proxyClass)
          Set the proxy factory
 void setProxyType(String proxyType)
          Set the proxy type to create for the Association
 void setServiceDiscoveryTimeout(long serviceDiscoveryTimeout)
          Set the timeout for service discovery
 void setServiceDiscoveryTimeUnits(TimeUnit serviceDiscoveryTimeUnits)
          Set the unit of time for the service discovery timeout
 void setServiceSelectionStrategy(String serviceStrategyClass)
          Set the ServiceSelectionStrategy to use when selecting associated services.
 String toString()
          Override toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_NAME

public static final String NO_NAME
If an AssociationDescriptor is created with a null for the name property, the AssociationDescriptor name property will be set to this value

See Also:
Constant Field Values

JDK_PROXY

public static final String JDK_PROXY
See Also:
Constant Field Values

CGLIB_PROXY

public static final String CGLIB_PROXY
See Also:
Constant Field Values
Constructor Detail

AssociationDescriptor

public AssociationDescriptor()
Create an AssociationDescriptor


AssociationDescriptor

public AssociationDescriptor(AssociationType type)
Create an AssociationDescriptor

Parameters:
type - The AssociationType

AssociationDescriptor

public AssociationDescriptor(AssociationType type,
                             String name)
Create an AssociationDescriptor

Parameters:
type - The AssociationType
name - The name of the associated service, may be null

AssociationDescriptor

public AssociationDescriptor(AssociationType type,
                             String name,
                             String opStringName,
                             String propertyName)
Create an AssociationDescriptor

Parameters:
type - The AssociationType
name - The name of the associated service
opStringName - The name of the OperationalString the associated service is part of, may be null
propertyName - The property to set when the associated service is discovered, changed or broken. May be null
Method Detail

getAssociationType

public AssociationType getAssociationType()
Get the AssociationDescriptor type

Returns:
The AssociationType

setPropertyName

public void setPropertyName(String propertyName)
Set the propertyName

Parameters:
propertyName - The propertyName to use to inject the Association

getPropertyName

public String getPropertyName()
Get the propertyName

Returns:
The propertyName to set when the associated service is discovered, changed or broken. This provides support for association based dependency injection. If the propertyName is null, dependency injection will not be used with this association

setName

public void setName(String name)
Set the associated service's name

Parameters:
name - The associated service's name.

getName

public String getName()
Get the associated service's name

Returns:
The associated service's name. If the name is null, the NO_NAME value is returned

setMatchOnName

public void setMatchOnName(boolean matchOnName)
Set the matchOnName property

Parameters:
matchOnName - Whether the association should match on the service name.
Throws:
IllegalArgumentException - If the AssociationDescriptor has it's name property set to null and the matchOnName value is true

matchOnName

public boolean matchOnName()
If this method returns true then the name of the service is used in addition to the interfaces implemented by the service or service proxy to track service instances. If this method returns false, then only the interfaces will be used.

Returns:
True to use the name returned by the getName method

setInterfaceNames

public void setInterfaceNames(String... interfaces)
Set the Array of public interface names the associated service implements

Parameters:
interfaces - Array of public interface names the associated service implements

getInterfaceNames

public String[] getInterfaceNames()
Get the the Array of public interfaces the associated service implements

Returns:
Array of public interfaces names the associated service implements. If there are no public interfaces this method will return a zero-length array

getOperationalStringName

public String getOperationalStringName()
Get the associated service's OperationalString name

Returns:
The associated service's OperationalString name

setOperationalStringName

public void setOperationalStringName(String opStringName)
Set the associated service's OperationalString name

Parameters:
opStringName - The associated service's OperationalString name

setFaultDetectionHandlerBundle

public void setFaultDetectionHandlerBundle(ClassBundle fdhBundle)
Set the FaultDetectionHandler ClassBundle

Parameters:
fdhBundle - The ClassBundle used to create the fault detection handler

getFaultDetectionHandlerBundle

public ClassBundle getFaultDetectionHandlerBundle()
Get a FaultDetectionHandler from the Configuration

Returns:
The ClassBundle providing attributes on the FaultDetectionHandler to use

setGroups

public void setGroups(String... groups)
Set the Lookup groups the used to discover the associated service. If this parameter is not set (remains null), then no attempts will be made via group discovery to discover lookup services the associated service has registered

Parameters:
groups - Array of String group names whose members are the lookup services to discover. Elements contained within the array may be modified as follows:
  • If the groups property is equivalent to the value of LookupDiscovery.ALL_GROUPS, the value will be transformed into "all"
  • If groups property is equivalent to an empty string "", then the value will be transformed to "public"

setLocators

public void setLocators(LookupLocator... lookupLocators)
This method provides the ability to set the array of locators that this ServiceBean would like to join. If this parameter is not set, then no attempts will be made via unicast discovery

Parameters:
lookupLocators - Array of LookupLocator instances

getGroups

public String[] getGroups()
Returns an array consisting of the names of the groups whose members are the lookup services to discover.

Returns:
String array of groups

getLocators

public LookupLocator[] getLocators()
Returns an array consisting of instances of LookupLocator in which each instance corresponds to a specific lookup service to discover

Returns:
An array of LookupLocator instances. If there are no LookupLocator instances, return a zero length array

setProxyClass

public void setProxyClass(String proxyClass)
Set the proxy factory

Parameters:
proxyClass - The class name of the AssociationProxy to use

getProxyClass

public String getProxyClass()
Get the proxy factory

Returns:
The classname of the AssociationProxy to use

setProxyType

public void setProxyType(String proxyType)
Set the proxy type to create for the Association

Parameters:
proxyType - The type of proxy to generate. May be null. If not null, must be either JDK_PROXY or CGLIB_PROXY.

getProxyType

public String getProxyType()
Get the proxy type to create for the Association

Returns:
The type of proxy to generate, either JDK_PROXY or CGLIB_PROXY

setAssociationMatchFilter

public void setAssociationMatchFilter(String associationMatchFilter)
Set the association match filter class name

Parameters:
associationMatchFilter - The classname of the AssociationMatchFilter

getAssociationMatchFilter

public String getAssociationMatchFilter()
Get the association match filter class name

Returns:
The classname of the AssociationMatchFilter

setServiceSelectionStrategy

public void setServiceSelectionStrategy(String serviceStrategyClass)
Set the ServiceSelectionStrategy to use when selecting associated services.

Parameters:
serviceStrategyClass - The classname of the ServiceSelectionStrategy. The ServiceSelectionStrategy must have a zero-arg constructor and implement ServiceSelectionStrategy

getServiceSelectionStrategy

public String getServiceSelectionStrategy()
Get the ServiceSelectionStrategy classname to use for selecting associated services.

Returns:
The classname of the ServiceSelectionStrategy to create. The ServiceSelectionStrategy must have a zero-arg constructor and implement ServiceSelectionStrategy

isLazyInject

public boolean isLazyInject()
Get the association injection style

Returns:
If the association is to be injected, whether to inject the association lazily (when the service is discovered), or eagerly (inject immediately).

setLazyInject

public void setLazyInject(boolean lazyInject)
Set the association injection style

Parameters:
lazyInject - If true, the association will be injected when the service is discovered. If false the association will be injected immediately.

setServiceDiscoveryTimeout

public void setServiceDiscoveryTimeout(long serviceDiscoveryTimeout)
Set the timeout for service discovery

Parameters:
serviceDiscoveryTimeout - The service discovery timeout.

getServiceDiscoveryTimeout

public long getServiceDiscoveryTimeout()
Get the service discovery timeout

Returns:
The value to use for the service discovery timeout

setServiceDiscoveryTimeUnits

public void setServiceDiscoveryTimeUnits(TimeUnit serviceDiscoveryTimeUnits)
Set the unit of time for the service discovery timeout

Parameters:
serviceDiscoveryTimeUnits - The unit of time for the service discovery timeout

getServiceDiscoveryTimeUnits

public TimeUnit getServiceDiscoveryTimeUnits()
Get the unit of time for the service discovery timeout

Returns:
The unit of time for the service discovery timeout

create

public static AssociationDescriptor create(String name,
                                           Class serviceClass,
                                           String... groups)
Creates a "uses" AssociationDescriptor for a service, matching on the service name

Parameters:
name - The service name
serviceClass - The service's exported proxy class
groups - Discovery groups to use
Returns:
An AssociationDescriptor

create

public static AssociationDescriptor create(String name,
                                           String setter,
                                           Class serviceClass,
                                           String... groups)
Creates a "uses" AssociationDescriptor for a service, matching on the service name

Parameters:
name - The service name
setter - The setter property to use when injecting
serviceClass - The service's exported proxy class
groups - Discovery groups to use
Returns:
An AssociationDescriptor

create

public static AssociationDescriptor create(String name,
                                           String setter,
                                           Class serviceClass,
                                           AssociationType type,
                                           String... groups)
Creates an AssociationDescriptor for a service, matching on the service name

Parameters:
name - The service name
setter - The setter property to use when injecting
serviceClass - The service's exported proxy class
type, - The type of Association to create
groups - Discovery groups to use
Returns:
An AssociationDescriptor

hashCode

public int hashCode()
Override hashCode to return the hashCode of the name, opStringName and AssociationType hashCodes

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
An AssociationDescriptor is equal to another AssociationDescriptor if their name, opStringName and AssociationType attributes are equal

Overrides:
equals in class Object

toString

public String toString()
Override toString

Overrides:
toString in class Object

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.