public interface RelationServiceMBean
Modifier and Type | Method and Description |
---|---|
void |
addRelation(ObjectName relationObjectName)
Adds an MBean created by the user (and registered by him in the MBean
Server) as a relation in the Relation Service.
|
void |
addRelationType(RelationType relationTypeObj)
Adds given object as a relation type.
|
Integer |
checkRoleReading(String roleName,
String relationTypeName)
Checks if given Role can be read in a relation of the given type.
|
Integer |
checkRoleWriting(Role role,
String relationTypeName,
Boolean initFlag)
Checks if given Role can be set in a relation of given type.
|
void |
createRelation(String relationId,
String relationTypeName,
RoleList roleList)
Creates a simple relation (represented by a RelationSupport object) of
given relation type, and adds it in the Relation Service.
|
void |
createRelationType(String relationTypeName,
RoleInfo[] roleInfoArray)
Creates a relation type (RelationTypeSupport object) with given
role infos (provided by the RoleInfo objects), and adds it in the
Relation Service.
|
Map<ObjectName,List<String>> |
findAssociatedMBeans(ObjectName mbeanName,
String relationTypeName,
String roleName)
Retrieves the MBeans associated to given one in a relation.
|
Map<String,List<String>> |
findReferencingRelations(ObjectName mbeanName,
String relationTypeName,
String roleName)
Retrieves the relations where a given MBean is referenced.
|
List<String> |
findRelationsOfType(String relationTypeName)
Returns the relation ids for relations of the given type.
|
List<String> |
getAllRelationIds()
Returns all the relation ids for all the relations handled by the
Relation Service.
|
List<String> |
getAllRelationTypeNames()
Retrieves names of all known relation types.
|
RoleResult |
getAllRoles(String relationId)
Returns all roles present in the relation.
|
boolean |
getPurgeFlag()
Returns the flag to indicate if when a notification is received for the
unregistration of an MBean referenced in a relation, if an immediate
"purge" of the relations (look for the relations no longer valid)
has to be performed, or if that will be performed only when the
purgeRelations method is explicitly called.
|
Map<ObjectName,List<String>> |
getReferencedMBeans(String relationId)
Retrieves MBeans referenced in the various roles of the relation.
|
String |
getRelationTypeName(String relationId)
Returns name of associated relation type for given relation.
|
List<ObjectName> |
getRole(String relationId,
String roleName)
Retrieves role value for given role name in given relation.
|
Integer |
getRoleCardinality(String relationId,
String roleName)
Retrieves the number of MBeans currently referenced in the
given role.
|
RoleInfo |
getRoleInfo(String relationTypeName,
String roleInfoName)
Retrieves role info for given role of a given relation type.
|
List<RoleInfo> |
getRoleInfos(String relationTypeName)
Retrieves list of role infos (RoleInfo objects) of a given relation
type.
|
RoleResult |
getRoles(String relationId,
String[] roleNameArray)
Retrieves values of roles with given names in given relation.
|
Boolean |
hasRelation(String relationId)
Checks if there is a relation identified in Relation Service with given
relation id.
|
void |
isActive()
Checks if the Relation Service is active.
|
String |
isRelation(ObjectName objectName)
Returns the relation id associated to the given ObjectName if the
MBean has been added as a relation in the Relation Service.
|
ObjectName |
isRelationMBean(String relationId)
If the relation is represented by an MBean (created by the user and
added as a relation in the Relation Service), returns the ObjectName of
the MBean.
|
void |
purgeRelations()
Purges the relations.
|
void |
removeRelation(String relationId)
Removes given relation from the Relation Service.
|
void |
removeRelationType(String relationTypeName)
Removes given relation type from Relation Service.
|
void |
sendRelationCreationNotification(String relationId)
Sends a notification (RelationNotification) for a relation creation.
|
void |
sendRelationRemovalNotification(String relationId,
List<ObjectName> unregMBeanList)
Sends a notification (RelationNotification) for a relation removal.
|
void |
sendRoleUpdateNotification(String relationId,
Role newRole,
List<ObjectName> oldRoleValue)
Sends a notification (RelationNotification) for a role update in the
given relation.
|
void |
setPurgeFlag(boolean purgeFlag)
Sets the flag to indicate if when a notification is received for the
unregistration of an MBean referenced in a relation, if an immediate
"purge" of the relations (look for the relations no longer valid)
has to be performed, or if that will be performed only when the
purgeRelations method is explicitly called.
|
void |
setRole(String relationId,
Role role)
Sets the given role in given relation.
|
RoleResult |
setRoles(String relationId,
RoleList roleList)
Sets the given roles in given relation.
|
void |
updateRoleMap(String relationId,
Role newRole,
List<ObjectName> oldRoleValue)
Handles update of the Relation Service role map for the update of given
role in given relation.
|
void isActive() throws RelationServiceNotRegisteredException
RelationServiceNotRegisteredException
- if it is not
registeredboolean getPurgeFlag()
true is immediate purge.
setPurgeFlag(boolean)
void setPurgeFlag(boolean purgeFlag)
true is immediate purge.
purgeFlag
- flaggetPurgeFlag()
void createRelationType(String relationTypeName, RoleInfo[] roleInfoArray) throws IllegalArgumentException, InvalidRelationTypeException
IllegalArgumentException
- if null parameterInvalidRelationTypeException
- If:
- there is already a relation type with that name
- the same name has been used for two different role infos
- no role info provided
- one null role info provided
relationTypeName
- name of the relation typeroleInfoArray
- array of role infosvoid addRelationType(RelationType relationTypeObj) throws IllegalArgumentException, InvalidRelationTypeException
IllegalArgumentException
- if null parameter or if
relationTypeObj.getRelationTypeName()
returns null.InvalidRelationTypeException
- if there is already a relation
type with that namerelationTypeObj
- relation type object (implementing the
RelationType interface)List<String> getAllRelationTypeNames()
List<RoleInfo> getRoleInfos(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException
IllegalArgumentException
- if null parameterRelationTypeNotFoundException
- if there is no relation type
with that name.relationTypeName
- name of relation typeRoleInfo getRoleInfo(String relationTypeName, String roleInfoName) throws IllegalArgumentException, RelationTypeNotFoundException, RoleInfoNotFoundException
IllegalArgumentException
- if null parameterRelationTypeNotFoundException
- if the relation type is not
known in the Relation ServiceRoleInfoNotFoundException
- if the role is not part of the
relation type.relationTypeName
- name of relation typeroleInfoName
- name of rolevoid removeRelationType(String relationTypeName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationTypeNotFoundException
The relation objects of that type will be removed from the Relation Service.
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerIllegalArgumentException
- if null parameterRelationTypeNotFoundException
- If there is no relation type
with that namerelationTypeName
- name of the relation type to be removedvoid createRelation(String relationId, String relationTypeName, RoleList roleList) throws RelationServiceNotRegisteredException, IllegalArgumentException, RoleNotFoundException, InvalidRelationIdException, RelationTypeNotFoundException, InvalidRoleValueException
Roles are initialized according to the role list provided in parameter. The ones not initialized in this way are set to an empty ArrayList of ObjectNames.
A RelationNotification, with type RELATION_BASIC_CREATION, is sent.
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerIllegalArgumentException
- if null parameterRoleNotFoundException
- if a value is provided for a role
that does not exist in the relation typeInvalidRelationIdException
- if relation id already usedRelationTypeNotFoundException
- if relation type not known in
Relation ServiceInvalidRoleValueException
- if:
- the same role name is used for two different roles
- the number of referenced MBeans in given value is less than expected minimum degree
- the number of referenced MBeans in provided value exceeds expected maximum degree
- one referenced MBean in the value is not an Object of the MBean class expected for that role
- an MBean provided for that role does not exist
relationId
- relation identifier, to identify uniquely the relation
inside the Relation ServicerelationTypeName
- name of the relation type (has to be created
in the Relation Service)roleList
- role list to initialize roles of the relation (can
be null).void addRelation(ObjectName relationObjectName) throws IllegalArgumentException, RelationServiceNotRegisteredException, NoSuchMethodException, InvalidRelationIdException, InstanceNotFoundException, InvalidRelationServiceException, RelationTypeNotFoundException, RoleNotFoundException, InvalidRoleValueException
To be added as a relation, the MBean must conform to the following:
- implement the Relation interface
- have for RelationService ObjectName the ObjectName of current Relation Service
- have a relation id that is unique and unused in current Relation Service
- have for relation type a relation type created in the Relation Service
- have roles conforming to the role info provided in the relation type.
IllegalArgumentException
- if null parameterRelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerNoSuchMethodException
- If the MBean does not implement the
Relation interfaceInvalidRelationIdException
- if:
- no relation identifier in MBean
- the relation identifier is already used in the Relation Service
InstanceNotFoundException
- if the MBean for given ObjectName
has not been registeredInvalidRelationServiceException
- if:
- no Relation Service name in MBean
- the Relation Service name in the MBean is not the one of the current Relation Service
RelationTypeNotFoundException
- if:
- no relation type name in MBean
- the relation type name in MBean does not correspond to a relation type created in the Relation Service
InvalidRoleValueException
- if:
- the number of referenced MBeans in a role is less than expected minimum degree
- the number of referenced MBeans in a role exceeds expected maximum degree
- one referenced MBean in the value is not an Object of the MBean class expected for that role
- an MBean provided for a role does not exist
RoleNotFoundException
- if a value is provided for a role
that does not exist in the relation typerelationObjectName
- ObjectName of the relation MBean to be added.ObjectName isRelationMBean(String relationId) throws IllegalArgumentException, RelationNotFoundException
IllegalArgumentException
- if null parameterRelationNotFoundException
- there is no relation associated
to that idrelationId
- relation id identifying the relationString isRelation(ObjectName objectName) throws IllegalArgumentException
IllegalArgumentException
- if null parameterobjectName
- ObjectName of supposed relationBoolean hasRelation(String relationId) throws IllegalArgumentException
IllegalArgumentException
- if null parameterrelationId
- relation id identifying the relationList<String> getAllRelationIds()
Integer checkRoleReading(String roleName, String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException
IllegalArgumentException
- if null parameterRelationTypeNotFoundException
- if the relation type is not
known in the Relation ServiceroleName
- name of role to be checkedrelationTypeName
- name of the relation type- 0 if role can be read
- integer corresponding to RoleStatus.NO_ROLE_WITH_NAME
- integer corresponding to RoleStatus.ROLE_NOT_READABLE
Integer checkRoleWriting(Role role, String relationTypeName, Boolean initFlag) throws IllegalArgumentException, RelationTypeNotFoundException
IllegalArgumentException
- if null parameterRelationTypeNotFoundException
- if unknown relation typerole
- role to be checkedrelationTypeName
- name of relation typeinitFlag
- flag to specify that the checking is done for the
initialization of a role, write access shall not be verified.- 0 if role can be set
- integer corresponding to RoleStatus.NO_ROLE_WITH_NAME
- integer for RoleStatus.ROLE_NOT_WRITABLE
- integer for RoleStatus.LESS_THAN_MIN_ROLE_DEGREE
- integer for RoleStatus.MORE_THAN_MAX_ROLE_DEGREE
- integer for RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS
- integer for RoleStatus.REF_MBEAN_NOT_REGISTERED
void sendRelationCreationNotification(String relationId) throws IllegalArgumentException, RelationNotFoundException
- RelationNotification.RELATION_BASIC_CREATION if the relation is an object internal to the Relation Service
- RelationNotification.RELATION_MBEAN_CREATION if the relation is a MBean added as a relation.
The source object is the Relation Service itself.
It is called in Relation Service createRelation() and addRelation() methods.
IllegalArgumentException
- if null parameterRelationNotFoundException
- if there is no relation for given
relation idrelationId
- relation identifier of the updated relationvoid sendRoleUpdateNotification(String relationId, Role newRole, List<ObjectName> oldRoleValue) throws IllegalArgumentException, RelationNotFoundException
- RelationNotification.RELATION_BASIC_UPDATE if the relation is an object internal to the Relation Service
- RelationNotification.RELATION_MBEAN_UPDATE if the relation is a MBean added as a relation.
The source object is the Relation Service itself.
It is called in relation MBean setRole() (for given role) and setRoles() (for each role) methods (implementation provided in RelationSupport class).
It is also called in Relation Service setRole() (for given role) and setRoles() (for each role) methods.
IllegalArgumentException
- if null parameterRelationNotFoundException
- if there is no relation for given
relation idrelationId
- relation identifier of the updated relationnewRole
- new role (name and new value)oldRoleValue
- old role value (List of ObjectName objects)void sendRelationRemovalNotification(String relationId, List<ObjectName> unregMBeanList) throws IllegalArgumentException, RelationNotFoundException
- RelationNotification.RELATION_BASIC_REMOVAL if the relation is an object internal to the Relation Service
- RelationNotification.RELATION_MBEAN_REMOVAL if the relation is a MBean added as a relation.
The source object is the Relation Service itself.
It is called in Relation Service removeRelation() method.
IllegalArgumentException
- if null parameterRelationNotFoundException
- if there is no relation for given
relation idrelationId
- relation identifier of the updated relationunregMBeanList
- List of ObjectNames of MBeans expected
to be unregistered due to relation removal (can be null)void updateRoleMap(String relationId, Role newRole, List<ObjectName> oldRoleValue) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException
It is called in relation MBean setRole() (for given role) and setRoles() (for each role) methods (implementation provided in RelationSupport class).
It is also called in Relation Service setRole() (for given role) and setRoles() (for each role) methods.
To allow the Relation Service to maintain the consistency (in case of MBean unregistration) and to be able to perform queries, this method must be called when a role is updated.
IllegalArgumentException
- if null parameterRelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerRelationNotFoundException
- if no relation for given id.relationId
- relation identifier of the updated relationnewRole
- new role (name and new value)oldRoleValue
- old role value (List of ObjectName objects)void removeRelation(String relationId) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException
A RelationNotification notification is sent, its type being:
- RelationNotification.RELATION_BASIC_REMOVAL if the relation was only internal to the Relation Service
- RelationNotification.RELATION_MBEAN_REMOVAL if the relation is registered as an MBean.
For MBeans referenced in such relation, nothing will be done,
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerIllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation corresponding to
given relation idrelationId
- relation id of the relation to be removedvoid purgeRelations() throws RelationServiceNotRegisteredException
Depending on the purgeFlag value, this method is either called automatically when a notification is received for the unregistration of an MBean referenced in a relation (if the flag is set to true), or not (if the flag is set to false).
In that case it is up to the user to call it to maintain the consistency of the relations. To be kept in mind that if an MBean is unregistered and the purge not done immediately, if the ObjectName is reused and assigned to another MBean referenced in a relation, calling manually this purgeRelations() method will cause trouble, as will consider the ObjectName as corresponding to the unregistered MBean, not seeing the new one.
The behavior depends on the cardinality of the role where the unregistered MBean is referenced:
- if removing one MBean reference in the role makes its number of references less than the minimum degree, the relation has to be removed.
- if the remaining number of references after removing the MBean reference is still in the cardinality range, keep the relation and update it calling its handleMBeanUnregistration() callback.
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean Server.Map<String,List<String>> findReferencingRelations(ObjectName mbeanName, String relationTypeName, String roleName) throws IllegalArgumentException
This corresponds to the CIM "References" and "ReferenceNames" operations.
IllegalArgumentException
- if null parametermbeanName
- ObjectName of MBeanrelationTypeName
- can be null; if specified, only the relations
of that type will be considered in the search. Else all relation types
are considered.roleName
- can be null; if specified, only the relations
where the MBean is referenced in that role will be returned. Else all
roles are considered.Map<ObjectName,List<String>> findAssociatedMBeans(ObjectName mbeanName, String relationTypeName, String roleName) throws IllegalArgumentException
This corresponds to CIM Associators and AssociatorNames operations.
IllegalArgumentException
- if null parametermbeanName
- ObjectName of MBeanrelationTypeName
- can be null; if specified, only the relations
of that type will be considered in the search. Else all
relation types are considered.roleName
- can be null; if specified, only the relations
where the MBean is referenced in that role will be considered. Else all
roles are considered.List<String> findRelationsOfType(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException
IllegalArgumentException
- if null parameterRelationTypeNotFoundException
- if there is no relation type
with that name.relationTypeName
- relation type nameList<ObjectName> getRole(String relationId, String roleName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException
RelationServiceNotRegisteredException
- if the Relation
Service is not registeredIllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation with given idRoleNotFoundException
- if:
- there is no role with given name
or
- the role is not readable.
relationId
- relation idroleName
- name of rolesetRole(java.lang.String, javax.management.relation.Role)
RoleResult getRoles(String relationId, String[] roleNameArray) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerIllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation with given idrelationId
- relation idroleNameArray
- array of names of roles to be retrievedsetRoles(java.lang.String, javax.management.relation.RoleList)
RoleResult getAllRoles(String relationId) throws IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException
IllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation for given idRelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerrelationId
- relation idInteger getRoleCardinality(String relationId, String roleName) throws IllegalArgumentException, RelationNotFoundException, RoleNotFoundException
IllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation with given idRoleNotFoundException
- if there is no role with given namerelationId
- relation idroleName
- name of rolevoid setRole(String relationId, Role role) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException, InvalidRoleValueException, RelationTypeNotFoundException
Will check the role according to its corresponding role definition provided in relation's relation type
The Relation Service will keep track of the change to keep the consistency of relations by handling referenced MBean deregistrations.
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerIllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation with given idRoleNotFoundException
- if:
- internal relation
and
- the role does not exist or is not writable
InvalidRoleValueException
- if internal relation and value
provided for role is not valid:
- the number of referenced MBeans in given value is less than expected minimum degree
or
- the number of referenced MBeans in provided value exceeds expected maximum degree
or
- one referenced MBean in the value is not an Object of the MBean class expected for that role
or
- an MBean provided for that role does not exist
RelationTypeNotFoundException
- if unknown relation typerelationId
- relation idrole
- role to be set (name and new value)getRole(java.lang.String, java.lang.String)
RoleResult setRoles(String relationId, RoleList roleList) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException
Will check the role according to its corresponding role definition provided in relation's relation type
The Relation Service keeps track of the changes to keep the consistency of relations by handling referenced MBean deregistrations.
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServerIllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation with given idrelationId
- relation idroleList
- list of roles to be setgetRoles(java.lang.String, java.lang.String[])
Map<ObjectName,List<String>> getReferencedMBeans(String relationId) throws IllegalArgumentException, RelationNotFoundException
IllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation for given
relation idrelationId
- relation idObjectName -> ArrayList of String (role names)
String getRelationTypeName(String relationId) throws IllegalArgumentException, RelationNotFoundException
IllegalArgumentException
- if null parameterRelationNotFoundException
- if no relation for given
relation idrelationId
- relation idaicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.