|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines the management interface for a relation service.
The relation service performs the following functions:
Revisions:
20020312 Adrian Brock:
Method Summary | |
void |
addRelation(ObjectName relation)
Add a manually created relation to the relation service. |
void |
addRelationType(RelationType relationType)
Add a relation type to the relation service. |
Integer |
checkRoleReading(String roleName,
String relationTypeName)
Checks whether the passed role can be read in the given relation type. |
Integer |
checkRoleWriting(Role role,
String relationTypeName,
Boolean initFlag)
Checks whether the passed role can be written in the given relation type. |
void |
createRelation(String relationId,
String relationTypeName,
RoleList roleList)
Create a simple relation using RelationSupport for a relation
type within the relation service. |
void |
createRelationType(String relationTypeName,
RoleInfo[] roleInfos)
Create a relation type within the relation service. |
Map |
findAssociatedMBeans(ObjectName mbeanName,
String relationTypeName,
String roleName)
Retrieves MBeans associated with the passed MBean in the passed relation type and role. |
Map |
findReferencingRelations(ObjectName mbeanName,
String relationTypeName,
String roleName)
Retrieves MBeans referencing the passed MBean in the passed relation type and role. |
List |
findRelationsOfType(String relationTypeName)
Retrieves the relation ids for relations of the passed type. |
List |
getAllRelationIds()
Retrieves all the relation ids. |
List |
getAllRelationTypeNames()
Retrieves all the relation type names. |
RoleResult |
getAllRoles(String relationId)
Retrieves all the roles for a given relation id. |
boolean |
getPurgeFlag()
Retrieves the purge flag. |
Map |
getReferencedMBeans(String relationId)
Retrieves all the MBeans referenced in all the roles of a relation. |
String |
getRelationTypeName(String relationId)
Retrieves the relation type name for the passed relation. |
List |
getRole(String relationId,
String roleName)
Retrieves MBeans in a role for a given relation id. |
Integer |
getRoleCardinality(String relationId,
String roleName)
Retrieves the number of MBeans in a role for a given relation id. |
RoleInfo |
getRoleInfo(String relationTypeName,
String roleInfoName)
Retrieves the role information for a given relation type. |
List |
getRoleInfos(String relationTypeName)
Retrieves all the role information for a given relation type. |
RoleResult |
getRoles(String relationId,
String[] roleNames)
Retrieves selected roles for a relation. |
Boolean |
hasRelation(String relationId)
Checks whether the relation service has the passed relation id. |
void |
isActive()
Checks whether the relation service is active, i.e. |
String |
isRelation(ObjectName objectName)
Checks whether the passed object name is a relation in this relation service. |
ObjectName |
isRelationMBean(String relationId)
Checks whether the passed relation id is an MBean created by a user or has been internally created by the relation service. |
void |
purgeRelations()
Purge relations. |
void |
removeRelation(String relationId)
Removes a relation from the relation service. |
void |
removeRelationType(String relationTypeName)
Removes a relation type from the relation service. |
void |
sendRelationCreationNotification(String relationId)
Sends a relation creation notification For internally created relations, a RELATION_BASIC_CREATION notification is sent. |
void |
sendRelationRemovalNotification(String relationId,
List unregMBeans)
Sends a relation removal notification For internally created relations, a RELATION_BASIC_REMOVAL notification is sent. |
void |
sendRoleUpdateNotification(String relationId,
Role newRole,
List oldRoleValue)
Sends a relation update notification For internally created relations, a RELATION_BASIC_UPDATE notification is sent. |
void |
setPurgeFlag(boolean value)
Sets the purge flag. |
void |
setRole(String relationId,
Role role)
Sets the role in the passed relation. |
RoleResult |
setRoles(String relationId,
RoleList roles)
Sets the roles in the passed relation. |
void |
updateRoleMap(String relationId,
Role newRole,
List oldRoleValue)
Handles the update of the relation service role map when a role is changed. |
Method Detail |
public void isActive() throws RelationServiceNotRegisteredException
RelationServiceNotRegisteredException
- when the relation
service is not registered with an MBeanServer.public boolean getPurgeFlag()
public void setPurgeFlag(boolean value)
value
- true for an immediate purge on unregistration, false
otherwise.public void createRelationType(String relationTypeName, RoleInfo[] roleInfos) throws IllegalArgumentException, InvalidRelationTypeException
relationTypeName
- the relation type name.roleInfos
- an array of role infos.
IllegalArgumentException
- for a null relation type.
InvalidRelationTypeException
- if a relation type already
exists in the relation service with the given name, there
are problems with the role infos.public void addRelationType(RelationType relationType) throws IllegalArgumentException, InvalidRelationTypeException
relationType
- the relation type.
IllegalArgumentException
- for a null relation type.
InvalidRelationTypeException
- if a relation type already
exists in the relation service with the given name.public List getAllRelationTypeNames()
public List getRoleInfos(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException
relationTypeName
- the relation type name
IllegalArgumentException
- for a null parameter.
RelationTypeNotFoundException
- when the relation id does not
exist.public RoleInfo getRoleInfo(String relationTypeName, String roleInfoName) throws IllegalArgumentException, RelationTypeNotFoundException, RoleInfoNotFoundException
relationTypeName
- the relation type nameroleInfoName
- the role information name
IllegalArgumentException
- for a null parameter.
RelationTypeNotFoundException
- when the relation type does not
exist.
RoleInfoNotFoundException
- when the role information does not
exist for the relation type.public void removeRelationType(String relationTypeName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationTypeNotFoundException
Any relations using this relation type are also removed.
relationTypeName
- the relation type name
IllegalArgumentException
- for a null parameter.
RelationTypeNotFoundException
- when the relation type does not
exist.
RelationServiceNotRegisteredException
- when the relation
service is not registered with an MBeanServer.public void createRelation(String relationId, String relationTypeName, RoleList roleList) throws RelationServiceNotRegisteredException, IllegalArgumentException, RoleNotFoundException, InvalidRelationIdException, RelationTypeNotFoundException, InvalidRoleValueException
RelationSupport
for a relation
type within the relation service.Roles not initialised are set to an empty ArrayList.
A RELATION_BASIC_CREATION notification is sent.
relationId
- the relation id of the relationrelationTypeName
- the relation type of the relationroleList
- the roles to initialise in the relation (can be null)
IllegalArgumentException
- for a null parameter.
RelationServiceNotRegisteredException
- when the relation
service is not registered with the MBeanServer.
InvalidRelationIdException
- if the relation id
is already used by another relation.
RelationTypeNotFoundException
- if there is no relation type in
the relation or the relation type has not been registered
with the relation service.
InvalidRoleValueException
- if the number of MBeans in a
role is outside the bounds of the RoleInfo defined in the
relation type, one of the MBeans is not of the correct
class, an MBean does not exist, the same role name is
used in two different relations.
RoleNotFoundException
- if a role in the relation is not
in the relation type.public void addRelation(ObjectName relation) throws IllegalArgumentException, RelationServiceNotRegisteredException, NoSuchMethodException, InvalidRelationIdException, InstanceNotFoundException, InvalidRelationServiceException, RelationTypeNotFoundException, RoleNotFoundException, InvalidRoleValueException
relation
- the object name of the relation
IllegalArgumentException
- for a null object name.
NoSuchMethodException
- if the mbean does not implement the
Relation interface.
RelationServiceNotRegisteredException
- when the relation
service is not registered with the MBeanServer.
InstanceNotFoundException
- when the relation is not
registered in the MBeanServer.
InvalidRelationIdException
- if the relation id
is already used by another relation.
InvalidRelationServiceException
- if the relation service in
the relation is null or is not the relation service to which
it is being added.
RelationTypeNotFoundException
- if there is no relation type in
the relation or the relation type has not been registered
with the relation service.
InvalidRoleValueException
- if the number of MBeans in a
role is outside the bounds of the RoleInfo defined in the
relation type, one of the MBeans is not of the correct
class or an MBean does not exist.
RoleNotFoundException
- if a role in the relation is not
in the relation type.public ObjectName isRelationMBean(String relationId) throws IllegalArgumentException, RelationNotFoundException
relationId
- the relation id to check
IllegalArgumentException
- for a null object name.
RelationNotFoundException
- when the relation id does not
exist.public String isRelation(ObjectName objectName) throws IllegalArgumentException
objectName
- the name of the MBean to check
IllegalArgumentException
- for a null object name.public Boolean hasRelation(String relationId) throws IllegalArgumentException
relationId
- the relation id
IllegalArgumentException
- for a null parameter.public List getAllRelationIds()
public Integer checkRoleReading(String roleName, String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException
The return value is either zero when readable or a value from
RoleStatus
.
roleName
- the name of the role to check.relationTypeName
- the relation type to check.
IllegalArgumentException
- for a null parameters.
RelationTypeNotFoundException
- if the relation type does
exist in the relation service.public Integer checkRoleWriting(Role role, String relationTypeName, Boolean initFlag) throws IllegalArgumentException, RelationTypeNotFoundException
The return value is either zero when writable or a value from
RoleStatus
.
role
- the role to check.relationTypeName
- the relation type to check.initFlag
- write access is not check when this flag is true.
IllegalArgumentException
- for a null parameters.
RelationTypeNotFoundException
- if the relation type does
exist in the relation service.public void sendRelationCreationNotification(String relationId) throws IllegalArgumentException, RelationNotFoundException
For externally created relations, a RELATION_MBEAN_CREATION notification is sent.
The source is this relation service.
This method is called by addRelation() and createRelation()
relationId
- the relation id
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.public void sendRoleUpdateNotification(String relationId, Role newRole, List oldRoleValue) throws IllegalArgumentException, RelationNotFoundException
For externally created relations, a RELATION_MBEAN_UPDATE notification is sent.
The source is this relation service.
This method is called from the RelationSupport setRole() and setRoles() methods.
relationId
- the relation idnewRole
- the new roleoldRoleValue
- a list of MBeans in the old role
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.public void sendRelationRemovalNotification(String relationId, List unregMBeans) throws IllegalArgumentException, RelationNotFoundException
For externally created relations, a RELATION_MBEAN_REMOVAL notification is sent.
The source is this relation service.
This method is called by removeRelation()
relationId
- the relation idunregMBeans
- a list of MBeans to be unregistered due to this
removal (can be null)
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.public void updateRoleMap(String relationId, Role newRole, List oldRoleValue) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException
It is called from RelationSupport setRole() and setRoles() and the relation service's setRole() and setRoles() methods.
The relation service will keep track the MBeans unregistration to maintain the consistency of the relation.
relationId
- the relation idnewRole
- the new roleoldRoleValue
- a list of MBeans in the old role
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.
RelationServiceNotRegisteredException
- when the relation
service has not been registered with an MBeanServerpublic void removeRelation(String relationId) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException
For internally created relations, a RELATION_BASIC_REMOVAL notification is sent.
For externally created relations, a RELATION_MBEAN_REMOVAL notification is sent.
The MBeans referenced in the relation are unaffected.
relationId
- the relation id
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.
RelationServiceNotRegisteredException
- when the relation
service is not registered with an MBeanServer.public void purgeRelations() throws RelationServiceNotRegisteredException
Not purging relations automatically can lead to problems when the same object name is reused.
If the unregistration causes a role to go below its minimal cardinality, the relation is removed. Otherwise the relation's handleMBeanUnregistration() is called.
RelationServiceNotRegisteredException
- when the relation
service is not registered with an MBeanServer.public Map findReferencingRelations(ObjectName mbeanName, String relationTypeName, String roleName) throws IllegalArgumentException
mbeanName
- the name of the referenced MBeanrelationTypeName
- the relation type, null means check all
relation types.roleName
- the role, null means check all roles.
IllegalArgumentException
- for a null object name.public Map findAssociatedMBeans(ObjectName mbeanName, String relationTypeName, String roleName) throws IllegalArgumentException
mbeanName
- the name of the reference MBeanrelationTypeName
- the relation type, null means check all
relation types.roleName
- the role, null means check all roles.
IllegalArgumentException
- for a null object name.public List findRelationsOfType(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException
relationTypeName
- the relation type.
IllegalArgumentException
- for a null relation type name.
RelationTypeNotFoundException
- if there is no relation type
with the passed name.public List getRole(String relationId, String roleName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException
relationId
- the relation idroleName
- the role name
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.
RelationServiceNotRegisteredException
- when the relation
service is not registered with an MBeanServer.
RoleNotFoundException
- when the role does not exist or
is not readable.public RoleResult getRoles(String relationId, String[] roleNames) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException
relationId
- the relation idroleNames
- an array of role name
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.
RelationServiceNotRegisteredException
- when the relation
service is not registered with an MBeanServer.public RoleResult getAllRoles(String relationId) throws IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException
relationId
- the relation id
IllegalArgumentException
- for a null relation id.
RelationNotFoundException
- when the relation id does not
exist.
RelationServiceNotRegisteredException
- when the relation
service is not registered with an MBeanServer.public Integer getRoleCardinality(String relationId, String roleName) throws IllegalArgumentException, RelationNotFoundException, RoleNotFoundException
relationId
- the relation idroleName
- the role name
IllegalArgumentException
- for a null parameter.
RelationNotFoundException
- when the relation id does not
exist.
RoleNotFoundException
- when the role does not exist or
is not readable.public void setRole(String relationId, Role role) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException, InvalidRoleValueException, RelationTypeNotFoundException
The role will be validated according to information in the relation type.
The relation service will keep track the MBeans unregistration to maintain the consistency of the relation.
relationId
- the relation to change the role for.role
- the new role
IllegalArgumentException
- for null parameters
RelationServiceNotRegisteredException
- when the relation service
has not been registered with an MBeanServer
RelationNotFoundException
- when the relation does not exist in
the relation service.
RoleNotFoundException
- when this is an internal relation or
the role does not exist or it is not writable.
InvalidRoleValueException
- when the role is not valid according
to information in the relation type.
RelationTypeNotFoundException
- if the relation type is not known.public RoleResult setRoles(String relationId, RoleList roles) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException
The roles will be validated according to information in the relation type.
The relation service will keep track the MBeans unregistration to maintain the consistency of the relation.
relationId
- the relation to change the role for.roles
- the list of roles
IllegalArgumentException
- for null parameters
RelationServiceNotRegisteredException
- when the relation service
has not been registered with an MBeanServer
RelationNotFoundException
- when the relation does not exist in
the relation service.public Map getReferencedMBeans(String relationId) throws IllegalArgumentException, RelationNotFoundException
relationId
- the relation id
IllegalArgumentException
- for a null relation id.
RelationNotFoundException
- when the relation id does not
exist.public String getRelationTypeName(String relationId) throws IllegalArgumentException, RelationNotFoundException
relationId
- the relation id
IllegalArgumentException
- for a null relation id.
RelationNotFoundException
- when the relation id does not
exist.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |