Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.core
Interface AssociationManagement

All Known Implementing Classes:
  AssociationMgmt

    public interface AssociationManagement

AssociationManagement provides the necessary support to manage Associations a ServiceBean has to other services. Associations provide a mechanism to model and enforce uses and requires associations between services in an OperationalString. Associations are optional and may be declared as part of a ServiceBean element's specification. Associations take 2 forms:

- Uses
  A weak association relationship where if A uses B exists then, then B may be present for A
- Requires
  A stronger association relationship where if A requires B exists then B must be present for A
- Colocated
  An association which requires that A be colocated with B in the same JVM. If B does not exist, or cannot be located, A shall not be created without B
- Opposed
  An association which requires that A exist in a different JVM then B.
- Isolated
  An association which requires that A exist in a different machine then B.

Associations are created during the design/modelling phase and enforced during runtime The AssociationManager will discover and monitor services described in each Association. An Association will either be discovered, changed or broken. Each state transition an Association goes through will result in the notification of any AssociationListener objects which have registered to this AssociationManagement instance. If the Association is of type `AssociationType.REQUIRES` and the Association state becomes `Association.BROKEN` and there are no services that match the Association type that have a state of `Association.DISCOVERED`, then the AssociationManagement object will unadvertise the ServiceBean using the provided ServiceBeanControl interface. Conversely, if the Association is of type `AssociationType.REQUIRES` and a service is discovered which matches the service type(s), then the Association state becomes `Association.DISCOVERED`. If the ServiceBean is not advertised, the AssociationManager will advertise the ServiceBean

Method Summary
`Object[]` | `getAssociatedServices(Class serviceType)` Get all associated service instances for a service type
`Association[]` | `getAssociations()` Get all Association instances
`Association[]` | `getAssociations(String opStringName)` Get all Association instances that from a specific OperationalString
`Association[]` | `getAssociations(String serviceName, String opStringName)` Get all Association instances for a service name and an optional OperationalString name
`void` | `register(AssociationListener listener)` Register an AssociationListener.
`void` | `remove(AssociationListener listener)` Remove an AssociationListener
`void` | `setServiceBeanContainer(org.jini.rio.cybernode.ServiceBeanContainer container)` Set the ServiceBeanContainer object
`void` | `setServiceBeanContext(ServiceBeanContext context)` Set the ServiceBeanContext object for the ServiceBean
`void` | `setServiceBeanControl(ServiceBeanControl control)` Set the ServiceBeanControl object for the ServiceBean
`void` | `setUnadvertiseOnBroken(boolean unadvertiseOnBroken)` Set unadvertiseOnBroken
`void` | `terminate()` Terminate AssociationManagement, cleaning up all connections

Method Detail

### setServiceBeanControl

    void setServiceBeanControl(ServiceBeanControl control)

  Set the ServiceBeanControl object for the ServiceBean

  Parameters:
    `control` - The ServiceBeanControl object for the ServiceBean

### setServiceBeanContext

    void setServiceBeanContext(ServiceBeanContext context)

  Set the ServiceBeanContext object for the ServiceBean

  Parameters:
    `context` - The ServiceBeanContest object for the ServiceBean

### setServiceBeanContainer

    void setServiceBeanContainer(org.jini.rio.cybernode.ServiceBeanContainer container)

  Set the ServiceBeanContainer object

  Parameters:
    `container` - The ServiceBeanContainer that the ServiceBean is running in

### register

    void register(AssociationListener listener)

  Register an AssociationListener. The listener object will receive notifications of Association state changes. Once a listener is registered, it will be notified of all Association references discovered to date, and will be notified as Associations are discovered, changed or broken. If the parameter value duplicates (using equals) another element in the set of listeners, no action is taken. If the parameter value is null, an IllegalArgumentException is thrown

  Parameters:
    `listener` - An AssociationListener

### remove

    void remove(AssociationListener listener)

  Remove an AssociationListener

  Parameters:
    `listener` - An AssociationListener

### terminate

    void terminate()

  Terminate AssociationManagement, cleaning up all connections

### getAssociations

    Association[] getAssociations(String opStringName)

  Get all Association instances that from a specific OperationalString

  Parameters:
    `opStringName` - String name of the OperationalString
  Returns:
    Array of Association instances that contain the OperationalString name. If there no known associations, a zero-length array will be returned

### getAssociations

    Association[] getAssociations(String serviceName,
                                  String opStringName)

  Get all Association instances for a service name and an optional OperationalString name

  Parameters:
    `serviceName` - String name of the associated service, must not be null
    `opStringName` - String name of the OperationalString. If null will be ignored
  Returns:
    Array of Association instances that contain the service and optionally the OperationalString name. If there no known associations, a zero-length array will be returned

### getAssociatedServices

    Object[] getAssociatedServices(Class serviceType)

  Get all associated service instances for a service type

  Parameters:
    `serviceType` - The service types to match, or null for all services
  Returns:
    Array of service instances that match the serviceType. If there no known associated service, a zero-length array will be returned

### getAssociations

    Association[] getAssociations()

  Get all Association instances

  Returns:
    Array of Association instances. A new array will be allocated each time. If there no known associations, a zero-length array will be returned

### setUnadvertiseOnBroken

    void setUnadvertiseOnBroken(boolean unadvertiseOnBroken)

  Set unadvertiseOnBroken

  Parameters:
    `unadvertiseOnBroken` - If true, and the service has an Association with a type of AssociationType.REQUIRES and the Association is broken, the AssociationManagement object will unadvertise the ServiceBean using the ServiceBean instance's ServiceBeanControl object. If false, the AssociationManagement object will not unadvertise the ServiceBean

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.