- 所有已实现的接口:
-
EventListener,MBeanRegistration,NotificationBroadcaster,NotificationEmitter,NotificationListener,RelationServiceMBean
它通过扩展NotificationBroadcasterSupport实现NotificationBroadcaster,以便在关系从中删除时发送通知。
它实现了NotificationListener接口,以便能够接收有关在关系角色中引用的MBeans注销以及关系MBeans注销的通知。
它实现了MBeanRegistration接口,以便能够检索其ObjectName和MBean Server。
- 自:
- 1.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRelation(ObjectName relationObjectName) 将用户创建的(并由用户在MBean Server中注册)的MBean作为关系添加到关系服务中。voidaddRelationType(RelationType relationTypeObj) 将给定对象作为关系类型添加。checkRoleReading(String roleName, String relationTypeName) 检查给定类型的关系中是否可以读取给定角色。checkRoleWriting(Role role, String relationTypeName, Boolean initFlag) 检查给定类型的关系中是否可以设置给定角色。voidcreateRelation(String relationId, String relationTypeName, RoleList roleList) 创建给定关系类型的简单关系(由RelationSupport对象表示),并将其添加到关系服务中。voidcreateRelationType(String relationTypeName, RoleInfo[] roleInfoArray) 使用给定角色信息(由RoleInfo对象提供)创建关系类型(RelationTypeSupport对象),并将其添加到关系服务中。findAssociatedMBeans(ObjectName mbeanName, String relationTypeName, String roleName) 检索与给定关系中的给定MBean相关联的MBeans。findReferencingRelations(ObjectName mbeanName, String relationTypeName, String roleName) 检索引用给定MBean的关系。findRelationsOfType(String relationTypeName) 返回给定类型的关系的关系ID。返回由关系服务处理的所有关系的所有关系ID。检索所有已知关系类型的名称。getAllRoles(String relationId) 返回关系中存在的所有角色。返回包含通知的Java类的名称和发送的通知类型的NotificationInfo对象。boolean返回标志,指示是否在接收到有关在关系中引用的MBean注销的通知时,是否需要立即执行关系的“清除”(查找不再有效的关系),或者仅在显式调用purgeRelations方法时才执行。getReferencedMBeans(String relationId) 检索关系中各种角色中引用的MBeans。getRelationTypeName(String relationId) 返回给定关系的关联关系类型的名称。检索给定关系中给定角色名称的角色值。getRoleCardinality(String relationId, String roleName) 检索当前在给定角色中引用的MBeans数量。getRoleInfo(String relationTypeName, String roleInfoName) 检索给定关系类型的给定角色名称的角色信息。getRoleInfos(String relationTypeName) 检索给定关系类型的角色信息(RoleInfo对象)列表。检索给定关系中给定名称的角色的值。voidhandleNotification(Notification notif, Object handback) 在发生JMX通知时调用。hasRelation(String relationId) 检查关系服务中是否有具有给定关系ID的关系。voidisActive()检查关系服务是否处于活动状态。isRelation(ObjectName objectName) 如果MBean已添加为关系服务中的关系,则返回与给定ObjectName关联的关系ID。isRelationMBean(String relationId) 如果关系由MBean表示(由用户创建并添加为关系服务中的关系),则返回MBean的ObjectName。void允许MBean在从MBean服务器中注销后执行所需的任何操作。voidpostRegister(Boolean registrationDone) 允许MBean在在MBean服务器中注册后或注册失败后执行所需的任何操作。void允许MBean在被MBean服务器注销之前执行所需的任何操作。preRegister(MBeanServer server, ObjectName name) 允许MBean在被MBean服务器注册之前执行所需的任何操作。void清除关系。voidremoveRelation(String relationId) 从关系服务中删除给定关系。voidremoveRelationType(String relationTypeName) 从关系服务中删除给定关系类型。voidsendRelationCreationNotification(String relationId) 为关系创建发送通知(RelationNotification)。voidsendRelationRemovalNotification(String relationId, List<ObjectName> unregMBeanList) 为关系删除发送通知(RelationNotification)。voidsendRoleUpdateNotification(String relationId, Role newRole, List<ObjectName> oldValue) 为给定关系中的角色更新发送通知(RelationNotification)。voidsetPurgeFlag(boolean purgeFlag) 设置标志,指示在接收到有关在关系中引用的MBean注销的通知时,是否需要立即执行关系的“清除”(查找不再有效的关系),或者仅在显式调用purgeRelations方法时才执行。void在给定关系中设置给定角色。在给定关系中设置给定角色。voidupdateRoleMap(String relationId, Role newRole, List<ObjectName> oldValue) 处理给定关系中给定角色更新的关系服务角色映射的更新。Methods declared in class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
-
Constructor Details
-
RelationService
public RelationService(boolean immediatePurgeFlag) 构造函数。- 参数:
-
immediatePurgeFlag- 标志,指示在接收到有关在关系中引用的MBean注销的通知时,是否需要立即执行关系的“清除”(查找不再有效的关系),或者仅在显式调用purgeRelations方法时才执行。true表示立即清除。
-
-
Method Details
-
isActive
检查关系服务是否处于活动状态。当前条件是关系服务必须在MBean Server中注册。- 指定者:
-
isActive在接口RelationServiceMBean - 抛出:
-
RelationServiceNotRegisteredException- 如果未注册
-
preRegister
从接口复制的描述:MBeanRegistration允许MBean在被MBean服务器注册之前执行所需的任何操作。如果未指定MBean的名称,则MBean可以为其注册提供名称。如果引发任何异常,则MBean将不会在MBean服务器中注册。- 指定者:
-
preRegister在接口MBeanRegistration - 参数:
-
server- MBean将在其中注册的MBean服务器。 -
name- MBean的对象名称。如果在createMBean或registerMBean方法之一的MBeanServer接口中的名称参数为null,则此名称为null。在这种情况下,此方法必须为新MBean返回非null的ObjectName。 - 返回:
-
MBean将要注册的名称。此值不得为null。如果
name参数不为null,则通常但不一定会是返回的值。 - 抛出:
-
Exception- 此异常将被MBean服务器捕获并重新抛出为MBeanRegistrationException。
-
postRegister
从接口复制的描述:MBeanRegistration允许MBean在被MBean服务器注册后或注册失败后执行所需的任何操作。如果此方法的实现引发
RuntimeException或Error,则MBean服务器将在RuntimeMBeanException或RuntimeErrorException中重新抛出这些异常。但是,在postRegister中引发异常不会更改MBean的状态:如果MBean已经注册(registrationDone为true),则MBean将保持注册状态。对于调用
createMBean()或registerMBean()的代码可能会感到困惑,因为这样的代码可能会假定当引发此类异常时MBean注册失败。因此,建议postRegister的实现尽量避免抛出运行时异常或错误。- 指定者:
-
postRegister在接口MBeanRegistration - 参数:
-
registrationDone- 指示MBean是否已成功在MBean服务器中注册。值为false表示注册阶段失败。
-
preDeregister
从接口复制的描述:MBeanRegistration允许MBean在被MBean服务器注销之前执行所需的任何操作。- 指定者:
-
preDeregister在接口MBeanRegistration中 - 抛出:
-
Exception- 此异常将被MBean服务器捕获并重新抛出为一个MBeanRegistrationException。
-
postDeregister
public void postDeregister()从接口复制的描述:MBeanRegistration允许MBean在从MBean服务器中注销后执行任何所需的操作。如果此方法的实现引发了一个
RuntimeException或一个Error,MBean服务器将在一个RuntimeMBeanException或RuntimeErrorException中重新抛出它们。然而,在postDeregister中抛出异常不会改变MBean的状态:MBean已经成功注销并将保持这种状态。对于调用
unregisterMBean()的代码可能会感到困惑,因为它可能会假定MBean的注销失败。因此,建议postDeregister的实现尽量避免抛出运行时异常或错误。- 指定者:
-
postDeregister在接口MBeanRegistration中
-
getPurgeFlag
public boolean getPurgeFlag()返回一个标志,指示当接收到关系中引用的MBean注销的通知时,是否需要立即执行关系的“清除”操作(查找不再有效的关系),或者只有在显式调用purgeRelations方法时才执行。true表示立即清除。
- 指定者:
-
getPurgeFlag在接口RelationServiceMBean中 - 返回:
- 如果自动清除,则为true。
- 参见:
-
setPurgeFlag
public void setPurgeFlag(boolean purgeFlag) 设置一个标志,指示当接收到关系中引用的MBean注销的通知时,是否需要立即执行关系的“清除”操作(查找不再有效的关系),或者只有在显式调用purgeRelations方法时才执行。true表示立即清除。
- 指定者:
-
setPurgeFlag在接口RelationServiceMBean中 - 参数:
-
purgeFlag- 标志 - 参见:
-
createRelationType
public void createRelationType(String relationTypeName, RoleInfo[] roleInfoArray) throws IllegalArgumentException, InvalidRelationTypeException 使用给定的角色信息(由RoleInfo对象提供)创建一个关系类型(RelationTypeSupport对象),并将其添加到关系服务中。- 指定者:
-
createRelationType在接口RelationServiceMBean中 - 参数:
-
relationTypeName- 关系类型的名称 -
roleInfoArray- 角色信息数组 - 抛出:
-
IllegalArgumentException- 如果参数为null -
InvalidRelationTypeException- 如果:- 已经存在具有该名称的关系类型
- 同一名称已用于两个不同的角色信息
- 未提供角色信息
- 提供了一个空的角色信息
-
addRelationType
public void addRelationType(RelationType relationTypeObj) throws IllegalArgumentException, InvalidRelationTypeException 将给定对象添加为关系类型。预期该对象实现RelationType接口。- 指定者:
-
addRelationType在接口RelationServiceMBean中 - 参数:
-
relationTypeObj- 关系类型对象(实现RelationType接口) - 抛出:
-
IllegalArgumentException- 如果参数为null或如果relationTypeObj.getRelationTypeName()返回null。 -
InvalidRelationTypeException- 如果:- 同一名称已用于两个不同的角色
- 未提供角色信息
- 提供了一个空的角色信息
- 已经存在具有该名称的关系类型
-
getAllRelationTypeNames
检索所有已知关系类型的名称。- 指定者:
-
getAllRelationTypeNames在接口RelationServiceMBean中 - 返回:
- 关系类型名称(字符串)的ArrayList
-
getRoleInfos
public List<RoleInfo> getRoleInfos(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException 检索给定关系类型的所有角色信息(RoleInfo对象)的列表。- 指定者:
-
getRoleInfos在接口RelationServiceMBean中 - 参数:
-
relationTypeName- 关系类型的名称 - 返回:
- RoleInfo对象的ArrayList。
- 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationTypeNotFoundException- 如果没有具有该名称的关系类型。
-
getRoleInfo
public RoleInfo getRoleInfo(String relationTypeName, String roleInfoName) throws IllegalArgumentException, RelationTypeNotFoundException, RoleInfoNotFoundException 检索给定关系类型的给定角色名称的角色信息。- 指定者:
-
getRoleInfo在接口RelationServiceMBean中 - 参数:
-
relationTypeName- 关系类型的名称 -
roleInfoName- 角色的名称 - 返回:
- RoleInfo对象。
- 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationTypeNotFoundException- 如果关系类型在关系服务中未知 -
RoleInfoNotFoundException- 如果该角色不是关系类型的一部分。
-
removeRelationType
public void removeRelationType(String relationTypeName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationTypeNotFoundException 从关系服务中删除给定的关系类型。该类型的关系对象将从关系服务中移除。
- 指定者:
-
removeRelationType在接口RelationServiceMBean中 - 参数:
-
relationTypeName- 要移除的关系类型的名称 - 抛出:
-
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册 -
IllegalArgumentException- 如果参数为null -
RelationTypeNotFoundException- 如果没有具有该名称的关系类型
-
createRelation
public void createRelation(String relationId, String relationTypeName, RoleList roleList) throws RelationServiceNotRegisteredException, IllegalArgumentException, RoleNotFoundException, InvalidRelationIdException, RelationTypeNotFoundException, InvalidRoleValueException 创建给定关系类型的简单关系(由RelationSupport对象表示),并将其添加到关系服务中。根据参数中提供的角色列表初始化角色。未以这种方式初始化的角色将设置为一个空的ObjectName ArrayList。
将发送一个关系通知,类型为RELATION_BASIC_CREATION。
- 指定者:
-
createRelation在接口RelationServiceMBean中 - 参数:
-
relationId- 关系标识符,用于在关系服务内唯一标识关系 -
relationTypeName- 关系类型的名称(必须在关系服务中创建) -
roleList- 用于初始化关系角色的角色列表(可以为null)。 - 抛出:
-
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册 -
IllegalArgumentException- 如果参数为null,除了角色列表可以为null(如果没有角色初始化) -
RoleNotFoundException- 如果为不存在于关系类型中的角色提供了值 -
InvalidRelationIdException- 如果关系标识符已被使用 -
RelationTypeNotFoundException- 如果关系类型在关系服务中未知 -
InvalidRoleValueException- 如果:- 为两个不同角色使用相同角色名称
- 在给定值中引用的MBean数量少于预期的最小度数
- 在提供的值中引用的MBean数量超过预期的最大度数
- 值中的一个引用的MBean不是该角色期望的MBean类的对象
- 为该角色提供的MBean不存在
-
addRelation
public void addRelation(ObjectName relationObjectName) throws IllegalArgumentException, RelationServiceNotRegisteredException, NoSuchMethodException, InvalidRelationIdException, InstanceNotFoundException, InvalidRelationServiceException, RelationTypeNotFoundException, RoleNotFoundException, InvalidRoleValueException 将用户创建的MBean(并由用户在MBean服务器中注册)作为关系添加到关系服务中。要作为关系添加,MBean必须符合以下条件:
- 实现Relation接口
- 具有当前关系服务ObjectName的RelationService
- 具有在关系服务中唯一且未使用的关系标识符
- 具有在关系服务中创建的关系类型的关系类型
- 具有符合关系类型中提供的角色信息的角色
- 指定者:
-
addRelation在接口RelationServiceMBean中 - 参数:
-
relationObjectName- 要添加的关系MBean的ObjectName。 - 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册 -
NoSuchMethodException- 如果MBean未实现Relation接口 -
InvalidRelationIdException- 如果:- MBean中没有关系标识符
- 关系标识符已在关系服务中使用
-
InstanceNotFoundException- 如果给定ObjectName的MBean尚未注册 -
InvalidRelationServiceException- 如果:- MBean中没有关系服务名称
- MBean中的关系服务名称与当前关系服务的名称不同
-
RelationTypeNotFoundException- 如果:- MBean中没有关系类型名称
- MBean中的关系类型名称与在关系服务中创建的关系类型不对应
-
InvalidRoleValueException- 如果:- 在角色中引用的MBean数量少于预期的最小度数
- 在角色中引用的MBean数量超过预期的最大度数
- 值中的一个引用的MBean不是该角色期望的MBean类的对象
- 为角色提供的MBean不存在
-
RoleNotFoundException- 如果为不存在于关系类型中的角色提供了值
-
isRelationMBean
public ObjectName isRelationMBean(String relationId) throws IllegalArgumentException, RelationNotFoundException 如果关系由用户创建的MBean(并作为关系添加到关系服务中)表示,则返回MBean的ObjectName。- 指定者:
-
isRelationMBean在接口RelationServiceMBean中 - 参数:
-
relationId- 标识关系的关系id - 返回:
- 对应关系MBean的ObjectName,如果关系不是MBean则返回null。
- 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationNotFoundException- 没有与该id关联的关系
-
isRelation
如果MBean已作为关系添加到关系服务中,则返回与给定ObjectName关联的关系id。- 指定者:
-
isRelation在接口RelationServiceMBean中 - 参数:
-
objectName- 所谓关系的ObjectName - 返回:
- 关系id(String)或null(如果ObjectName不是关系服务处理的关系)
- 抛出:
-
IllegalArgumentException- 如果参数为null
-
hasRelation
检查关系服务中是否存在具有给定关系id的关系。- 指定者:
-
hasRelation在接口RelationServiceMBean中 - 参数:
-
relationId- 标识关系的关系id - 返回:
- 布尔值:如果存在关系则为true,否则为false
- 抛出:
-
IllegalArgumentException- 如果参数为null
-
getAllRelationIds
返回关系服务处理的所有关系的所有关系id。- 指定者:
-
getAllRelationIds在接口RelationServiceMBean中 - 返回:
- String的ArrayList
-
checkRoleReading
public Integer checkRoleReading(String roleName, String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException 检查给定类型的关系中是否可以读取给定角色。- 指定者:
-
checkRoleReading在接口RelationServiceMBean中 - 参数:
-
roleName- 要检查的角色名称 -
relationTypeName- 关系类型的名称 - 返回:
-
包装整数的Integer,对应于RoleUnresolved中表示的可能问题的整数常量:
- 如果角色可以读取则为0
- 对应于RoleStatus.NO_ROLE_WITH_NAME的整数
- 对应于RoleStatus.ROLE_NOT_READABLE的整数
- 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationTypeNotFoundException- 如果关系类型在关系服务中未知
-
checkRoleWriting
public Integer checkRoleWriting(Role role, String relationTypeName, Boolean initFlag) throws IllegalArgumentException, RelationTypeNotFoundException 检查给定类型的关系中是否可以设置给定角色。- 指定者:
-
checkRoleWriting在接口RelationServiceMBean中 - 参数:
-
role- 要检查的角色 -
relationTypeName- 关系类型的名称 -
initFlag- 用于指定检查是否用于角色的初始化,写访问权限不应该被验证。 - 返回值:
-
一个包装整数的整数,对应于RoleUnresolved中表示的可能问题的常量:
- 如果可以设置角色,则为0
- 对应于RoleStatus.NO_ROLE_WITH_NAME的整数
- 对应于RoleStatus.ROLE_NOT_WRITABLE的整数
- 对应于RoleStatus.LESS_THAN_MIN_ROLE_DEGREE的整数
- 对应于RoleStatus.MORE_THAN_MAX_ROLE_DEGREE的整数
- 对应于RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS的整数
- 对应于RoleStatus.REF_MBEAN_NOT_REGISTERED的整数
- 抛出:
-
IllegalArgumentException- 如果参数为空 -
RelationTypeNotFoundException- 如果关系类型未知
-
sendRelationCreationNotification
public void sendRelationCreationNotification(String relationId) throws IllegalArgumentException, RelationNotFoundException 发送关系创建的通知(RelationNotification)。通知类型为:- 如果关系是Relation Service内部对象,则为RelationNotification.RELATION_BASIC_CREATION
- 如果关系是作为关系添加的MBean,则为RelationNotification.RELATION_MBEAN_CREATION
源对象是Relation Service本身。
在Relation Service的createRelation()和addRelation()方法中调用。
- 指定者:
-
sendRelationCreationNotification在接口RelationServiceMBean中 - 参数:
-
relationId- 更新的关系的关系标识符 - 抛出:
-
IllegalArgumentException- 如果参数为空 -
RelationNotFoundException- 如果给定关系标识符没有关系
-
sendRoleUpdateNotification
public void sendRoleUpdateNotification(String relationId, Role newRole, List<ObjectName> oldValue) throws IllegalArgumentException, RelationNotFoundException 发送给定关系中角色更新的通知(RelationNotification)。通知类型为:- 如果关系是Relation Service内部对象,则为RelationNotification.RELATION_BASIC_UPDATE
- 如果关系是作为关系添加的MBean,则为RelationNotification.RELATION_MBEAN_UPDATE
源对象是Relation Service本身。
在关系MBean的setRole()(对于给定角色)和setRoles()(对于每个角色)方法中调用(在RelationSupport类中提供实现)。
还在Relation Service的setRole()(对于给定角色)和setRoles()(对于每个角色)方法中调用。
- 指定者:
-
sendRoleUpdateNotification在接口RelationServiceMBean中 - 参数:
-
relationId- 更新的关系的关系标识符 -
newRole- 新角色(名称和新值) -
oldValue- 旧角色值(ObjectName对象的列表) - 抛出:
-
IllegalArgumentException- 如果参数为空 -
RelationNotFoundException- 如果给定关系标识符没有关系
-
sendRelationRemovalNotification
public void sendRelationRemovalNotification(String relationId, List<ObjectName> unregMBeanList) throws IllegalArgumentException, RelationNotFoundException 发送关系移除的通知(RelationNotification)。通知类型为:- 如果关系是Relation Service内部对象,则为RelationNotification.RELATION_BASIC_REMOVAL
- 如果关系是作为关系添加的MBean,则为RelationNotification.RELATION_MBEAN_REMOVAL
源对象是Relation Service本身。
在Relation Service的removeRelation()方法中调用。
- 指定者:
-
sendRelationRemovalNotification在接口RelationServiceMBean中 - 参数:
-
relationId- 更新的关系的关系标识符 -
unregMBeanList- 预期由于关系移除而取消注册的MBean的ObjectName列表(可以为null) - 抛出:
-
IllegalArgumentException- 如果参数为空 -
RelationNotFoundException- 如果给定关系标识符没有关系
-
updateRoleMap
public void updateRoleMap(String relationId, Role newRole, List<ObjectName> oldValue) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException 处理给定关系中给定角色更新的Relation Service角色映射更新。在关系MBean的setRole()(对于给定角色)和setRoles()(对于每个角色)方法中调用(在RelationSupport类中提供实现)。
还在Relation Service的setRole()(对于给定角色)和setRoles()(对于每个角色)方法中调用。
为了允许Relation Service维护一致性(在MBean取消注册的情况下)并能够执行查询,当更新角色时必须调用此方法。
- 指定者:
-
updateRoleMap在接口RelationServiceMBean中 - 参数:
-
relationId- 更新的关系的关系标识符 -
newRole- 新角色(名称和新值) -
oldValue- 旧角色值(ObjectName对象的列表) - 抛出:
-
IllegalArgumentException- 如果参数为空 -
RelationServiceNotRegisteredException- 如果Relation Service未在MBean Server中注册 -
RelationNotFoundException- 如果给定id没有关系
-
removeRelation
public void removeRelation(String relationId) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException 从Relation Service中移除给定的关系。发送一个RelationNotification通知,其类型为:
- 如果关系仅是Relation Service内部对象,则为RelationNotification.RELATION_BASIC_REMOVAL
- 如果关系已注册为MBean,则为RelationNotification.RELATION_MBEAN_REMOVAL
对于在此类关系中引用的MBean,不会执行任何操作。
- 指定者:
-
removeRelation在接口RelationServiceMBean中 - 参数:
-
relationId- 要移除的关系的关系id - 抛出:
-
RelationServiceNotRegisteredException- 如果Relation Service未在MBean Server中注册 -
IllegalArgumentException- 如果参数为空 -
RelationNotFoundException- 如果没有对应于给定关系id的关系
-
purgeRelations
清除关系。根据purgeFlag值的不同,当接收到关系中引用的MBean取消注册的通知时,此方法将自动调用(如果标志设置为true),或者不会调用(如果标志设置为false)。
在这种情况下,用户需要手动调用此方法以保持关系的一致性。需要记住,如果一个MBean被取消注册并且未立即进行清除,如果ObjectName被重用并分配给另一个在关系中引用的MBean,手动调用此purgeRelations()方法将会导致问题,因为它会将ObjectName视为对应于已取消注册的MBean,而不会看到新的MBean。
行为取决于引用了取消注册MBean的角色的基数:
- 如果从角色中移除一个MBean引用使其引用数少于最小度数,则必须移除关系。
- 如果移除MBean引用后剩余的引用数仍在基数范围内,则保留关系并调用其handleMBeanUnregistration()回调进行更新。
- 指定者:
-
purgeRelations在接口RelationServiceMBean中 - 抛出:
-
RelationServiceNotRegisteredException- 如果Relation Service未在MBean Server中注册
-
findReferencingRelations
public Map<String,List<String>> findReferencingRelations(ObjectName mbeanName, String relationTypeName, String roleName) throws IllegalArgumentException 检索引用给定MBean的关系。这对应于CIM中的“References”和“ReferenceNames”操作。
- 指定者:
-
findReferencingRelations在接口RelationServiceMBean中 - 参数:
-
mbeanName- MBean的ObjectName -
relationTypeName- 可以为null;如果指定,则只考虑该类型的关系进行搜索。否则,考虑所有关系类型。 -
roleName- 可以为null;如果指定,则只返回MBean在该角色中被引用的关系。否则,考虑所有角色。 - 返回:
- 一个HashMap,其中键是MBean被引用的关系的关系ID,值是每个键的角色名称的ArrayList(因为一个MBean可以在同一个关系中被引用多个角色)。
- 抛出:
-
IllegalArgumentException- 如果参数为null
-
findAssociatedMBeans
public Map<ObjectName,List<String>> findAssociatedMBeans(ObjectName mbeanName, String relationTypeName, String roleName) throws IllegalArgumentException 检索与给定关系中的MBean相关联的MBeans。这对应于CIM的Associators和AssociatorNames操作。
- 指定者:
-
findAssociatedMBeans在接口RelationServiceMBean中 - 参数:
-
mbeanName- MBean的ObjectName -
relationTypeName- 可以为null;如果指定,则只考虑该类型的关系进行搜索。否则,考虑所有关系类型。 -
roleName- 可以为null;如果指定,则只考虑MBean在该角色中被引用的关系。否则,考虑所有角色。 - 返回:
- 一个HashMap,其中键是与给定MBean相关联的MBeans的ObjectName,值是每个键的关联到给定MBean的关系的关系ID的ArrayList(因为它们可以在多个不同的关系中相关联)。
- 抛出:
-
IllegalArgumentException- 如果参数为null
-
findRelationsOfType
public List<String> findRelationsOfType(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException 返回给定类型的关系的关系ID。- 指定者:
-
findRelationsOfType在接口RelationServiceMBean中 - 参数:
-
relationTypeName- 关系类型名称 - 返回:
- 一个关系ID的ArrayList。
- 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationTypeNotFoundException- 如果没有该名称的关系类型。
-
getRole
public List<ObjectName> getRole(String relationId, String roleName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException 检索给定关系中给定角色名称的角色值。- 指定者:
-
getRole在接口RelationServiceMBean中 - 参数:
-
relationId- 关系ID -
roleName- 角色名称 - 返回:
- 作为角色值的ObjectName对象的ArrayList
- 抛出:
-
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册 -
IllegalArgumentException- 如果参数为null -
RelationNotFoundException- 如果没有给定ID的关系 -
RoleNotFoundException- 如果:- 没有给定名称的角色
或
- 该角色不可读。
- 参见:
-
getRoles
public RoleResult getRoles(String relationId, String[] roleNameArray) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException 检索给定关系中给定角色名称的角色值。- 指定者:
-
getRoles在接口RelationServiceMBean中 - 参数:
-
relationId- 关系ID -
roleNameArray- 要检索的角色名称数组 - 返回:
- 一个RoleResult对象,包括一个RoleList(成功检索的角色)和一个RoleUnresolvedList(未检索的角色)。
- 抛出:
-
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册 -
IllegalArgumentException- 如果参数为null -
RelationNotFoundException- 如果没有给定ID的关系 - 参见:
-
getAllRoles
public RoleResult getAllRoles(String relationId) throws IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException 返回关系中存在的所有角色。- 指定者:
-
getAllRoles在接口RelationServiceMBean中 - 参数:
-
relationId- 关系ID - 返回:
- 一个RoleResult对象,包括一个RoleList(成功检索的角色)和一个RoleUnresolvedList(不可读的角色)。
- 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationNotFoundException- 如果没有给定ID的关系 -
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册
-
getRoleCardinality
public Integer getRoleCardinality(String relationId, String roleName) throws IllegalArgumentException, RelationNotFoundException, RoleNotFoundException 检索当前在给定角色中引用的MBean数量。- 指定者:
-
getRoleCardinality在接口RelationServiceMBean中 - 参数:
-
relationId- 关系ID -
roleName- 角色名称 - 返回:
- 在该角色中当前引用的MBean数量
- 抛出:
-
IllegalArgumentException- 如果参数为null -
RelationNotFoundException- 如果没有给定ID的关系 -
RoleNotFoundException- 如果没有给定名称的角色
-
setRole
public void setRole(String relationId, Role role) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException, InvalidRoleValueException 在给定关系中设置给定角色。将根据关系类型中提供的相应角色定义检查角色。
关系服务将跟踪更改以保持关系的一致性,通过处理引用的MBean注销。
- 指定者:
-
setRole在接口RelationServiceMBean中 - 参数:
-
relationId- 关系ID -
role- 要设置的角色(名称和新值) - 抛出:
-
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册 -
IllegalArgumentException- 如果参数为null -
RelationNotFoundException- 如果没有给定ID的关系 -
RoleNotFoundException- 如果角色不存在或不可写 -
InvalidRoleValueException- 如果为角色提供的值无效:- 给定值中引用的MBean数量少于预期的最小度
或
- 给定值中引用的MBean数量超过预期的最大度
或
- 值中的一个引用的MBean不是该角色期望的MBean类的对象
或
- 为该角色提供的MBean不存在
- 参见:
-
setRoles
public RoleResult setRoles(String relationId, RoleList roleList) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException 设置给定关系中的给定角色。将根据关系类型中提供的相应角色定义检查角色
关系服务通过处理引用的MBean注销来跟踪更改,以保持关系的一致性。
- 指定者:
-
setRoles在接口RelationServiceMBean - 参数:
-
relationId- 关系ID -
roleList- 要设置的角色列表 - 返回:
- 一个RoleResult对象,包括一个RoleList(成功设置的角色)和一个RoleUnresolvedList(未设置的角色)。
- 抛出:
-
RelationServiceNotRegisteredException- 如果关系服务未在MBean服务器中注册 -
IllegalArgumentException- 如果参数为空 -
RelationNotFoundException- 如果给定ID没有关系 - 参见:
-
getReferencedMBeans
public Map<ObjectName,List<String>> getReferencedMBeans(String relationId) throws IllegalArgumentException, RelationNotFoundException 检索关系中各种角色引用的MBeans。- 指定者:
-
getReferencedMBeans在接口RelationServiceMBean - 参数:
-
relationId- 关系ID - 返回:
-
一个HashMap映射:
ObjectName -> String数组列表(角色名称)
- 抛出:
-
IllegalArgumentException- 如果参数为空 -
RelationNotFoundException- 如果给定关系ID没有关系
-
getRelationTypeName
public String getRelationTypeName(String relationId) throws IllegalArgumentException, RelationNotFoundException 返回给定关系的关联关系类型的名称。- 指定者:
-
getRelationTypeName在接口RelationServiceMBean - 参数:
-
relationId- 关系ID - 返回:
- 关联关系类型的名称。
- 抛出:
-
IllegalArgumentException- 如果参数为空 -
RelationNotFoundException- 如果给定关系ID没有关系
-
handleNotification
在发生JMX通知时调用。目前处理MBeans的注销通知,这些MBeans可以是关系角色中引用的MBeans,也可以是关系本身。- 指定者:
-
handleNotification在接口NotificationListener - 参数:
-
notif- 通知。 -
handback- 一个不透明对象,可帮助侦听器关联有关MBean发射器的信息(可以为null)。
-
getNotificationInfo
返回一个包含通知的Java类的名称和发送的通知类型的NotificationInfo对象。- 指定者:
-
getNotificationInfo在接口NotificationBroadcaster - 返回:
- 可能通知的数组。
-