com.sun.jaw.reference.agent.services
Interface RelationSrvIf

All Known Implementing Classes:
RelationSrv

public abstract interface RelationSrvIf
extends java.io.Serializable

Defining Relationships

The relationship service enables relationships between m-beans to be defined when they are required. The relationships do not need to be defined in advance. Information on the relationships between m-beans is not stored with the m-beans themselves, but is stored with the relationships. A relationship is an m-bean that implements the Java interface defined in com.sun.jaw.reference.common.RelationIf. To be able to access the relationship service, a relationship m-bean must be registered with the repository.

Model

In Java Dynamic Management Kit, a relationship is defined by:

The m-beans involved in a relationship are referred to within the relationship by their object names.

Implementing a Relationship Service

To implement a relationship service, implement the interface com.sun.jaw.reference.agent.services.RelationSrvIf. Using a relationship service, it is possible to:

See Also:
RelationIf

Fields inherited from class java.io.Serializable
serialVersionUID
 
Method Summary
 ObjectName getRelationName(java.lang.String relClassName)
          Generates a unique relation name.
 ObjectName performAddRelation(RelationIf rel, ObjectName relName)
          Adds an existing relation to the framework.
 java.util.Vector performGetRelations(ObjectName relClassName, ObjectName roleName, java.lang.Integer roleRank)
          Gets handles on relations of a given type with a given role.
 ObjectName performNewRelation(java.lang.String relClassName, ObjectName relName, ObjectName[] roleNames, ObjectName aLoader)
          Declares a new relation between a set of objects.
 void purgeRelations()
           
 

Method Detail

getRelationName

public ObjectName getRelationName(java.lang.String relClassName)
Generates a unique relation name.
Parameters:
relClassName - The class of the relation.

performAddRelation

public ObjectName performAddRelation(RelationIf rel,
                                     ObjectName relName)
                              throws InstanceAlreadyExistException,
                                     InstanceNotFoundException
Adds an existing relation to the framework.
Parameters:
rel - The relation to be added.
relName - The name of the relation to be added.
Returns:
The ObjectName of the instantiated relation.
Throws:
InstanceAlreadyExistException - Relation already registered in repository.
InstanceNotFoundException - One or more roles in the relation are not registered in repository.

performNewRelation

public ObjectName performNewRelation(java.lang.String relClassName,
                                     ObjectName relName,
                                     ObjectName[] roleNames,
                                     ObjectName aLoader)
                              throws java.lang.InstantiationException,
                                     java.lang.ClassNotFoundException,
                                     InvalidPropertyValueException,
                                     InstanceAlreadyExistException,
                                     InstanceNotFoundException
Declares a new relation between a set of objects.
Parameters:
relClassName - The type of relation to be created.
roleNames - The object names in the relation to be created.
relName - The name of the relation to be created.
aLoader - The class loader to be used.
Returns:
The ObjectName of the instantiated relation.
Throws:
java.lang.InstantiationException - A new instance of the specified class could not be created.
java.lang.ClassNotFoundException - The class to be instantiated could not be found by the class loader.
InvalidPropertyValueException - The specified value is not a valid value for the property.
InstanceAlreadyExistException - Relation already registered in repository.
InstanceNotFoundException - One or more roles in the relation are not registered in repository.

performGetRelations

public java.util.Vector performGetRelations(ObjectName relClassName,
                                            ObjectName roleName,
                                            java.lang.Integer roleRank)
                                     throws InstanceNotFoundException
Gets handles on relations of a given type with a given role.
Parameters:
relClassName - Name of the relation instance.
roleName - Name of a role in the relation instances.
roleRank - Which role in the relation.
Returns:
The list of selected relations.
Throws:
InstanceNotFoundException - One or more roles in the relation are not registered in repository.

purgeRelations

public void purgeRelations()