Java Doc for RelationService.java in  » JMX » mx4j » javax » management » relation » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » mx4j » javax.management.relation 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.management.NotificationBroadcasterSupport
      javax.management.relation.RelationService

RelationService
public class RelationService extends NotificationBroadcasterSupport implements RelationServiceMBean,MBeanRegistration,NotificationListener(Code)
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.

Inner Class :final class InternalRelation extends RelationSupport


Constructor Summary
public  RelationService(boolean purgeFlag)
    

Method Summary
public  voidaddRelation(ObjectName relationMBeanObjectName)
    
public  voidaddRelationType(RelationType relationType)
    
public  IntegercheckRoleReading(String roleName, String relationTypeName)
    
public  IntegercheckRoleWriting(Role role, String relationTypeName, Boolean isInitialized)
    
public  voidcreateRelation(String relationId, String relationTypeName, RoleList roleList)
    
public  voidcreateRelationType(String relationTypeName, RoleInfo[] roleInfos)
    
Parameters:
  relationTypeName - - a string giving relations a type name this must be a unique name
Parameters:
  roleInfos - - an array of RoleInfo objects.Which are used to define the roles a relation plays a part in.
public  MapfindAssociatedMBeans(ObjectName mbeanObjectName, String relationTypeName, String roleName)
    

Retrieves the MBeans associated to given one in a relation.


Parameters:
  mbeanObjectName - - ObjectName of MBean
Parameters:
  relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search.
public  MapfindReferencingRelations(ObjectName mbeanObjectName, String relationTypeName, String roleName)
    

Retrieves the relations where a given MBean is referenced.


Parameters:
  mbeanObjectName - - ObjectName of MBean
Parameters:
  relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search.
public  ListfindRelationsOfType(String relationTypeName)
    

Returns the relation ids for relations of the given type.

public  ListgetAllRelationIds()
    
public  ListgetAllRelationTypeNames()
    
public  RoleResultgetAllRoles(String relationId)
    
public  MBeanNotificationInfo[]getNotificationInfo()
    
public  booleangetPurgeFlag()
    
public  MapgetReferencedMBeans(String relationId)
    
public  StringgetRelationTypeName(String relationId)
    
public  ListgetRole(String relationId, String roleName)
    
public  IntegergetRoleCardinality(String relationId, String roleName)
    
public  RoleInfogetRoleInfo(String relationTypeName, String roleInfoName)
    
public  ListgetRoleInfos(String relationTypeName)
    
public  RoleResultgetRoles(String relationId, String[] roleNames)
    
public  voidhandleNotification(Notification notification, Object handback)
    

Invoked when a JMX notification occurs.

public  BooleanhasRelation(String relationId)
    
public  voidisActive()
    
public  StringisRelation(ObjectName objectName)
    
public  ObjectNameisRelationMBean(String relationId)
    
public  voidpostDeregister()
    
public  voidpostRegister(Boolean registrationDone)
    
public  voidpreDeregister()
    

Allows the MBean to perform any operations it needs before being unregistered by the MBean server.

public  ObjectNamepreRegister(MBeanServer server, ObjectName name)
    

Implementation of interface MBeanRegistration @see MBeanRegistration

Allows the MBean to perform any operations it needs before being registered in the MBean server.

public  voidpurgeRelations()
    

Purges the relations

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.

public  voidremoveRelation(String relationId)
    
public  voidremoveRelationType(String relationTypeName)
    
public  voidsendRelationCreationNotification(String relationId)
    

Sends a notification (RelationNotification) for a relation creation.

public  voidsendRelationRemovalNotification(String relationId, List unregisteredMBeanList)
    

Sends a notification (RelationNotification) for a relation removal.

public  voidsendRoleUpdateNotification(String relationId, Role newRole, List oldRoleValues)
    

Sends a notification (RelationNotification) for a role update in the given relation.

public  voidsetPurgeFlag(boolean purgeFlag)
    
public  voidsetRole(String relationId, Role role)
    
public  RoleResultsetRoles(String relationId, RoleList roleList)
    
static  voidthrowRoleProblemException(int problemType, String roleName)
    
public  voidupdateRoleMap(String relationId, Role role, List oldRoleValues)
    

Handles update of the Relation Service role map for the update of given role in given relation

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.



Constructor Detail
RelationService
public RelationService(boolean purgeFlag)(Code)
constructor
Parameters:
  purgeFlag - - this is a flag, if true indicates an immediate update of relations is to be done when anotification is recieved for the unregistration of an MBean referenced in a relation- if false update of relations must be performed explicitly by calling purgeRelations()
See Also:   RelationService.purgeRelations




Method Detail
addRelation
public void addRelation(ObjectName relationMBeanObjectName) throws IllegalArgumentException, RelationServiceNotRegisteredException, NoSuchMethodException, InvalidRelationIdException, InstanceNotFoundException, InvalidRelationServiceException, RelationTypeNotFoundException, RoleNotFoundException, InvalidRoleValueException(Code)

Parameters:
  relationMBeanObjectName - - ObjectName of the relation MBean to be added
throws:
  IllegalArgumentException - - if parameter is null
throws:
  RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server
throws:
  NoSuchMethodException - - If the MBean does not implement the Relation interface
throws:
  InvalidRelationIdException - - if there is no relation identifier (ID) in the MBean- if relation identifier (ID) is already used in the Relation Service
throws:
  InstanceNotFoundException - - if the MBean for given ObjectName has not been registered
throws:
  InvalidRelationServiceException - - if no Relation Service name in MBean- if the Relation Service name in the MBean is not the one of the current Relation Service
throws:
  RelationTypeNotFoundException - - if no relation type name in MBean- if the relation type name in MBean does not correspond to a relation type created in the Relation Service
throws:
  RoleNotFoundException - - if a value is provided for a role that does not exist in the relation type
throws:
  InvalidRoleValueException - - if the number of referenced MBeans in a role is less than expected minimum degree- if the number of referenced MBeans in a role exceeds expected maximum degree- if one referenced MBean in the value is not an Object of the MBean class expected for that role- if an MBean provided for a role does not exist

Adds an MBean created by the user (and registered by him in the MBean Server) as a relation in the Relation Service

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 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



addRelationType
public void addRelationType(RelationType relationType) throws IllegalArgumentException, InvalidRelationTypeException(Code)

Parameters:
  relationType - - an Object implementing the RelationType interface a utility implementation is provided by theRelationTypeSupport class
throws:
  IllegalArgumentException - if a null RelationType is passed in as a parameter or if that RelationType has no RoleInfo defined
throws:
  InvalidRelationTypeException - 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 registeredwith the realtion service




