所有类


javax.management.relation
类 RelationService

java.lang.Object
  继承者 javax.management.NotificationBroadcasterSupport
      继承者 javax.management.relation.RelationService
所有已实现的接口:
EventListener, MBeanRegistration, NotificationBroadcaster, NotificationEmitter, NotificationListener, RelationServiceMBean

public class RelationService
   
   
   
   
   
extends NotificationBroadcasterSupport
implements RelationServiceMBean, MBeanRegistration, NotificationListener

Relation Service 负责创建和删除关系类型和关系,负责处理一致性并负责提供查询机制。

它通过扩展 NotificationBroadcasterSupport 实现 NotificationBroadcaster,以便在从中移除关系时发送通知。

它实现 NotificationListener 接口,以便能够接收有关注销关系角色中引用的 MBean 的通知和注销关系 MBean 的通知。

它实现 MBeanRegistration 接口,以便能够检索其 ObjectName 和 MBean Server。

从以下版本开始:
1.5

构造方法摘要
RelationService(boolean theImmediatePurgeFlg)
          构造方法。
 
方法摘要
 voidaddRelation(ObjectName theRelObjectName)
          作为 Relation Service 中的关系添加由用户创建(且由其在 MBean Server 中注册)的 MBean。
 voidaddRelationType(RelationType theRelTypeObj)
          作为关系类型添加给定的对象。
 IntegercheckRoleReading(String theRoleName, String theRelTypeName)
          检查给定 Role 能否以给定类型的关系进行读取。
 IntegercheckRoleWriting(Role theRole, String theRelTypeName, Boolean theInitFlg)
          检查给定 Role 能否以给定类型的关系进行设置。
 voidcreateRelation(String theRelId, String theRelTypeName, RoleList theRoleList)
          创建给定关系类型的简单关系(由 RelationSupport 对象表示),并将其添加到 Relation Service 中。
 voidcreateRelationType(String theRelTypeName, RoleInfo[] theRoleInfoArray)
          用给定的角色信息(由 RoleInfo 对象提供)创建一个关系类型(RelationTypeSupport 对象),并将其添加到 Relation Service 中。
 MapfindAssociatedMBeans(ObjectName theMBeanName, String theRelTypeName, String theRoleName)
          检索与关系中给定关系相关的 MBean。
 MapfindReferencingRelations(ObjectName theMBeanName, String theRelTypeName, String theRoleName)
          检索在其中引用给定 MBean 的关系。
 ListfindRelationsOfType(String theRelTypeName)
          返回给定类型的关系的关系 id。
 ListgetAllRelationIds()
          返回由 Relation Service 处理的所有关系的所有关系 id。
 ListgetAllRelationTypeNames()
          检索所有已知关系类型的名称。
 RoleResultgetAllRoles(String theRelId)
          返回关系中存在的所有角色。
 MBeanNotificationInfo[]getNotificationInfo()
          返回一个 NotificationInfo 对象,它包含通知的 Java 类的名称和发送的通知类型。
 booleangetPurgeFlag()
          返回一个标志,以指示何时接收注销关系中引用的 MBean 的通知,指示是否必须执行关系的直接“肃清”(查找不再有效的关系),或者是否只在将显式调用 purgeRelations 方法时执行该操作。
 MapgetReferencedMBeans(String theRelId)
          检索关系的各种角色中引用的 MBean。
 StringgetRelationTypeName(String theRelId)
          返回给定关系的相关关系类型的名称。
 ListgetRole(String theRelId, String theRoleName)
          检索给定关系中给定角色名称的角色值。
 IntegergetRoleCardinality(String theRelId, String theRoleName)
          检索给定角色中当前引用的 MBean 数。
 RoleInfogetRoleInfo(String theRelTypeName, String theRoleInfoName)
          检索给定关系类型的给定角色名称的角色信息。
 ListgetRoleInfos(String theRelTypeName)
          检索给定关系类型的角色信息(RoleInfo 对象)的列表。
 RoleResultgetRoles(String theRelId, String[] theRoleNameArray)
          检索给定关系中具有给定名称的角色值。
 voidhandleNotification(Notification theNtf, Object theHandback)
          出现 JMX 通知时调用。
 BooleanhasRelation(String theRelId)
          用给定的关系 id 检查是否存在 Relation Service 中标识的关系。
 voidisActive()
          检查该 Relation Service 是否处于活动状态。
 StringisRelation(ObjectName theObjName)
          如果 Relation Service 中作为关系添加 MBean,则返回与给定 ObjectName 相关的关系 id。
 ObjectNameisRelationMBean(String theRelId)
          如果用 MBean 表示关系(由用户创建且作为 Relation Service 中的关系添加),则返回该 MBean 的 ObjectName。
 voidpostDeregister()
          允许 MBean 在已从 MBean 服务器注销之后执行所需要的任何操作。
 voidpostRegister(Boolean registrationDone)
          允许 MBean 在被注册到 MBean 服务器或注销失败后执行任何所需要的操作。
 voidpreDeregister()
          允许该 MBean 在从 MBean 服务器注销之前执行它所需要的任何操作。
 ObjectNamepreRegister(MBeanServer server, ObjectName name)
          允许 MBean 在被注册到 MBean 服务器之前执行它所需要的任何操作。
 voidpurgeRelations()
          肃清关系。
 voidremoveRelation(String theRelId)
          从 Relation Service 移除给定的关系。
 voidremoveRelationType(String theRelTypeName)
          从 Relation Service 中移除给定的关系类型。
 voidsendRelationCreationNotification(String theRelId)
          发送关系创建通知 (RelationNotification)。
 voidsendRelationRemovalNotification(String theRelId, List theUnregMBeanList)
          发送关系移除通知 (RelationNotification)。
 voidsendRoleUpdateNotification(String theRelId, Role theNewRole, List theOldRoleValue)
          发送给定关系中的角色更新通知 (RelationNotification)。
 voidsetPurgeFlag(boolean thePurgeFlg)
          设置一个标志,以指示注销关系中引用的 MBean 时是否接收到通知,是否必须执行关系的直接“肃清”(查找不再有效的关系),或者是否只在显式调用 purgeRelations 方法时执行该操作。
 voidsetRole(String theRelId, Role theRole)
          设置给定关系中的给定角色。
 RoleResultsetRoles(String theRelId, RoleList theRoleList)
          设置给定关系中的给定角色。
 voidupdateRoleMap(String theRelId, Role theNewRole, List theOldRoleValue)
          针对给定关系中给定角色的更新来处理 Relation Service 角色映射的更新。
 
