|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.management.NotificationBroadcasterSupport | +--javax.management.relation.RelationService
An MBean that maintains the consistency of all relation types and all relation instances within a JMX agent. It provides query operations to fins related and associated mbeans and their roles in the relation.
Constructor Summary | |
---|---|
RelationService(boolean purgeFlag)
constructor |
Method Summary | |
---|---|
void |
addRelation(ObjectName relationMBeanObjectName)
Add relation of a class that extends RelationSupport, is an external relation and can only be created with this method createRelation() is for internal relations only |
void |
addRelationType(RelationType relationType)
|
java.lang.Integer |
checkRoleReading(java.lang.String roleName,
java.lang.String relationTypeName)
|
java.lang.Integer |
checkRoleWriting(Role role,
java.lang.String relationTypeName,
java.lang.Boolean isInitialized)
|
void |
createRelation(java.lang.String relationId,
java.lang.String relationTypeName,
RoleList roleList)
|
void |
createRelationType(java.lang.String relationTypeName,
RoleInfo[] roleInfos)
|
java.util.Map |
findAssociatedMBeans(ObjectName mbeanObjectName,
java.lang.String relationTypeName,
java.lang.String roleName)
|
java.util.Map |
findReferencingRelations(ObjectName mbeanObjectName,
java.lang.String relationTypeName,
java.lang.String roleName)
|
java.util.List |
findRelationsOfType(java.lang.String relationTypeName)
|
java.util.List |
getAllRelationIds()
|
java.util.List |
getAllRelationTypeNames()
|
RoleResult |
getAllRoles(java.lang.String relationId)
|
MBeanNotificationInfo[] |
getNotificationInfo()
Implement to return more info regarding Notification Types |
boolean |
getPurgeFlag()
|
java.util.Map |
getReferencedMBeans(java.lang.String relationId)
|
java.lang.String |
getRelationTypeName(java.lang.String relationId)
|
java.util.List |
getRole(java.lang.String relationId,
java.lang.String roleName)
|
java.lang.Integer |
getRoleCardinality(java.lang.String relationId,
java.lang.String roleName)
|
RoleInfo |
getRoleInfo(java.lang.String relationTypeName,
java.lang.String roleInfoName)
|
java.util.List |
getRoleInfos(java.lang.String relationTypeName)
|
RoleResult |
getRoles(java.lang.String relationId,
java.lang.String[] roleNames)
|
void |
handleNotification(Notification notification,
java.lang.Object handback)
Called when a notification occurs. |
java.lang.Boolean |
hasRelation(java.lang.String relationId)
|
void |
isActive()
|
java.lang.String |
isRelation(ObjectName objectName)
|
ObjectName |
isRelationMBean(java.lang.String relationId)
|
void |
postDeregister()
Called upon after the MBean has been de-registered. |
void |
postRegister(java.lang.Boolean registrationDone)
Called upon after a registration ( successful or not ). |
void |
preDeregister()
Called upon before an MBean will be de-registered by
the MBeanServer . |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Allows the MBean to perform any operations before being registered to the MBeanServer . |
void |
purgeRelations()
|
void |
removeRelation(java.lang.String relationId)
|
void |
removeRelationType(java.lang.String relationTypeName)
|
void |
sendRelationCreationNotification(java.lang.String relationId)
|
void |
sendRelationRemovalNotification(java.lang.String relationId,
java.util.List unregisteredMBeanList)
|
void |
sendRoleUpdateNotification(java.lang.String relationId,
Role newRole,
java.util.List oldRoleValues)
|
void |
setPurgeFlag(boolean purgeFlag)
|
void |
setRole(java.lang.String relationId,
Role role)
|
RoleResult |
setRoles(java.lang.String relationId,
RoleList roleList)
|
void |
updateRoleMap(java.lang.String relationId,
Role role,
java.util.List oldRoleValues)
Handles update of the RelationService role map for the update of given roles in a given relation |
Methods inherited from class javax.management.NotificationBroadcasterSupport |
---|
addNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RelationService(boolean purgeFlag)
purgeFlag
- - this is a flag, if true indicates an immediate update of relations is to be done when a
notification is recieved for the unregistration of an MBean referenced in a relation
- if false update of relations must be performed explicitly by calling purgeRelations()purgeRelations()
Method Detail |
public void isActive() throws RelationServiceNotRegisteredException
isActive
in interface RelationServiceMBean
RelationServiceNotRegisteredException
- - thrown if the RelationService is not registered in the MBeanServer
Currently this class must be registered in the MBeanServer before any relations can be created or added
public boolean getPurgeFlag()
getPurgeFlag
in interface RelationServiceMBean
purgeRelations()
public void setPurgeFlag(boolean purgeFlag)
setPurgeFlag
in interface RelationServiceMBean
purgeFlag
- - a flag that when set to true indicates to the RelationService
that it must update all relations
when it recieves a unregistration notification
if false this will not occur and purgeRelations must be called explicitlypublic void createRelationType(java.lang.String relationTypeName, RoleInfo[] roleInfos) throws java.lang.IllegalArgumentException, InvalidRelationTypeException
createRelationType
in interface RelationServiceMBean
relationTypeName
- - a string giving relations a type name this must be a unique nameroleInfo[]
- - an array of RoleInfo objects.
Which are used to define the roles a relation plays a part in. It defines attributes
such as cardinality, role reading and writing...
The RelationService will then use these RoleInfo to maintain the relationjava.lang.IllegalArgumentException
- thrown if any of the parameters are nullInvalidRelationTypeException
- thrown if the role name, contained in the RoleInfo, already exists.
This method creates a relationType (a RelationTypeSupport Object) from the parameters passed in.
The RelationTypeSupport represents an internal relation
public void addRelationType(RelationType relationType) throws java.lang.IllegalArgumentException, InvalidRelationTypeException
addRelationType
in interface RelationServiceMBean
relationType
- - an Object implementing the RelationType interface a utility implementation is provided by the
RelationTypeSupport
classjava.lang.IllegalArgumentException
- if a null RelationType is passed in as a parameter or if that RelationType has no RoleInfo definedInvalidRelationTypeException
- if the RoleInfo obtained from the RelationType is
- empty
- null
- the RoleName is already in use
This method makes an externally defined relation type available through the relationService
The RelationType is immutable, hence the returned values should never change while the relationType is registered with the realtion service
public java.util.List getAllRelationTypeNames()
getAllRelationTypeNames
in interface RelationServiceMBean
public java.util.List getRoleInfos(java.lang.String relationTypeName) throws java.lang.IllegalArgumentException, RelationTypeNotFoundException
getRoleInfos
in interface RelationServiceMBean
relationTypeName
- the string name representation of this RelationTypejava.lang.IllegalArgumentException
- if the relationTypeName is nullRelationTypeNotFoundException
- if the Relationtype for the given relationTypeName is not foundpublic RoleInfo getRoleInfo(java.lang.String relationTypeName, java.lang.String roleInfoName) throws java.lang.IllegalArgumentException, RelationTypeNotFoundException, RoleInfoNotFoundException
getRoleInfo
in interface RelationServiceMBean
relationTypeName
- string name representing the RelationTyperoleInfoName
- string name representing the RoleInfo objectjava.lang.IllegalArgumentException
- if either the relationtypeName or the roleInfoName is nullRelationTypeNotFoundException
- if the RelationType is not in the realtion serviceRoleInfoNotFoundException
- if the RoleInfo has not been foundpublic void removeRelationType(java.lang.String relationTypeName) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException
removeRelationType
in interface RelationServiceMBean
relationTypeName
- a string name representing the Relationtype Objectjava.lang.IllegalArgumentException
- if the relationTypeName is nullRelationServiceNotRegisteredException
- if the RelationService has not been registered in the MBeanServerRelationTypeNotFoundException
- if the RelationType has not been found
This method removes a RelationType, it's name(represented by the relationTypeName) and any relationIds associated with it, and all MBeans referenced in it's roles
Note: this will not remove any mbeans registered with the MBeanServer this must be done if required via the MBeanServer. Any Mbeans registered with the MBean server will continue to be accessed via the MBeanServer, they will no longer be able to be referenced, queried via the relation service though.
public void createRelation(java.lang.String relationId, java.lang.String relationTypeName, RoleList roleList) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, RoleNotFoundException, InvalidRelationIdException, RelationTypeNotFoundException, InvalidRoleValueException
createRelation
in interface RelationServiceMBean
relationId
- the id through which this relation is referencedrelationTypeName
- a unique name for the RelationTyperoleList
- a list of roles to be associated with this relationjava.lang.IllegalArgumentException
- - if the relationId, or relationTypeName is nullRelationServiceNotRegisteredException
- - if the relationService has not been registered in the MBeanServerRoleNotFoundException
- - if a role defined in the RoleList is null or emptyInvalidRelationIdException
- if the relationId is already in use.RelationTypeNotFoundException
- InvalidRoleValueException
- - if cardinality is not correct i.e min cardinality is greater than max cardinality
According to the RI spec this method is used only to create internal relations - hence creates an InternalRelation
This creates a relation represented by a RelationSupport Object, and a RelationNotification, with type RELATION_BASIC_CREATION, is sent
public void addRelation(ObjectName relationMBeanObjectName) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, java.lang.NoSuchMethodException, InvalidRelationIdException, InstanceNotFoundException, InvalidRelationServiceException, RelationTypeNotFoundException, RoleNotFoundException, InvalidRoleValueException
addRelation
in interface RelationServiceMBean
public ObjectName isRelationMBean(java.lang.String relationId) throws java.lang.IllegalArgumentException, RelationNotFoundException
isRelationMBean
in interface RelationServiceMBean
public java.lang.String isRelation(ObjectName objectName) throws java.lang.IllegalArgumentException
isRelation
in interface RelationServiceMBean
public java.lang.Boolean hasRelation(java.lang.String relationId) throws java.lang.IllegalArgumentException
hasRelation
in interface RelationServiceMBean
public java.util.List getAllRelationIds()
getAllRelationIds
in interface RelationServiceMBean
public java.lang.Integer checkRoleReading(java.lang.String roleName, java.lang.String relationTypeName) throws java.lang.IllegalArgumentException, RelationTypeNotFoundException
checkRoleReading
in interface RelationServiceMBean
public java.lang.Integer checkRoleWriting(Role role, java.lang.String relationTypeName, java.lang.Boolean isInitialized) throws java.lang.IllegalArgumentException, RelationTypeNotFoundException
checkRoleWriting
in interface RelationServiceMBean
public void sendRelationCreationNotification(java.lang.String relationId) throws java.lang.IllegalArgumentException, RelationNotFoundException
sendRelationCreationNotification
in interface RelationServiceMBean
public void sendRoleUpdateNotification(java.lang.String relationId, Role newRole, java.util.List oldRoleValues) throws java.lang.IllegalArgumentException, RelationNotFoundException
sendRoleUpdateNotification
in interface RelationServiceMBean
public void sendRelationRemovalNotification(java.lang.String relationId, java.util.List unregisteredMBeanList) throws java.lang.IllegalArgumentException, RelationNotFoundException
sendRelationRemovalNotification
in interface RelationServiceMBean
public void updateRoleMap(java.lang.String relationId, Role role, java.util.List oldRoleValues) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException
updateRoleMap
in interface RelationServiceMBean
public void removeRelation(java.lang.String relationId) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException
removeRelation
in interface RelationServiceMBean
public void purgeRelations() throws RelationServiceNotRegisteredException
purgeRelations
in interface RelationServiceMBean
public java.util.Map findReferencingRelations(ObjectName mbeanObjectName, java.lang.String relationTypeName, java.lang.String roleName) throws java.lang.IllegalArgumentException
findReferencingRelations
in interface RelationServiceMBean
public java.util.Map findAssociatedMBeans(ObjectName mbeanObjectName, java.lang.String relationTypeName, java.lang.String roleName) throws java.lang.IllegalArgumentException
findAssociatedMBeans
in interface RelationServiceMBean
public java.util.List findRelationsOfType(java.lang.String relationTypeName) throws java.lang.IllegalArgumentException, RelationTypeNotFoundException
findRelationsOfType
in interface RelationServiceMBean
public java.util.List getRole(java.lang.String relationId, java.lang.String roleName) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException, RoleNotFoundException
getRole
in interface RelationServiceMBean
public RoleResult getRoles(java.lang.String relationId, java.lang.String[] roleNames) throws java.lang.IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException
getRoles
in interface RelationServiceMBean
public RoleResult getAllRoles(java.lang.String relationId) throws java.lang.IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException
getAllRoles
in interface RelationServiceMBean
public java.lang.Integer getRoleCardinality(java.lang.String relationId, java.lang.String roleName) throws java.lang.IllegalArgumentException, RelationNotFoundException, RoleNotFoundException
getRoleCardinality
in interface RelationServiceMBean
public void setRole(java.lang.String relationId, Role role) throws java.lang.IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException, RoleNotFoundException, InvalidRoleValueException, RelationTypeNotFoundException
setRole
in interface RelationServiceMBean
public RoleResult setRoles(java.lang.String relationId, RoleList roleList) throws RelationServiceNotRegisteredException, java.lang.IllegalArgumentException, RelationNotFoundException
setRoles
in interface RelationServiceMBean
public java.util.Map getReferencedMBeans(java.lang.String relationId) throws java.lang.IllegalArgumentException, RelationNotFoundException
getReferencedMBeans
in interface RelationServiceMBean
public java.lang.String getRelationTypeName(java.lang.String relationId) throws java.lang.IllegalArgumentException, RelationNotFoundException
getRelationTypeName
in interface RelationServiceMBean
public void handleNotification(Notification notification, java.lang.Object handback)
NotificationListener
handleNotification
in interface NotificationListener
javax.management.NotificationListener
notification
- The notification objecthandback
- Helps in associating information regarding the listener.public MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo
in class NotificationBroadcasterSupport
javax.management.NotificationBroadcaster
public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception
MBeanRegistration
MBeanServer
.
Any exception will cause the MBean not being registered.
preRegister
in interface MBeanRegistration
javax.management.MBeanRegistration
server
- The MBeanServer on which the MBean will be registered.name
- The ObjectName
of the MBean.java.lang.Exception
- Exception of the operation. Note that this is caught
by the MBeanServer
and re-thrown as an
MBeanRegistrationException
.public void postRegister(java.lang.Boolean registrationDone)
MBeanRegistration
postRegister
in interface MBeanRegistration
javax.management.MBeanRegistration
registrationDone
- Evaluates to true of the registrations
is successful, false otherwise.public void preDeregister() throws java.lang.Exception
MBeanRegistration
MBean
will be de-registered by
the MBeanServer
.preDeregister
in interface MBeanRegistration
javax.management.MBeanRegistration
java.lang.Exception
- Would be caught by the MBeanServer
and rethrown as an MBeanRegistrationException.public void postDeregister()
MBeanRegistration
postDeregister
in interface MBeanRegistration
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |