|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.5.0
javax.management.relation
|
Constructor Summary | |
---|---|
RelationSupport(String theRelId,
ObjectName theRelServiceName,
MBeanServer theRelServiceMBeanServer,
String theRelTypeName,
RoleList theRoleList)
Creates object. |
|
RelationSupport(String theRelId,
ObjectName theRelServiceName,
String theRelTypeName,
RoleList theRoleList)
Creates object. |
Method Summary | |
---|---|
RoleResult |
getAllRoles()
Returns all roles present in the relation. |
Map |
getReferencedMBeans()
Retrieves MBeans referenced in the various roles of the relation. |
String |
getRelationId()
Returns relation identifier (used to uniquely identify the relation inside the Relation Service). |
ObjectName |
getRelationServiceName()
Returns ObjectName of the Relation Service handling the relation. |
String |
getRelationTypeName()
Returns name of associated relation type. |
List |
getRole(String theRoleName)
Retrieves role value for given role name. |
Integer |
getRoleCardinality(String theRoleName)
Returns the number of MBeans currently referenced in the given role. |
RoleResult |
getRoles(String[] theRoleNameArray)
Retrieves values of roles with given names. |
void |
handleMBeanUnregistration(ObjectName theObjName,
String theRoleName)
Callback used by the Relation Service when a MBean referenced in a role is unregistered. |
Boolean |
isInRelationService()
Returns an internal flag specifying if the object is still handled by the Relation Service. |
void |
postDeregister()
Allows the MBean to perform any operations needed after having been unregistered in the MBean server. |
void |
postRegister(Boolean registrationDone)
Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. |
void |
preDeregister()
Allows the MBean to perform any operations it needs before being unregistered by the MBean server. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Allows the MBean to perform any operations it needs before being registered in the MBean server. |
RoleList |
retrieveAllRoles()
Returns all roles in the relation without checking read mode. |
void |
setRelationServiceManagementFlag(Boolean theFlg)
Specifies whether this relation is handled by the Relation Service. |
void |
setRole(Role theRole)
Sets the given role. |
RoleResult |
setRoles(RoleList theRoleList)
Sets the given roles. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RelationSupport(String theRelId, ObjectName theRelServiceName, String theRelTypeName, RoleList theRoleList) throws InvalidRoleValueException, IllegalArgumentException
This constructor has to be used when the RelationSupport object will be registered as a MBean by the user, or when creating a user relation MBean those class extends RelationSupport.
Nothing is done at the Relation Service level, i.e. the RelationSupport object is not added, and no check if the provided values are correct. The object is always created, EXCEPT if:
- one mandatory parameter is not provided
- the same name is used for two roles.
To be handled as a relation, the object has then to be added in the Relation Service using Relation Service method addRelation().
theRelId
- relation identifier, to identify the relation in the
Relation Service.
Expected to be unique in the given Relation Service.
theRelServiceName
- ObjectName of the Relation Service where
the relation will be registered.
It is required as this is the Relation Service that is aware of the definition of the relation type of given relation, so that will be able to check update operations (set).
theRelTypeName
- Name of relation type.
Expected to have been created in given Relation Service.
theRoleList
- list of roles (Role objects) to initialised the
relation. Can be null.
Expected to conform to relation info in associated relation type.
InvalidRoleValueException
- if the same name is used for two
roles.
IllegalArgumentException
- if a required value (Relation
Service Object Name, etc.) is not provided as parameter.public RelationSupport(String theRelId, ObjectName theRelServiceName, MBeanServer theRelServiceMBeanServer, String theRelTypeName, RoleList theRoleList) throws InvalidRoleValueException, IllegalArgumentException
This constructor has to be used when the user relation MBean implements the interfaces expected to be supported by a relation by delegating to a RelationSupport object.
This object needs to know the Relation Service expected to handle the relation. So it has to know the MBean Server where the Relation Service is registered.
According to a limitation, a relation MBean must be registered in the same MBean Server as the Relation Service expected to handle it. So the user relation MBean has to be created and registered, and then the wrapped RelationSupport object can be created with identified MBean Server.
Nothing is done at the Relation Service level, i.e. the RelationSupport object is not added, and no check if the provided values are correct. The object is always created, EXCEPT if:
- one required parameter is not provided
- the same name is used for two roles.
To be handled as a relation, the object has then to be added in the Relation Service using the Relation Service method addRelation().
theRelId
- relation identifier, to identify the relation in the
Relation Service.
Expected to be unique in the given Relation Service.
theRelServiceName
- ObjectName of the Relation Service where
the relation will be registered.
It is required as this is the Relation Service that is aware of the definition of the relation type of given relation, so that will be able to check update operations (set).
theRelServiceMBeanServer
- MBean Server where the wrapping MBean
is or will be registered.
Expected to be the MBean Server where the Relation Service is or will be registered.
theRelTypeName
- Name of relation type.
Expected to have been created in given Relation Service.
theRoleList
- list of roles (Role objects) to initialised the
relation. Can be null.
Expected to conform to relation info in associated relation type.
InvalidRoleValueException
- if the same name is used for two
roles.
IllegalArgumentException
- if a required value (Relation
Service Object Name, etc.) is not provided as parameter.Method Detail |
---|
public List getRole(String theRoleName) throws IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException
Checks if the role exists and is readable according to the relation type.
theRoleName
- name of role
IllegalArgumentException
- if null role name
RoleNotFoundException
- if:
- there is no role with given name
- the role is not readable.
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServersetRole(javax.management.relation.Role)
public RoleResult getRoles(String[] theRoleNameArray) throws IllegalArgumentException, RelationServiceNotRegisteredException
Checks for each role if it exists and is readable according to the relation type.
theRoleNameArray
- array of names of roles to be retrieved
IllegalArgumentException
- if null role name
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean ServersetRoles(javax.management.relation.RoleList)
public RoleResult getAllRoles() throws RelationServiceNotRegisteredException
getAllRoles
in interface Relation
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean Serverpublic RoleList retrieveAllRoles()
retrieveAllRoles
in interface Relation
public Integer getRoleCardinality(String theRoleName) throws IllegalArgumentException, RoleNotFoundException
getRoleCardinality
in interface Relation
theRoleName
- name of role
IllegalArgumentException
- if null role name
RoleNotFoundException
- if there is no role with given namepublic void setRole(Role theRole) throws IllegalArgumentException, RoleNotFoundException, RelationTypeNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationNotFoundException
Will check the role according to its corresponding role definition provided in relation's relation type
Will send a notification (RelationNotification with type RELATION_BASIC_UPDATE or RELATION_MBEAN_UPDATE, depending if the relation is a MBean or not).
theRole
- role to be set (name and new value)
IllegalArgumentException
- if null role
RoleNotFoundException
- if the role is not writable (no
test on the write access mode performed when initialising the role)
InvalidRoleValueException
- if value provided for
role is not valid, i.e.:
- 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
- a MBean provided for that role does not exist
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean Server
RelationTypeNotFoundException
- if the relation type has not
been declared in the Relation Service
RelationNotFoundException
- if the relation has not been
added in the Relation Service.getRole(java.lang.String)
public RoleResult setRoles(RoleList theRoleList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
Will check the role according to its corresponding role definition provided in relation's relation type
Will send one notification (RelationNotification with type RELATION_BASIC_UPDATE or RELATION_MBEAN_UPDATE, depending if the relation is a MBean or not) per updated role.
theRoleList
- list of roles to be set
IllegalArgumentException
- if null role name
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean Server
RelationTypeNotFoundException
- if the relation type has not
been declared in the Relation Service.
RelationNotFoundException
- if the relation MBean has not been
added in the Relation Service.getRoles(java.lang.String[])
public void handleMBeanUnregistration(ObjectName theObjName, String theRoleName) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
The Relation Service will call this method to let the relation take action to reflect the impact of such unregistration.
BEWARE. the user is not expected to call this method.
Current implementation is to set the role with its current value (list of ObjectNames of referenced MBeans) without the unregistered one.
handleMBeanUnregistration
in interface Relation
theObjName
- ObjectName of unregistered MBeantheRoleName
- name of role where the MBean is referenced
IllegalArgumentException
- if null parameter
RoleNotFoundException
- if role does not exist in the
relation or is not writable
InvalidRoleValueException
- if role value does not conform to
the associated role info (this will never happen when called from the
Relation Service)
RelationServiceNotRegisteredException
- if the Relation
Service is not registered in the MBean Server
RelationTypeNotFoundException
- if the relation type has not
been declared in the Relation Service.
RelationNotFoundException
- if this method is called for a
relation MBean not added in the Relation Service.public Map getReferencedMBeans()
getReferencedMBeans
in interface Relation
ObjectName -> ArrayList of String (role names)
public String getRelationTypeName()
getRelationTypeName
in interface Relation
public ObjectName getRelationServiceName()
getRelationServiceName
in interface Relation
public String getRelationId()
getRelationId
in interface Relation
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
MBeanRegistration
preRegister
in interface MBeanRegistration
server
- The MBean server in which the MBean will be registered.name
- The object name of the MBean. This name is null if
the name parameter to one of the createMBean
or
registerMBean
methods in the MBeanServer
interface is null. In that case, this method must return a
non-null ObjectName for the new MBean.
name
parameter is not null, it will usually but not necessarily be
the returned value.
Exception
- This exception will be caught by
the MBean server and re-thrown as an MBeanRegistrationException
.public void postRegister(Boolean registrationDone)
MBeanRegistration
postRegister
in interface MBeanRegistration
registrationDone
- Indicates whether or not the MBean has
been successfully registered in the MBean server. The value
false means that the registration phase has failed.public void preDeregister() throws Exception
MBeanRegistration
preDeregister
in interface MBeanRegistration
Exception
- This exception will be caught by
the MBean server and re-thrown as an MBeanRegistrationException
.public void postDeregister()
MBeanRegistration
postDeregister
in interface MBeanRegistration
public Boolean isInRelationService()
isInRelationService
in interface RelationSupportMBean
Boolean.TRUE
if the object
is still handled by the Relation Service and Boolean.FALSE
otherwise.public void setRelationServiceManagementFlag(Boolean theFlg) throws IllegalArgumentException
RelationSupportMBean
Specifies whether this relation is handled by the Relation Service.
BEWARE, this method has to be exposed as the Relation Service will access the relation through its management interface. It is RECOMMENDED NOT to use this method. Using it does not affect the registration of the relation object in the Relation Service, but will provide wrong information about it!
setRelationServiceManagementFlag
in interface RelationSupportMBean
theFlg
- whether the relation is handled by the Relation Service.
IllegalArgumentException
- if null parameter