从类 javax.management.NotificationBroadcasterSupport 继承的方法
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

RelationService

public RelationService(boolean theImmediatePurgeFlg)
构造方法。

参数:
theImmediatePurgeFlg - 指示何时接收到注销关系中引用的 MBean 的通知,指示是否必须执行关系的直接“肃清”(查找不再有效的关系),或者是否只在显式调用 purgeRelations 方法时执行该操作。

true 表示立即肃清。

方法详细信息

isActive

public void isActive()
              throws RelationServiceNotRegisteredException
检查该 Relation Service 是否处于活动状态。当前的条件是,Relation Service 必须在 MBean Server 中注册。

指定者:
接口 RelationServiceMBean 中的 isActive
抛出:
RelationServiceNotRegisteredException - 如果其未注册

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
从接口 MBeanRegistration 复制的描述
允许 MBean 在被注册到 MBean 服务器之前执行它所需要的任何操作。如果未指定 MBean 的名称,则该 MBean 可以提供一个注册名称。如果引发任何异常,则该 MBean 不会被注册到 MBean 服务器中。

指定者:
接口 MBeanRegistration 中的 preRegister
参数:
server - 将要在其中注册该 MBean 的 MBean 服务器。
name - 该 MBean 的对象名。如果 MBeanServer 接口中的某个 createMBean 方法或 registerMBean 方法的 name 参数为 null,则此 name 也为 null。在这种情况下,此方法必须为新 MBean 返回非 null 的 ObjectName。
返回:
MBean 要被注册的名称。此值必须不为 null。如果 name 参数不为 null,则它通常但并非一定为返回值。
抛出:
Exception - MBean 服务器会捕捉此异常并以 MBeanRegistrationException 的形式重新抛出。

postRegister

public void postRegister(Boolean registrationDone)
从接口 MBeanRegistration 复制的描述
允许 MBean 在被注册到 MBean 服务器或注销失败后执行任何所需要的操作。

指定者:
接口 MBeanRegistration 中的 postRegister
参数:
registrationDone - 指示该 MBean 是否已在 MBean 服务器中成功注册。false 值意味着注册阶段已失败。

preDeregister

public void preDeregister()
                   throws Exception
从接口 MBeanRegistration 复制的描述
允许该 MBean 在从 MBean 服务器注销之前执行它所需要的任何操作。

指定者:
接口 MBeanRegistration 中的 preDeregister
抛出:
Exception - MBean 服务器会捕捉此异常并以 MBeanRegistrationException 的形式重新抛出。

postDeregister

public void postDeregister()
从接口 MBeanRegistration 复制的描述
允许 MBean 在已从 MBean 服务器注销之后执行所需要的任何操作。

指定者:
接口 MBeanRegistration 中的 postDeregister

getPurgeFlag

public boolean getPurgeFlag()
返回一个标志,以指示何时接收注销关系中引用的 MBean 的通知,指示是否必须执行关系的直接“肃清”(查找不再有效的关系),或者是否只在将显式调用 purgeRelations 方法时执行该操作。

true 表示立即肃清。

指定者:
接口 RelationServiceMBean 中的 getPurgeFlag
返回:
如果肃清是自动进行的,则返回 true。
另请参见:
setPurgeFlag(boolean)

setPurgeFlag

public void setPurgeFlag(boolean thePurgeFlg)
设置一个标志,以指示注销关系中引用的 MBean 时是否接收到通知,是否必须执行关系的直接“肃清”(查找不再有效的关系),或者是否只在显式调用 purgeRelations 方法时执行该操作。

true 表示立即肃清。

指定者:
接口 RelationServiceMBean 中的 setPurgeFlag
参数:
thePurgeFlg - 标志
另请参见:
getPurgeFlag()