com.sun.jaw.impl.agent.services.light
Class RelationSrv

java.lang.Object
  |
  +--com.sun.jaw.impl.agent.services.light.RelationSrv

public class RelationSrv
extends java.lang.Object
implements RelationSrvIf

This class provides a simple implementation of an relation service. The relation service makes use of the metadata service registered within the Common Management Framework. The implementation can be dynamically loaded into the CMF.

See Also:
RelationSrvIf, Serialized Form

Constructor Summary
RelationSrv()
           
 
Method Summary
 java.lang.String getClassVersion()
          Returns the version of this class.
 ObjectName getRelationName(java.lang.String className)
          Generate a unique relation name.
 void initCmf(Framework cmf, ObjectName name, boolean db, ModificationList list)
          For JDMK internal use only.
 ObjectName performAddRelation(RelationIf rel, ObjectName relName)
          Add an existing relation to the framework.
 java.util.Vector performGetRelations(ObjectName relClassName, ObjectName roleName, java.lang.Integer roleRank)
          Get handles on relations of a given type with a given role.
 ObjectName performNewRelation(java.lang.String relClassName, ObjectName relName, ObjectName[] roleNames, ObjectName aLoader)
          Declare a new relation between a set of objects.
 boolean purgeOneRelation(ObjectName relName)
           
 void purgeRelations()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationSrv

public RelationSrv()
Method Detail

initCmf

public void initCmf(Framework cmf,
                    ObjectName name,
                    boolean db,
                    ModificationList list)
             throws InstanceAlreadyExistException
For JDMK internal use only.

Initialize the Relation service. The method will declare the object to the Common Management Framework.

Parameters:
agent - The core management framework to register the service with.
name - Object name.
db - Indicates if persistent storage is required.
list - The modification list to use for setting up parameters.
Throws:
InstanceAlreadyExistException - The m-bean is already registered in the repository.

performAddRelation

public ObjectName performAddRelation(RelationIf rel,
                                     ObjectName relName)
                              throws InstanceNotFoundException,
                                     InstanceAlreadyExistException
Add an existing relation to the framework.
Specified by:
performAddRelation in interface RelationSrvIf
Parameters:
rel - the relation to add.
relName - the name of the relation to add.
Returns:
The ObjectName of the instantiated relation.
Throws:
InstanceNotFoundException - The specified m-bean was not found in the repository.
InstanceAlreadyExistException - The m-bean is already registered in the object 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
Declare a new relation between a set of objects.
Specified by:
performNewRelation in interface RelationSrvIf
Parameters:
relClassName - the type of the relation to create.
roleNames - the object names in the relation to create.
relName - the name of the relation to create.
aLoader - a class loader to use.
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
java.lang.ClassNotFoundException - class to instantiate not found by the class loader
java.lang.InstantiationException - unable to create a new instance of the specified class
InvalidPropertyValueException - if the number of roles is not equal to the degree of the relation

performGetRelations

public java.util.Vector performGetRelations(ObjectName relClassName,
                                            ObjectName roleName,
                                            java.lang.Integer roleRank)
                                     throws InstanceNotFoundException
Get handles on relations of a given type with a given role.
Specified by:
performGetRelations in interface RelationSrvIf
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 is returned
Throws:
InstanceNotFoundException - The m-bean does not exist in the repository.

purgeOneRelation

public boolean purgeOneRelation(ObjectName relName)

purgeRelations

public void purgeRelations()
Specified by:
purgeRelations in interface RelationSrvIf

getRelationName

public ObjectName getRelationName(java.lang.String className)
Generate a unique relation name.
Specified by:
getRelationName in interface RelationSrvIf
Parameters:
relClassName - the class of the relation.

getClassVersion

public java.lang.String getClassVersion()
Returns the version of this class.