checkRoleReading
public Integer checkRoleReading(String roleName, String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException(Code)

Checks if given Role can be read in a relation of the given type


Parameters:
  roleName - - name of role to be checked
Parameters:
  relationTypeName - - name of the relation type - an Integer wrapping an integer corresponding to possible problems represented as constants in RoleUnresolved:
  • 0 if role can be read
  • integer corresponding to RoleStatus.NO_ROLE_WITH_NAME
  • integer corresponding to RoleStatus.ROLE_NOT_READABLE

throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationTypeNotFoundException - - if the relation type is not known in the Relation Service



checkRoleWriting
public Integer checkRoleWriting(Role role, String relationTypeName, Boolean isInitialized) throws IllegalArgumentException, RelationTypeNotFoundException(Code)

Checks if given Role can be set in a relation of given type


Parameters:
  role - - role to be checked
Parameters:
  relationTypeName - - name of relation type
Parameters:
  isInitialized - - flag to specify that the checking is done for the initialization of a role, write access shall not be verified - an Integer wrapping an integer corresponding to possible problems represented as constants in RoleUnresolved:
  • 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

throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationTypeNotFoundException - - if unknown relation type



createRelation
public void createRelation(String relationId, String relationTypeName, RoleList roleList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RoleNotFoundException, InvalidRelationIdException, RelationTypeNotFoundException, InvalidRoleValueException(Code)

Parameters:
  relationId - - the id through which this relation is referenced
Parameters:
  relationTypeName - - a unique name for the RelationType
Parameters:
  roleList - - a list of roles to be associated with this relation
throws:
  IllegalArgumentException - - if the relationId, or relationTypeName is null
throws:
  RelationServiceNotRegisteredException - - if the relationService has not been registered in the MBeanServer
throws:
  RoleNotFoundException - - if a role defined in the RoleList is null or empty
throws:
  InvalidRelationIdException - - if the relationId is already in use.
throws:
  RelationTypeNotFoundException - - if the relationType is not found
throws:
  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




createRelationType
public void createRelationType(String relationTypeName, RoleInfo[] roleInfos) throws IllegalArgumentException, InvalidRelationTypeException(Code)

Parameters:
  relationTypeName - - a string giving relations a type name this must be a unique name
Parameters:
  roleInfos - - an array of RoleInfo objects.Which are used to define the roles a relation plays a part in. It defines attributessuch as cardinality, role reading and writing...The RelationService will then use these RoleInfo to maintain the relation
throws:
  IllegalArgumentException - - thrown if any of the parameters are null
throws:
  InvalidRelationTypeException - - 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




findAssociatedMBeans
public Map findAssociatedMBeans(ObjectName mbeanObjectName, String relationTypeName, String roleName) throws IllegalArgumentException(Code)

Retrieves the MBeans associated to given one in a relation.


Parameters:
  mbeanObjectName - - ObjectName of MBean
Parameters:
  relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search. Else all relation types are considered
Parameters:
  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. - HashMap, where the keys are the ObjectNames of the MBeans associated to given MBean, and the value is, for each key, an ArrayList of therelation ids of the relations where the key MBean is associated to given one (as they can be associated inseveral different relations).
throws:
  IllegalArgumentException - - if mbeanObjectName is null



findReferencingRelations
public Map findReferencingRelations(ObjectName mbeanObjectName, String relationTypeName, String roleName) throws IllegalArgumentException(Code)

Retrieves the relations where a given MBean is referenced.


Parameters:
  mbeanObjectName - - ObjectName of MBean
Parameters:
  relationTypeName - - can be null; if specified, only the relations of that type will be considered in the search. Else all relation types are considered.
Parameters:
  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. - HashMap, where the keys are the relation ids of the relations where the MBean is referenced, and the value is, for each key,an ArrayList of role names (as an MBean can be referenced in several roles in the same relation).
throws:
  IllegalArgumentException - - if mbeanObjectName is null



findRelationsOfType
public List findRelationsOfType(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException(Code)

Returns the relation ids for relations of the given type.


Parameters:
  relationTypeName - - relation type name - arrayList of relationIds
throws:
  IllegalArgumentException - - if relationTypeName is null
throws:
  RelationTypeNotFoundException - - if there is no relation type with that name



getAllRelationIds
public List getAllRelationIds()(Code)

Returns all the relation ids for all the relations handled by the Relation Service

an arrayList containing the relation ids



getAllRelationTypeNames
public List getAllRelationTypeNames()(Code)
a list containing all the relationTypeNames registered with the relation service



getAllRoles
public RoleResult getAllRoles(String relationId) throws IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException(Code)

Returns all roles present in the relation


Parameters:
  relationId - - the relation identifier - a RoleResult object, including a RoleList (for roles succcessfully retrieved) and a RoleUnresolvedList (for roles not readable).
throws:
  IllegalArgumentException - - if the relation id is null
throws:
  RelationNotFoundException - - if no relation for given id
throws:
  RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server



getNotificationInfo
public MBeanNotificationInfo[] getNotificationInfo()(Code)

Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent

- the array of possible notifications



getPurgeFlag
public boolean getPurgeFlag()(Code)
true - if the purgeFlag has been set, false if updates of a relation must be called explicitly
See Also:   RelationService.purgeRelations



getReferencedMBeans
public Map getReferencedMBeans(String relationId) throws IllegalArgumentException, RelationNotFoundException(Code)

Retrieves MBeans referenced in the various roles of the relation


Parameters:
  relationId - - the relation identifier - a hashMap mapping as key the MBean ObjectName and an arrayList of String roleNames.
throws:
  IllegalArgumentException - - if relation id is null
throws:
  RelationNotFoundException - - if no relation for given relation id



getRelationTypeName
public String getRelationTypeName(String relationId) throws IllegalArgumentException, RelationNotFoundException(Code)

Returns name of associated relation type for given relation


Parameters:
  relationId - - the relation identifier - the name of the associated relation type
throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationNotFoundException - - if no relation for given relation id



getRole
public List getRole(String relationId, String roleName) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException, RoleNotFoundException(Code)

Retrieves role value for given role name in given relation


Parameters:
  relationId - - the relation identifier
Parameters:
  roleName - - the name of the role - an ArrayList of ObjectName objects being the role value
throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationServiceNotRegisteredException - - if the Relation Service is not registered
throws:
  RelationNotFoundException - - if no relation with given id
throws:
  RoleNotFoundException - - if there is no role with given name orthe role is not readable



getRoleCardinality
public Integer getRoleCardinality(String relationId, String roleName) throws IllegalArgumentException, RelationNotFoundException, RoleNotFoundException(Code)

Retrieves the number of MBeans currently referenced in the given role.


Parameters:
  relationId - - relation id
Parameters:
  roleName - - name of role - the number of currently referenced MBeans in that role
throws:
  IllegalArgumentException - - if a null parameter
throws:
  RelationNotFoundException - - if no relation with given id
throws:
  RoleNotFoundException - - if there is no role with given name



getRoleInfo
public RoleInfo getRoleInfo(String relationTypeName, String roleInfoName) throws IllegalArgumentException, RelationTypeNotFoundException, RoleInfoNotFoundException(Code)

Parameters:
  relationTypeName - - string name representing the RelationType
Parameters:
  roleInfoName - - string name representing the RoleInfo object - the corresponding RoleInfo Object for the given parameters
throws:
  IllegalArgumentException - - if either the relationtypeName or the roleInfoName is null
throws:
  RelationTypeNotFoundException - - if the RelationType is not in the realtion service
throws:
  RoleInfoNotFoundException - - if the RoleInfo has not been found



getRoleInfos
public List getRoleInfos(String relationTypeName) throws IllegalArgumentException, RelationTypeNotFoundException(Code)

Parameters:
  relationTypeName - - the string name representation of this RelationType - List containing the RoleInfos for this RelationType Object
throws:
  IllegalArgumentException - - if the relationTypeName is null
throws:
  RelationTypeNotFoundException - - if the Relationtype for the given relationTypeName is not found



getRoles
public RoleResult getRoles(String relationId, String[] roleNames) throws IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException(Code)

Retrieves values of roles with given names in given relation


Parameters:
  relationId - - the relation identifier
Parameters:
  roleNames - - array of names of roles to be retrieved - a RoleResult object, including a RoleList (for roles succcessfully retrieved) and a RoleUnresolvedList (for roles not retrieved).
throws:
  IllegalArgumentException - - if either parameter is null
throws:
  RelationNotFoundException - - if no relation with given id
throws:
  RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server



handleNotification
public void handleNotification(Notification notification, Object handback)(Code)

Invoked when a JMX notification occurs. Currently handles notifications for unregistration of MBeans, either referenced in a relation role or being a relation itself.


Parameters:
  notification - - the notification needs to be of type MBeanServerNotification
Parameters:
  handback - - An opaque object which helps the listener to associate information regarding the MBean emitter (can be null).



hasRelation
public Boolean hasRelation(String relationId) throws IllegalArgumentException(Code)

Checks if there is a relation identified in Relation Service with given relation id.


Parameters:
  relationId - - the relation id identifying the relation boolean: true if there is a relation, false otherwise
throws:
  IllegalArgumentException - - if parameter is null



isActive
public void isActive() throws RelationServiceNotRegisteredException(Code)

throws:
  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




isRelation
public String isRelation(ObjectName objectName) throws IllegalArgumentException(Code)

Returns the relation id associated to the given ObjectName if the MBean has been added as a relation in the Relation Service


Parameters:
  objectName - - the ObjectName of supposed relation - the relation id (String) or null (if the ObjectName is not a relation handled by the Relation Service)
throws:
  IllegalArgumentException - - if the parameter is null



isRelationMBean
public ObjectName isRelationMBean(String relationId) throws IllegalArgumentException, RelationNotFoundException(Code)

Parameters:
  relationId - - relation id identifying the relation - the ObjectName corresponding to the relationId given or null if it is not found
throws:
  IllegalArgumentException - - if a null parameter
throws:
  RelationNotFoundException - - if there is no relation associated to that id

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




postDeregister
public void postDeregister()(Code)

logs nothing but log postRegisration

Implementation of MBeanRegistration




postRegister
public void postRegister(Boolean registrationDone)(Code)

Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed


Parameters:
  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
See Also:   MBeanRegistration



preDeregister
public void preDeregister() throws Exception(Code)

Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
throws:
  Exception - - This exception will be caught by the MBean server and re-thrown as an
See Also:   MBeanRegistration
See Also:   


See Also:   

The impmentation does nothing but log registration of the relation service


See Also:   javax.management.MBeanRegistrationException
See Also:    or a @see RuntimeMBeanException



preRegister
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception(Code)

Implementation of interface MBeanRegistration @see MBeanRegistration

Allows the MBean to perform any operations it needs before being registered in the MBean server. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBean server.


Parameters:
  server - - The MBean server in which the MBean will be registered
Parameters:
  name - - The object name of the MBean. This name is null if the name parameter to one of the createMBean or registerMBeanmethods in the @see MBeanServer interface is null. In that case, this method must return a non-null ObjectName for the new MBean. - The name under which the MBean is to be registered. This value must not be null. If the name parameter isnot null, it will usually but not necessarily be the returned value
throws:
  Exception - - This exception will be caught by the MBean server and re-thrown as an
See Also:   javax.management.MBeanRegistrationException
See Also:    or a @see RuntimeMBeanException.



purgeRelations
public void purgeRelations() throws RelationServiceNotRegisteredException(Code)

Purges the relations

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.

  • 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.


throws:
  RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server.



removeRelation
public void removeRelation(String relationId) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException(Code)

Removes given relation from the Relation Service.

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


Parameters:
  relationId - - relation id of the relation to be removed
throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server
throws:
  RelationNotFoundException - - if no relation corresponding to given relation id



removeRelationType
public void removeRelationType(String relationTypeName) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException(Code)

Parameters:
  relationTypeName - - a string name representing the Relationtype Object
throws:
  IllegalArgumentException - - if the relationTypeName is null
throws:
  RelationServiceNotRegisteredException - - if the RelationService has not been registered in the MBeanServer
throws:
  RelationTypeNotFoundException - - 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 bereferenced, queried via the relation service though.




sendRelationCreationNotification
public void sendRelationCreationNotification(String relationId) throws IllegalArgumentException, RelationNotFoundException(Code)

Sends a notification (RelationNotification) for a relation creation. The notification type is:

  • 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


Parameters:
  relationId - - relation identifier of the updated relation
throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationNotFoundException - - if there is no relation for given relation id



sendRelationRemovalNotification
public void sendRelationRemovalNotification(String relationId, List unregisteredMBeanList) throws IllegalArgumentException, RelationNotFoundException(Code)

Sends a notification (RelationNotification) for a relation removal. The notification type is:

  • 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


Parameters:
  relationId - - relation identifier of the updated relation
Parameters:
  unregisteredMBeanList - - ArrayList of ObjectNames of MBeans expected to be unregistered due to relation removal (can be null)
throws:
  IllegalArgumentException - - if relationId is null
throws:
  RelationNotFoundException - - if there is no relation for given relation id



sendRoleUpdateNotification
public void sendRoleUpdateNotification(String relationId, Role newRole, List oldRoleValues) throws IllegalArgumentException, RelationNotFoundException(Code)

Sends a notification (RelationNotification) for a role update in the given relation. The notification type is:

  • 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.

This method 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


Parameters:
  relationId - - the relation identifier of the updated relation
Parameters:
  newRole - - new role (name and new value)
Parameters:
  oldRoleValues - - old role value (ArrayList of ObjectName objects)
throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationNotFoundException - - if there is no relation for given relation id



setPurgeFlag
public void setPurgeFlag(boolean purgeFlag)(Code)

Parameters:
  purgeFlag - - a flag that when set to true indicates to the RelationService that it must update all relationswhen it recieves a unregistration notificationif false this will not occur and purgeRelations must be called explicitly



setRole
public void setRole(String relationId, Role role) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException, RoleNotFoundException, InvalidRoleValueException(Code)

Sets the given role in given relation

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 unregistrations


Parameters:
  relationId - - the relation identifier
Parameters:
  role - - role to be set (name and new value)
throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationServiceNotRegisteredException - - if relation service is not registered in the MBean Server
throws:
  RelationNotFoundException - - if no relation with given id
throws:
  RoleNotFoundException - - if the role does not exist or is not writable
throws:
  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
  • an MBean provided for that role does not exist



setRoles
public RoleResult setRoles(String relationId, RoleList roleList) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException(Code)

Sets the given roles in given relation

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 unregistrations


Parameters:
  relationId - - the relation identifier
Parameters:
  roleList - - the list of roles to be set - RoleResult object, including a RoleList(for roles succcessfully set) and a RoleUnresolvedList(for roles not set).
throws:
  RelationServiceNotRegisteredException - - if the realtionService has not been registered in the mbean server
throws:
  IllegalArgumentException - - if any of the parameters are null
throws:
  RelationNotFoundException - - if no relation for the given id has been found



throwRoleProblemException
static void throwRoleProblemException(int problemType, String roleName) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException(Code)



updateRoleMap
public void updateRoleMap(String relationId, Role role, List oldRoleValues) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException(Code)

Handles update of the Relation Service role map for the update of given role in given relation

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.


Parameters:
  relationId - - relation identifier of the updated relation
Parameters:
  role - - new role (name and new value)
Parameters:
  oldRoleValues - - old role value (ArrayList of ObjectName objects)
throws:
  IllegalArgumentException - - if null parameter
throws:
  RelationServiceNotRegisteredException - - if the Relation Service is not registered in the MBean Server
throws:
  RelationNotFoundException - - if no relation for given id



Methods inherited from javax.management.NotificationBroadcasterSupport
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)(Code)(Java Doc)
public MBeanNotificationInfo[] getNotificationInfo()(Code)(Java Doc)
protected void handleNotification(NotificationListener listener, Notification notification, Object handback)(Code)(Java Doc)
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException(Code)(Java Doc)
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException(Code)(Java Doc)
public void sendNotification(Notification notification)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.