RelationService.java revision 277
0N/A * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * The Relation Service is in charge of creating and deleting relation types 0N/A * and relations, of handling the consistency and of providing query 0N/A * <P>It implements the NotificationBroadcaster by extending 0N/A * NotificationBroadcasterSupport to send notifications when a relation is 0N/A * <P>It implements the NotificationListener interface to be able to receive 0N/A * notifications concerning unregistration of MBeans referenced in relation 0N/A * roles and of relation MBeans. 0N/A * <P>It implements the MBeanRegistration interface to be able to retrieve 0N/A * its ObjectName and MBean Server. 0N/A // depending if the relation has been created using createRelation() 0N/A // method (so internally handled) or is an MBean added as a relation by the 0N/A // <relation id> -> <relation type name> 0N/A // <relation MBean Object Name> -> <relation id> 0N/A // <relation type name> -> <RelationType object> 0N/A // <relation type name> -> ArrayList of <relation id> 0N/A // to list all the relations of a given type 0N/A // <ObjectName> -> HashMap 0N/A // the value HashMap mapping: 0N/A // <relation id> -> ArrayList of <role name> 0N/A // to track where a given MBean is referenced. 0N/A // Flag to indicate if, when a notification is received for the 0N/A // unregistration of an MBean referenced in a relation, if an immediate 0N/A // "purge" of the relations (look for the relations no 0N/A // longer valid) has to be performed , or if that will be performed only 0N/A // when the purgeRelations method will be explicitly called. 0N/A // true is immediate purge. 0N/A // Internal counter to provide sequence numbers for notifications sent by: 0N/A // - the Relation Service 0N/A // - a relation handled by the Relation Service 0N/A // ObjectName used to register the Relation Service in the MBean Server 0N/A // MBean Server where the Relation Service is registered 0N/A // Filter registered in the MBean Server with the Relation Service to be 0N/A // informed of referenced MBean unregistrations 0N/A // List of unregistration notifications received (storage used if purge 0N/A // of relations when unregistering a referenced MBean is not immediate but 0N/A * @param immediatePurgeFlag flag to indicate when a notification is 0N/A * received for the unregistration of an MBean referenced in a relation, if 0N/A * an immediate "purge" of the relations (look for the relations no 0N/A * longer valid) has to be performed , or if that will be performed only 0N/A * when the purgeRelations method will be explicitly called. 0N/A * <P>true is immediate purge. 0N/A * Checks if the Relation Service is active. 0N/A * Current condition is that the Relation Service must be registered in the 0N/A * @exception RelationServiceNotRegisteredException if it is not 0N/A // MBean Server not set by preRegister(): relation service not 0N/A "Relation Service not registered in the MBean Server.";
0N/A // MBeanRegistration interface 0N/A // Pre-registration: retrieves its ObjectName and MBean Server 0N/A // No exception thrown. 0N/A // Post-registration: does nothing 0N/A // Pre-unregistration: does nothing 0N/A // Post-unregistration: does nothing 0N/A * Returns the flag to indicate if when a notification is received for the 0N/A * unregistration of an MBean referenced in a relation, if an immediate 0N/A * "purge" of the relations (look for the relations no longer valid) 0N/A * has to be performed , or if that will be performed only when the 0N/A * purgeRelations method will be explicitly called. 0N/A * <P>true is immediate purge. 0N/A * @return true if purges are automatic. 0N/A * @see #setPurgeFlag 0N/A * Sets the flag to indicate if when a notification is received for the 0N/A * unregistration of an MBean referenced in a relation, if an immediate 0N/A * "purge" of the relations (look for the relations no longer valid) 0N/A * has to be performed , or if that will be performed only when the 0N/A * purgeRelations method will be explicitly called. 0N/A * <P>true is immediate purge. 0N/A * @param purgeFlag flag 0N/A * @see #getPurgeFlag 0N/A // Relation type handling 0N/A * Creates a relation type (a RelationTypeSupport object) with given 0N/A * role infos (provided by the RoleInfo objects), and adds it in the 0N/A * @param relationTypeName name of the relation type 0N/A * @param roleInfoArray array of role infos 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception InvalidRelationTypeException If: 0N/A * <P>- there is already a relation type with that name 0N/A * <P>- the same name has been used for two different role infos 0N/A * <P>- no role info provided 0N/A * <P>- one null role info provided 0N/A // Can throw an InvalidRelationTypeException 0N/A "createRelationType");
0N/A * Adds given object as a relation type. The object is expected to 0N/A * implement the RelationType interface. 0N/A * @param relationTypeObj relation type object (implementing the 0N/A * RelationType interface) 0N/A * @exception IllegalArgumentException if null parameter or if 0N/A * {@link RelationType#getRelationTypeName 0N/A * relationTypeObj.getRelationTypeName()} returns null. 0N/A * @exception InvalidRelationTypeException if: 0N/A * <P>- the same name has been used for two different roles 0N/A * <P>- no role info provided 0N/A * <P>- one null role info provided 0N/A * <P>- there is already a relation type with that name 0N/A // Checks the role infos 0N/A // Can throw InvalidRelationTypeException 0N/A * Retrieves names of all known relation types. 0N/A * @return ArrayList of relation type names (Strings) 0N/A * Retrieves list of role infos (RoleInfo objects) of a given relation 0N/A * @param relationTypeName name of relation type 0N/A * @return ArrayList of RoleInfo. 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationTypeNotFoundException if there is no relation type 0N/A // Can throw a RelationTypeNotFoundException 0N/A * Retrieves role info for given role name of a given relation type. 0N/A * @param relationTypeName name of relation type 0N/A * @param roleInfoName name of role 0N/A * @return RoleInfo object. 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationTypeNotFoundException if the relation type is not 0N/A * known in the Relation Service 0N/A * @exception RoleInfoNotFoundException if the role is not part of the 0N/A // Can throw a RelationTypeNotFoundException 0N/A // Can throw a RoleInfoNotFoundException 0N/A * Removes given relation type from Relation Service. 0N/A * <P>The relation objects of that type will be removed from the 0N/A * @param relationTypeName name of the relation type to be removed 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationTypeNotFoundException If there is no relation type 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Checks if the relation type to be removed exists 0N/A // Can throw a RelationTypeNotFoundException 0N/A // Retrieves the relation ids for relations of that type 0N/A // Note: take a copy of the list as it is a part of a map that 0N/A // will be updated by removeRelation() below. 0N/A // Removes the relation type from all maps 0N/A // Removes all relations of that type 0N/A // Note: will remove it from myRelId2RelTypeMap :) 0N/A // Can throw RelationServiceNotRegisteredException (detected 0N/A // Shall not throw a RelationNotFoundException 0N/A "removeRelationType");
0N/A // Relation handling 0N/A * Creates a simple relation (represented by a RelationSupport object) of 0N/A * given relation type, and adds it in the Relation Service. 0N/A * <P>Roles are initialized according to the role list provided in 0N/A * parameter. The ones not initialized in this way are set to an empty 0N/A * ArrayList of ObjectNames. 0N/A * <P>A RelationNotification, with type RELATION_BASIC_CREATION, is sent. 0N/A * @param relationId relation identifier, to identify uniquely the relation 0N/A * inside the Relation Service 0N/A * @param relationTypeName name of the relation type (has to be created 0N/A * in the Relation Service) 0N/A * @param roleList role list to initialize roles of the relation (can 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception IllegalArgumentException if null parameter, except the role 0N/A * list which can be null if no role initialization 0N/A * @exception RoleNotFoundException if a value is provided for a role 0N/A * that does not exist in the relation type 0N/A * @exception InvalidRelationIdException if relation id already used 0N/A * @exception RelationTypeNotFoundException if relation type not known in 0N/A * @exception InvalidRoleValueException if: 0N/A * <P>- the same role name is used for two different roles 0N/A * <P>- the number of referenced MBeans in given value is less than 0N/A * expected minimum degree 0N/A * <P>- the number of referenced MBeans in provided value exceeds expected 0N/A * <P>- one referenced MBean in the value is not an Object of the MBean 0N/A * class expected for that role 0N/A * <P>- an MBean provided for that role does not exist 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Creates RelationSupport object 0N/A // Can throw InvalidRoleValueException 0N/A // Adds relation object as a relation into the Relation Service 0N/A // Can throw RoleNotFoundException, InvalidRelationId, 0N/A // RelationTypeNotFoundException, InvalidRoleValueException 0N/A // Cannot throw MBeanException 0N/A * Adds an MBean created by the user (and registered by him in the MBean 0N/A * Server) as a relation in the Relation Service. 0N/A * <P>To be added as a relation, the MBean must conform to the 0N/A * <P>- implement the Relation interface 0N/A * <P>- have for RelationService ObjectName the ObjectName of current 0N/A * <P>- have a relation id unique and unused in current Relation Service 0N/A * <P>- have for relation type a relation type created in the Relation 0N/A * <P>- have roles conforming to the role info provided in the relation 0N/A * @param relationObjectName ObjectName of the relation MBean to be added. 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception NoSuchMethodException If the MBean does not implement the 0N/A * Relation interface 0N/A * @exception InvalidRelationIdException if: 0N/A * <P>- no relation identifier in MBean 0N/A * <P>- the relation identifier is already used in the Relation Service 0N/A * @exception InstanceNotFoundException if the MBean for given ObjectName 0N/A * has not been registered 0N/A * @exception InvalidRelationServiceException if: 0N/A * <P>- no Relation Service name in MBean 0N/A * <P>- the Relation Service name in the MBean is not the one of the 0N/A * current Relation Service 0N/A * @exception RelationTypeNotFoundException if: 0N/A * <P>- no relation type name in MBean 0N/A * <P>- the relation type name in MBean does not correspond to a relation 0N/A * type created in the Relation Service 0N/A * @exception InvalidRoleValueException if: 0N/A * <P>- the number of referenced MBeans in a role is less than 0N/A * expected minimum degree 0N/A * <P>- the number of referenced MBeans in a role exceeds expected 0N/A * <P>- one referenced MBean in the value is not an Object of the MBean 0N/A * class expected for that role 0N/A * <P>- an MBean provided for a role does not exist 0N/A * @exception RoleNotFoundException if a value is provided for a role 0N/A * that does not exist in the relation type 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Checks that the relation MBean implements the Relation interface. 0N/A // It will also check that the provided ObjectName corresponds to a 0N/A // registered MBean (else will throw an InstanceNotFoundException) 0N/A // Checks there is a relation id in the relation MBean (its uniqueness 0N/A // is checked in addRelationInt()) 0N/A // Can throw InstanceNotFoundException (but detected above) 0N/A // No MBeanException as no exception raised by this method, and no 0N/A // ReflectionException 0N/A // Checks that the Relation Service where the relation MBean is 0N/A // expected to be added is the current one 0N/A // Can throw InstanceNotFoundException (but detected above) 0N/A // No MBeanException as no exception raised by this method, no 0N/A // ReflectionException 0N/A "RelationServiceName"));
0N/A String excMsg =
"The Relation Service referenced in the MBean is not the current one.";
0N/A // Checks that a relation type has been specified for the relation 0N/A // Can throw InstanceNotFoundException (but detected above) 0N/A // No MBeanException as no exception raised by this method, no 0N/A // ReflectionException 0N/A "RelationTypeName"));
0N/A // Retrieves all roles without considering read mode 0N/A // Can throw InstanceNotFoundException (but detected above) 0N/A // No MBeanException as no exception raised by this method, no 0N/A // ReflectionException 0N/A // Can throw RoleNotFoundException, InvalidRelationIdException, 0N/A // RelationTypeNotFoundException, InvalidRoleValueException 0N/A // Adds relation MBean ObjectName in map 0N/A // Updates flag to specify that the relation is managed by the Relation 0N/A // This flag and setter are inherited from RelationSupport and not parts 0N/A // of the Relation interface, so may be not supported. 0N/A "RelationServiceManagementFlag",
0N/A // OK : The flag is not supported. 0N/A // Updates listener information to received notification for 0N/A // unregistration of this MBean 0N/A * If the relation is represented by an MBean (created by the user and 0N/A * added as a relation in the Relation Service), returns the ObjectName of 0N/A * @param relationId relation id identifying the relation 0N/A * @return ObjectName of the corresponding relation MBean, or null if 0N/A * the relation is not an MBean. 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException there is no relation associated 0N/A // Can throw RelationNotFoundException 0N/A * Returns the relation id associated to the given ObjectName if the 0N/A * MBean has been added as a relation in the Relation Service. 0N/A * @param objectName ObjectName of supposed relation 0N/A * @return relation id (String) or null (if the ObjectName is not a 0N/A * relation handled by the Relation Service) 0N/A * @exception IllegalArgumentException if null parameter 0N/A * Checks if there is a relation identified in Relation Service with given 0N/A * @param relationId relation id identifying the relation 0N/A * @return boolean: true if there is a relation, false else 0N/A * @exception IllegalArgumentException if null parameter 0N/A // Can throw RelationNotFoundException 0N/A * Returns all the relation ids for all the relations handled by the 0N/A * @return ArrayList of String 0N/A * Checks if given Role can be read in a relation of the given type. 0N/A * @param roleName name of role to be checked 0N/A * @param relationTypeName name of the relation type 0N/A * @return an Integer wrapping an integer corresponding to possible 0N/A * problems represented as constants in RoleUnresolved: 0N/A * <P>- 0 if role can be read 0N/A * <P>- integer corresponding to RoleStatus.NO_ROLE_WITH_NAME 0N/A * <P>- integer corresponding to RoleStatus.ROLE_NOT_READABLE 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationTypeNotFoundException if the relation type is not 0N/A * known in the Relation Service 0N/A // Can throw a RelationTypeNotFoundException 0N/A // Can throw a RoleInfoNotFoundException to be transformed into 0N/A // returned value RoleStatus.NO_ROLE_WITH_NAME 0N/A "checkRoleReading");
0N/A * Checks if given Role can be set in a relation of given type. 0N/A * @param role role to be checked 0N/A * @param relationTypeName name of relation type 0N/A * @param initFlag flag to specify that the checking is done for the 0N/A * initialization of a role, write access shall not be verified. 0N/A * @return an Integer wrapping an integer corresponding to possible 0N/A * problems represented as constants in RoleUnresolved: 0N/A * <P>- 0 if role can be set 0N/A * <P>- integer corresponding to RoleStatus.NO_ROLE_WITH_NAME 0N/A * <P>- integer for RoleStatus.ROLE_NOT_WRITABLE 0N/A * <P>- integer for RoleStatus.LESS_THAN_MIN_ROLE_DEGREE 0N/A * <P>- integer for RoleStatus.MORE_THAN_MAX_ROLE_DEGREE 0N/A * <P>- integer for RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS 0N/A * <P>- integer for RoleStatus.REF_MBEAN_NOT_REGISTERED 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationTypeNotFoundException if unknown relation type 0N/A // Can throw a RelationTypeNotFoundException 0N/A "checkRoleWriting");
0N/A "checkRoleWriting");
0N/A * Sends a notification (RelationNotification) for a relation creation. 0N/A * The notification type is: 0N/A * <P>- RelationNotification.RELATION_BASIC_CREATION if the relation is an 0N/A * object internal to the Relation Service 0N/A * <P>- RelationNotification.RELATION_MBEAN_CREATION if the relation is a 0N/A * MBean added as a relation. 0N/A * <P>The source object is the Relation Service itself. 0N/A * <P>It is called in Relation Service createRelation() and 0N/A * addRelation() methods. 0N/A * @param relationId relation identifier of the updated relation 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if there is no relation for given 0N/A // Can throw RelationNotFoundException 0N/A "sendRelationCreationNotification");
0N/A * Sends a notification (RelationNotification) for a role update in the 0N/A * given relation. The notification type is: 0N/A * <P>- RelationNotification.RELATION_BASIC_UPDATE if the relation is an 0N/A * object internal to the Relation Service 0N/A * <P>- RelationNotification.RELATION_MBEAN_UPDATE if the relation is a 0N/A * MBean added as a relation. 0N/A * <P>The source object is the Relation Service itself. 0N/A * <P>It is called in relation MBean setRole() (for given role) and 0N/A * setRoles() (for each role) methods (implementation provided in 0N/A * RelationSupport class). 0N/A * <P>It is also called in Relation Service setRole() (for given role) and 0N/A * setRoles() (for each role) methods. 0N/A * @param relationId relation identifier of the updated relation 0N/A * @param newRole new role (name and new value) 0N/A * @param oldValue old role value (List of ObjectName objects) 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if there is no relation for given 0N/A "sendRoleUpdateNotification",
0N/A // Can throw a RelationNotFoundException 0N/A "sendRoleUpdateNotification");
0N/A * Sends a notification (RelationNotification) for a relation removal. 0N/A * The notification type is: 0N/A * <P>- RelationNotification.RELATION_BASIC_REMOVAL if the relation is an 0N/A * object internal to the Relation Service 0N/A * <P>- RelationNotification.RELATION_MBEAN_REMOVAL if the relation is a 0N/A * MBean added as a relation. 0N/A * <P>The source object is the Relation Service itself. 0N/A * <P>It is called in Relation Service removeRelation() method. 0N/A * @param relationId relation identifier of the updated relation 0N/A * @param unregMBeanList List of ObjectNames of MBeans expected 0N/A * to be unregistered due to relation removal (can be null) 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if there is no relation for given 0N/A "sendRelationRemovalNotification",
0N/A // Can throw RelationNotFoundException 0N/A "sendRelationRemovalNotification");
0N/A * Handles update of the Relation Service role map for the update of given 0N/A * role in given relation. 0N/A * <P>It is called in relation MBean setRole() (for given role) and 0N/A * setRoles() (for each role) methods (implementation provided in 0N/A * RelationSupport class). 0N/A * <P>It is also called in Relation Service setRole() (for given role) and 0N/A * setRoles() (for each role) methods. 0N/A * <P>To allow the Relation Service to maintain the consistency (in case 0N/A * of MBean unregistration) and to be able to perform queries, this method 0N/A * must be called when a role is updated. 0N/A * @param relationId relation identifier of the updated relation 0N/A * @param newRole new role (name and new value) 0N/A * @param oldValue old role value (List of ObjectName objects) 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception RelationNotFoundException if no relation for given id. 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Verifies the relation has been added in the Relation Service 0N/A // Can throw a RelationNotFoundException 0N/A // Note: no need to test if oldValue not null before cloning, 0N/A // List of ObjectNames of new referenced MBeans 0N/A // Checks if this ObjectName was already present in old value 0N/A // Note: use copy (oldRoleValue) instead of original 0N/A // oldValue to speed up, as oldRoleValue is decreased 0N/A // by removing unchanged references :) 0N/A // New reference to an ObjectName 0N/A // Stores this reference into map 0N/A // Returns true if new reference, false if MBean already 0N/A // Adds it into list of new reference 0N/A // MBean was already referenced in old value 0N/A // Removes it from old value (local list) to ignore it when 0N/A // looking for remove MBean references 0N/A // List of ObjectNames of MBeans no longer referenced 0N/A // Each ObjectName remaining in oldRoleValue is an ObjectName no longer 0N/A // referenced in new value 0N/A // Removes MBean reference from map 0N/A // Returns true if the MBean is no longer referenced in any 0N/A // Adds it into list of references to be removed 0N/A // To avoid having one listener per ObjectName of referenced MBean, 0N/A // and to increase performances, there is only one listener recording 0N/A // all ObjectNames of interest 0N/A * Removes given relation from the Relation Service. 0N/A * <P>A RelationNotification notification is sent, its type being: 0N/A * <P>- RelationNotification.RELATION_BASIC_REMOVAL if the relation was 0N/A * only internal to the Relation Service 0N/A * <P>- RelationNotification.RELATION_MBEAN_REMOVAL if the relation is 0N/A * registered as an MBean. 0N/A * <P>For MBeans referenced in such relation, nothing will be done, 0N/A * @param relationId relation id of the relation to be removed 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation corresponding to 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Checks there is a relation with this id 0N/A // Can throw RelationNotFoundException 0N/A // Removes it from listener filter 0N/A // Can throw a RelationServiceNotRegisteredException 0N/A // Sends a notification 0N/A // Note: has to be done FIRST as needs the relation to be still in the 0N/A // No RelationNotFoundException as checked above 0N/A // Revisit [cebro] Handle CIM "Delete" and "IfDeleted" qualifiers: 0N/A // deleting the relation can mean to delete referenced MBeans. In 0N/A // that case, MBeans to be unregistered are put in a list sent along 0N/A // with the notification below 0N/A // Can throw a RelationNotFoundException (but detected above) 0N/A // Removes the relation from various internal maps 0N/A // - MBean reference map 0N/A // Retrieves the MBeans referenced in this relation 0N/A // Note: here we cannot use removeMBeanReference() because it would 0N/A // require to know the MBeans referenced in the relation. For 0N/A // that it would be necessary to call 'getReferencedMBeans()' 0N/A // on the relation itself. Ok if it is an internal one, but if 0N/A // it is an MBean, it is possible it is already unregistered, so 0N/A // not available through the MBean Server. 0N/A // List of MBeans no longer referenced in any relation, to be 0N/A // removed fom the map 0N/A // Retrieves relations where the MBean is referenced 0N/A // MBean no longer referenced 0N/A // Note: do not remove it here because pointed by the 0N/A // Cleans MBean reference map by removing MBeans no longer 0N/A // - Relation id to object map 0N/A // - ObjectName to relation id map 0N/A // Relation id to relation type name map 0N/A // First retrieves the relation type name 0N/A // - Relation type name to relation id map 0N/A // Can be null if called from removeRelationType() 0N/A // No other relation of that type 0N/A * Purges the relations. 0N/A * <P>Depending on the purgeFlag value, this method is either called 0N/A * automatically when a notification is received for the unregistration of 0N/A * an MBean referenced in a relation (if the flag is set to true), or not 0N/A * (if the flag is set to false). 0N/A * <P>In that case it is up to the user to call it to maintain the 0N/A * consistency of the relations. To be kept in mind that if an MBean is 0N/A * unregistered and the purge not done immediately, if the ObjectName is 0N/A * reused and assigned to another MBean referenced in a relation, calling 0N/A * manually this purgeRelations() method will cause trouble, as will 0N/A * consider the ObjectName as corresponding to the unregistered MBean, not 0N/A * seeing the new one. 0N/A * <P>The behavior depends on the cardinality of the role where the 0N/A * unregistered MBean is referenced: 0N/A * <P>- if removing one MBean reference in the role makes its number of 0N/A * references less than the minimum degree, the relation has to be removed. 0N/A * <P>- if the remaining number of references after removing the MBean 0N/A * reference is still in the cardinality range, keep the relation and 0N/A * update it calling its handleMBeanUnregistration() callback. 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server. 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Revisit [cebro] Handle the CIM "Delete" and "IfDeleted" qualifier: 0N/A // if the unregistered MBean has the "IfDeleted" qualifier, 0N/A // possible that the relation itself or other referenced MBeans 0N/A // have to be removed (then a notification would have to be sent 0N/A // to inform that they should be unregistered. 0N/A // Clones the list of notifications to be able to still receive new 0N/A // notifications while proceeding those ones 0N/A // Updates the listener filter to avoid receiving notifications for 0N/A // those MBeans again 0N/A // Makes also a local "myRefedMBeanObjName2RelIdsMap" map, mapping 0N/A // ObjectName -> relId -> roles, to remove the MBean from the global 0N/A // List of references to be removed from the listener filter 0N/A // Map including ObjectNames for unregistered MBeans, with 0N/A // referencing relation ids and roles 0N/A // Adds the unregsitered MBean in the list of references to 0N/A // remove from the listener filter 0N/A // Retrieves the associated map of relation ids and roles 0N/A // Updates the listener 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Retrieves the relations where the MBean is referenced 0N/A // List of relation ids where the unregistered MBean is 0N/A // List of roles of the relation where the MBean is 0N/A // Checks if the relation has to be removed or not, 0N/A // regarding expected minimum role cardinality and current 0N/A // number of references after removal of the current one 0N/A // If the relation is kept, calls 0N/A // handleMBeanUnregistration() callback of the relation to 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Shall not throw RelationNotFoundException, 0N/A // RoleNotFoundException, MBeanException 0N/A * Retrieves the relations where a given MBean is referenced. 0N/A * <P>This corresponds to the CIM "References" and "ReferenceNames" 0N/A * @param mbeanName ObjectName of MBean 0N/A * @param relationTypeName can be null; if specified, only the relations 0N/A * of that type will be considered in the search. Else all relation types 0N/A * @param roleName can be null; if specified, only the relations 0N/A * where the MBean is referenced in that role will be returned. Else all 0N/A * roles are considered. 0N/A * @return an HashMap, where the keys are the relation ids of the relations 0N/A * where the MBean is referenced, and the value is, for each key, 0N/A * an ArrayList of role names (as an MBean can be referenced in several 0N/A * roles in the same relation). 0N/A * @exception IllegalArgumentException if null parameter 0N/A "findReferencingRelations",
0N/A // Retrieves the relations referencing the MBean 0N/A // Relation Ids where the MBean is referenced 0N/A // List of relation ids of interest regarding the selected 0N/A // Considers all relations 0N/A // Considers only the relation ids for relations of given 0N/A // Retrieves its relation type 0N/A // Now looks at the roles where the MBean is expected to be 0N/A // Retrieves list of role names where the MBean is 0N/A // All roles to be considered 0N/A // Note: no need to test if list not null before 0N/A // cloning, MUST be not null else bug :( 0N/A // Filters only the relations where the MBean is 0N/A // referenced in // given role 0N/A "findReferencingRelations");
0N/A * Retrieves the MBeans associated to given one in a relation. 0N/A * <P>This corresponds to CIM Associators and AssociatorNames operations. 0N/A * @param mbeanName ObjectName of MBean 0N/A * @param relationTypeName can be null; if specified, only the relations 0N/A * of that type will be considered in the search. Else all 0N/A * relation types are considered. 0N/A * @param roleName can be null; if specified, only the relations 0N/A * where the MBean is referenced in that role will be considered. Else all 0N/A * roles are considered. 0N/A * @return an HashMap, where the keys are the ObjectNames of the MBeans 0N/A * associated to given MBean, and the value is, for each key, an ArrayList 0N/A * of the relation ids of the relations where the key MBean is 0N/A * associated to given one (as they can be associated in several different 0N/A * @exception IllegalArgumentException if null parameter 0N/A "findAssociatedMBeans",
0N/A // Retrieves the map <relation id> -> <role names> for those 0N/A // Retrieves ObjectNames of MBeans referenced in this relation 0N/A // Shall not throw a RelationNotFoundException if incorrect status 0N/A // For each MBean associated to given one in a relation, adds the 0N/A // association <ObjectName> -> <relation id> into result map 0N/A // Sees if this MBean is already associated to the given 0N/A // one in another relation 0N/A "findAssociatedMBeans");
0N/A * Returns the relation ids for relations of the given type. 0N/A * @param relationTypeName relation type name 0N/A * @return an ArrayList of relation ids. 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationTypeNotFoundException if there is no relation type 0N/A "findRelationsOfType");
0N/A // Can throw RelationTypeNotFoundException 0N/A "findRelationsOfType");
0N/A * Retrieves role value for given role name in given relation. 0N/A * @param relationId relation id 0N/A * @param roleName name of role 0N/A * @return the ArrayList of ObjectName objects being the role value 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation with given id 0N/A * @exception RoleNotFoundException if: 0N/A * <P>- there is no role with given name 0N/A * <P>- the role is not readable. 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A // Can throw RoleNotFoundException 0N/A // Can throw MBeanException wrapping a RoleNotFoundException: 0N/A // throw wrapped exception 0N/A // Shall not throw InstanceNotFoundException or ReflectionException 0N/A * Retrieves values of roles with given names in given relation. 0N/A * @param relationId relation id 0N/A * @param roleNameArray array of names of roles to be retrieved 0N/A * @return a RoleResult object, including a RoleList (for roles 0N/A * successfully retrieved) and a RoleUnresolvedList (for roles not 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation with given id 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A // OK : This is an array of java.lang.String 0N/A // so this should never happen... 0N/A // Shall not throw InstanceNotFoundException, ReflectionException 0N/A // or MBeanException 0N/A * Returns all roles present in the relation. 0N/A * @param relationId relation id 0N/A * @return a RoleResult object, including a RoleList (for roles 0N/A * successfully retrieved) and a RoleUnresolvedList (for roles not 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation for given id 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A // Shall not throw any Exception 0N/A * Retrieves the number of MBeans currently referenced in the given role. 0N/A * @param relationId relation id 0N/A * @param roleName name of role 0N/A * @return the number of currently referenced MBeans in that role 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation with given id 0N/A * @exception RoleNotFoundException if there is no role with given name 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A // Can throw RoleNotFoundException 0N/A // Can throw MBeanException wrapping RoleNotFoundException: 0N/A // throw wrapped exception 0N/A // Shall not throw InstanceNotFoundException or ReflectionException 0N/A "getRoleCardinality",
0N/A "getRoleCardinality");
0N/A * Sets the given role in given relation. 0N/A * <P>Will check the role according to its corresponding role definition 0N/A * provided in relation's relation type 0N/A * <P>The Relation Service will keep track of the change to keep the 0N/A * consistency of relations by handling referenced MBean unregistrations. 0N/A * @param relationId relation id 0N/A * @param role role to be set (name and new value) 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation with given id 0N/A * @exception RoleNotFoundException if the role does not exist or is not 0N/A * @exception InvalidRoleValueException if value provided for role is not 0N/A * <P>- the number of referenced MBeans in given value is less than 0N/A * expected minimum degree 0N/A * <P>- the number of referenced MBeans in provided value exceeds expected 0N/A * <P>- one referenced MBean in the value is not an Object of the MBean 0N/A * class expected for that role 0N/A * <P>- an MBean provided for that role does not exist 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A // Can throw RoleNotFoundException, 0N/A // InvalidRoleValueException and 0N/A // RelationServiceNotRegisteredException 0N/A // Shall not throw RelationTypeNotFoundException 0N/A // (as relation exists in the RS, its relation type is known) 0N/A // Can throw MBeanException wrapping RoleNotFoundException, 0N/A // InvalidRoleValueException 0N/A // Shall not MBeanException wrapping an MBeanException wrapping 0N/A // RelationTypeNotFoundException, or ReflectionException, or 0N/A // InstanceNotFoundException 0N/A * Sets the given roles in given relation. 0N/A * <P>Will check the role according to its corresponding role definition 0N/A * provided in relation's relation type 0N/A * <P>The Relation Service keeps track of the changes to keep the 0N/A * consistency of relations by handling referenced MBean unregistrations. 0N/A * @param relationId relation id 0N/A * @param roleList list of roles to be set 0N/A * @return a RoleResult object, including a RoleList (for roles 0N/A * successfully set) and a RoleUnresolvedList (for roles not 0N/A * @exception RelationServiceNotRegisteredException if the Relation 0N/A * Service is not registered in the MBean Server 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation with given id 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Shall not throw RelationTypeNotFoundException (as relation is 0N/A // known, its relation type exists) 0N/A // Shall not throw InstanceNotFoundException or an MBeanException 0N/A // or ReflectionException 0N/A * Retrieves MBeans referenced in the various roles of the relation. 0N/A * @param relationId relation id 0N/A * @return a HashMap mapping: 0N/A * <P> ObjectName -> ArrayList of String (role 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation for given 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A "ReferencedMBeans"));
0N/A "getReferencedMBeans");
0N/A * Returns name of associated relation type for given relation. 0N/A * @param relationId relation id 0N/A * @return the name of the associated relation type. 0N/A * @exception IllegalArgumentException if null parameter 0N/A * @exception RelationNotFoundException if no relation for given 0N/A // Can throw a RelationNotFoundException 0N/A // Internal relation 0N/A "RelationTypeName"));
0N/A "getRelationTypeName");
0N/A // NotificationListener Interface 0N/A * Invoked when a JMX notification occurs. 0N/A * Currently handles notifications for unregistration of MBeans, either 0N/A * referenced in a relation role or being a relation itself. 0N/A * @param notif The notification. 0N/A * @param handback An opaque object which helps the listener to 0N/A * associate information regarding the MBean emitter (can be null). 0N/A // Note: use a flag to block access to 0N/A // myRefedMBeanObjName2RelIdsMap only for a quick access 0N/A // Unregistration of a referenced MBean 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // but assume that will be fine :) 0N/A // Note: do both tests as a relation can be an MBean and be 0N/A // itself referenced in another relation :) 0N/A // Unregistration of a relation MBean 0N/A // Can throw RelationTypeNotFoundException, 0N/A // RelationServiceNotRegisteredException 0N/A // Shall not throw RelationTypeNotFoundException or 0N/A // InstanceNotFoundException 0N/A "handleNotification");
0N/A // NotificationBroadcaster interface 0N/A * Returns a NotificationInfo object containing the name of the Java class 0N/A * of the notification and the notification types sent. 0N/A "getNotificationInfo");
0N/A "getNotificationInfo");
0N/A // Adds given object as a relation type. 0N/A // -param relationTypeObj relation type object 0N/A // -exception IllegalArgumentException if null parameter 0N/A // -exception InvalidRelationTypeException if there is already a relation 0N/A // type with that name 0N/A "addRelationTypeInt");
0N/A // Checks that there is not already a relation type with that name 0N/A // existing in the Relation Service 0N/A // Can throw a RelationTypeNotFoundException (in fact should ;) 0N/A String excMsg =
"There is already a relation type in the Relation Service with name ";
0N/A // OK : The RelationType could not be found. 0N/A // Adds the relation type 0N/A "addRelationTypeInt");
0N/A // Retrieves relation type with given name 0N/A // -param relationTypeName expected name of a relation type created in the 0N/A // -return RelationType object corresponding to given name 0N/A // -exception IllegalArgumentException if null parameter 0N/A // -exception RelationTypeNotFoundException if no relation type for that 0N/A // name created in Relation Service 0N/A // No null relation type accepted, so can use get() 0N/A String excMsg =
"No relation type created in the Relation Service with the name ";
0N/A // Retrieves relation corresponding to given relation id. 0N/A // - a RelationSupport object if the relation is internal 0N/A // - the ObjectName of the corresponding MBean 0N/A // -param relationId expected relation id 0N/A // -return RelationSupport object or ObjectName of relation with given id 0N/A // -exception IllegalArgumentException if null parameter 0N/A // -exception RelationNotFoundException if no relation for that 0N/A // relation id created in Relation Service 0N/A // No null relation accepted, so can use get() 0N/A // Adds a new MBean reference (reference to an ObjectName) in the 0N/A // referenced MBean map (myRefedMBeanObjName2RelIdsMap). 0N/A // -param objectName ObjectName of new referenced MBean 0N/A // -param relationId relation id of the relation where the MBean is 0N/A // -param roleName name of the role where the MBean is referenced 0N/A // - true if the MBean was not referenced before, so really a new 0N/A // -exception IllegalArgumentException if null parameter 0N/A "addNewMBeanReference",
0N/A // Checks if the MBean was already referenced 0N/A // No null value allowed, use get() directly 0N/A // MBean not referenced in any relation yet 0N/A // List of roles where the MBean is referenced in given 0N/A // Map of relations where the MBean is referenced 0N/A // MBean already referenced in at least another relation 0N/A // Checks if already referenced in another role in current 0N/A // MBean not referenced in current relation 0N/A // List of roles where the MBean is referenced in given 0N/A // Adds new reference done in current relation 0N/A // MBean already referenced in current relation in another 0N/A // Adds new reference done 0N/A "addNewMBeanReference");
0N/A // Removes an obsolete MBean reference (reference to an ObjectName) in 0N/A // the referenced MBean map (myRefedMBeanObjName2RelIdsMap). 0N/A // -param objectName ObjectName of MBean no longer referenced 0N/A // -param relationId relation id of the relation where the MBean was 0N/A // -param roleName name of the role where the MBean was referenced 0N/A // -param allRolesFlag flag, if true removes reference to MBean for all 0N/A // roles in the relation, not only for the one above 0N/A // - true if the MBean is no longer reference in any relation 0N/A // -exception IllegalArgumentException if null parameter 0N/A "removeMBeanReference",
0N/A // Retrieves the set of relations (designed via their relation ids) 0N/A // where the MBean is referenced 0N/A // Note that it is possible that the MBean has already been removed 0N/A // from the internal map: this is the case when the MBean is 0N/A // unregistered, the role is updated, then we arrive here. 0N/A // The MBean is no longer referenced 0N/A "removeMBeanReference");
0N/A // Now retrieves the roles of current relation where the MBean 0N/A // Removes obsolete reference to role 0N/A // Checks if there is still at least one role in current relation 0N/A // where the MBean is referenced 0N/A // MBean no longer referenced in current relation: removes 0N/A // Checks if the MBean is still referenced in at least on relation 0N/A // MBean no longer referenced in any relation: removes entry 0N/A "removeMBeanReference");
0N/A // Updates the listener registered to the MBean Server to be informed of 0N/A // referenced MBean unregistrations 0N/A // -param newRefList ArrayList of ObjectNames for new references done 0N/A // to MBeans (can be null) 0N/A // -param obsoleteRefList ArrayList of ObjectNames for obsolete references 0N/A // to MBeans (can be null) 0N/A // -exception RelationServiceNotRegisteredException if the Relation 0N/A // Service is not registered in the MBean Server. 0N/A "updateUnregistrationListener",
0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Initialize it to be able to synchronise it :) 0N/A // Enables ObjectNames in newRefList 0N/A // Disables ObjectNames in obsoleteRefList 0N/A// if (!newListenerFlag) { 0N/A // The Relation Service was already registered as a 0N/A // Shall not throw InstanceNotFoundException (as the 0N/A // MBean Server Delegate is expected to exist) or 0N/A // ListenerNotFoundException (as it has been checked above 0N/A // that the Relation Service is registered) 0N/A// myMBeanServer.removeNotificationListener( 0N/A// MBeanServerDelegate.DELEGATE_NAME, 0N/A// } catch (InstanceNotFoundException exc1) { 0N/A// throw new RuntimeException(exc1.getMessage()); 0N/A// } catch (ListenerNotFoundException exc2) { 0N/A// RelationServiceNotRegisteredException(exc2.getMessage()); 0N/A // Adds Relation Service with current filter 0N/A // Can throw InstanceNotFoundException if the Relation 0N/A // Service is not registered, to be transformed into 0N/A // RelationServiceNotRegisteredException 0N/A // Assume that there will not be any InstanceNotFoundException 0N/A // for the MBean Server Delegate :) 0N/A// myMBeanServer.addNotificationListener( 0N/A// MBeanServerDelegate.DELEGATE_NAME, 0N/A// } catch (InstanceNotFoundException exc) { 0N/A// RelationServiceNotRegisteredException(exc.getMessage()); 0N/A "updateUnregistrationListener");
0N/A // Adds a relation (being either a RelationSupport object or an MBean 0N/A // referenced using its ObjectName) in the Relation Service. 0N/A // Will send a notification RelationNotification with type: 0N/A // - RelationNotification.RELATION_BASIC_CREATION for internal relation 0N/A // - RelationNotification.RELATION_MBEAN_CREATION for an MBean being added 0N/A // -param relationBaseFlag flag true if the relation is a RelationSupport 0N/A // object, false if it is an MBean 0N/A // -param relationObj RelationSupport object (if relation is internal) 0N/A // -param relationObjName ObjectName of the MBean to be added as a relation 0N/A // (only for the relation MBean) 0N/A // -param relationId relation identifier, to uniquely identify the relation 0N/A // inside the Relation Service 0N/A // -param relationTypeName name of the relation type (has to be created 0N/A // in the Relation Service) 0N/A // -param roleList role list to initialize roles of the relation 0N/A // -exception IllegalArgumentException if null paramater 0N/A // -exception RelationServiceNotRegisteredException if the Relation 0N/A // Service is not registered in the MBean Server 0N/A // -exception RoleNotFoundException if a value is provided for a role 0N/A // that does not exist in the relation type 0N/A // -exception InvalidRelationIdException if relation id already used 0N/A // -exception RelationTypeNotFoundException if relation type not known in 0N/A // -exception InvalidRoleValueException if: 0N/A // - the same role name is used for two different roles 0N/A // - the number of referenced MBeans in given value is less than 0N/A // expected minimum degree 0N/A // - the number of referenced MBeans in provided value exceeds expected 0N/A // - one referenced MBean in the value is not an Object of the MBean 0N/A // class expected for that role 0N/A // - an MBean provided for that role does not exist 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Checks if there is already a relation with given id 0N/A // Can throw a RelationNotFoundException (in fact should :) 0N/A // There is already a relation with that id 0N/A // OK : The Relation could not be found. 0N/A // Retrieves the relation type 0N/A // Can throw RelationTypeNotFoundException 0N/A // Checks that each provided role conforms to its role info provided in 0N/A // the relation type 0N/A // First retrieves a local list of the role infos of the relation type 0N/A // to see which roles have not been initialized 0N/A // Note: no need to test if list not null before cloning, not allowed 0N/A // to have an empty relation type. 0N/A // Retrieves corresponding role info 0N/A // Can throw a RoleInfoNotFoundException to be converted into a 0N/A // RoleNotFoundException 0N/A // Checks that role conforms to role info, 0N/A // A problem has occurred: throws appropriate exception 0N/A // here InvalidRoleValueException 0N/A // Removes role info for that list from list of role infos for 0N/A // roles to be defaulted 0N/A // Note: no need to check if != -1, MUST be there :) 0N/A // Initializes roles not initialized by roleList 0N/A // Can throw InvalidRoleValueException 0N/A // Creation of relation successfull!!!! 0N/A // Updates internal maps 0N/A // Relation id to object map 0N/A // Note: do not clone relation object, created by us :) 0N/A // Relation id to relation type name map 0N/A // Relation type to relation id map 0N/A // Referenced MBean to relation id map 0N/A // Only role list parameter used, as default initialization of roles 0N/A // done automatically in initializeMissingRoles() sets each 0N/A // uninitialized role to an empty value. 0N/A // Creates a dummy empty ArrayList of ObjectNames to be the old 0N/A // Will not throw a RelationNotFoundException (as the RelId2Obj map 0N/A // has been updated above) so catch it :) 0N/A // OK : The Relation could not be found. 0N/A // Sends a notification for relation creation 0N/A // Will not throw RelationNotFoundException so catch it :) 0N/A // OK : The Relation could not be found. 0N/A // Checks that given role conforms to given role info. 0N/A // -param chkType type of check: 0N/A // - 1: read, just check read access 0N/A // - 2: write, check value and write access if writeChkFlag 0N/A // -param roleName role name 0N/A // -param roleValue role value 0N/A // -param roleInfo corresponding role info 0N/A // -param writeChkFlag boolean to specify a current write access and 0N/A // -return Integer with value: 0N/A // - RoleStatus.NO_ROLE_WITH_NAME 0N/A // - RoleStatus.ROLE_NOT_READABLE 0N/A // - RoleStatus.ROLE_NOT_WRITABLE 0N/A // - RoleStatus.LESS_THAN_MIN_ROLE_DEGREE 0N/A // - RoleStatus.MORE_THAN_MAX_ROLE_DEGREE 0N/A // - RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS 0N/A // - RoleStatus.REF_MBEAN_NOT_REGISTERED 0N/A // -exception IllegalArgumentException if null parameter 0N/A // Checks read access if required 0N/A // Checks write access if required 0N/A // Checks minimum cardinality 0N/A // Checks maximum cardinality 0N/A // Verifies that each referenced MBean is registered in the MBean 0N/A // Server and that it is an instance of the class specified in the 0N/A // role info, or of a subclass of it 0N/A // Note that here again this is under the assumption that 0N/A // referenced MBeans, relation MBeans and the Relation Service are 0N/A // registered in the same MBean Server. 0N/A // Checks it is registered 0N/A // Checks if it is of the correct class 0N/A // Can throw an InstanceNotFoundException, if MBean not registered 0N/A // Initializes roles associated to given role infos to default value (empty 0N/A // ArrayList of ObjectNames) in given relation. 0N/A // It will succeed for every role except if the role info has a minimum 0N/A // cardinality greater than 0. In that case, an InvalidRoleValueException 0N/A // -param relationBaseFlag flag true if the relation is a RelationSupport 0N/A // object, false if it is an MBean 0N/A // -param relationObj RelationSupport object (if relation is internal) 0N/A // -param relationObjName ObjectName of the MBean to be added as a relation 0N/A // (only for the relation MBean) 0N/A // -param relationId relation id 0N/A // -param relationTypeName name of the relation type (has to be created 0N/A // in the Relation Service) 0N/A // -param roleInfoList list of role infos for roles to be defaulted 0N/A // -exception IllegalArgumentException if null paramater 0N/A // -exception RelationServiceNotRegisteredException if the Relation 0N/A // Service is not registered in the MBean Server 0N/A // -exception InvalidRoleValueException if role must have a non-empty 0N/A // Revisit [cebro] Handle CIM qualifiers as REQUIRED to detect roles which 0N/A // should have been initialized by the user 0N/A // Can throw RelationServiceNotRegisteredException 0N/A // For each role info (corresponding to a role not initialized by the 0N/A // role list provided by the user), try to set in the relation a role 0N/A // with an empty list of ObjectNames. 0N/A // A check is performed to verify that the role can be set to an 0N/A // empty value, according to its minimum cardinality 0N/A // Creates an empty value 0N/A // Internal relation 0N/A // Can throw InvalidRoleValueException 0N/A // Will not throw RoleNotFoundException (role to be 0N/A // initialized), or RelationNotFoundException, or 0N/A // RelationTypeNotFoundException 0N/A // Relation is an MBean 0N/A // Use standard setRole() 0N/A // Can throw MBeanException wrapping 0N/A // InvalidRoleValueException. Returns the target exception to 0N/A // Will not throw MBeanException (wrapping 0N/A // RoleNotFoundException or MBeanException) or 0N/A // InstanceNotFoundException, or ReflectionException 0N/A // Again here the assumption is that the Relation Service and 0N/A // the relation MBeans are registered in the same MBean Server. 0N/A "initializeMissingRoles");
0N/A // Throws an exception corresponding to a given problem type 0N/A // -param pbType possible problem, defined in RoleUnresolved 0N/A // -param roleName role name 0N/A // -exception IllegalArgumentException if null parameter 0N/A // -exception RoleNotFoundException for problems: 0N/A // - NO_ROLE_WITH_NAME 0N/A // - ROLE_NOT_READABLE 0N/A // - ROLE_NOT_WRITABLE 0N/A // -exception InvalidRoleValueException for problems: 0N/A // - LESS_THAN_MIN_ROLE_DEGREE 0N/A // - MORE_THAN_MAX_ROLE_DEGREE 0N/A // - REF_MBEAN_OF_INCORRECT_CLASS 0N/A // - REF_MBEAN_NOT_REGISTERED 0N/A // Exception type: 1 = RoleNotFoundException 0N/A // 2 = InvalidRoleValueException 0N/A excMsgPart =
" has a number of MBean references less than the expected minimum degree.";
0N/A excMsgPart =
" has a number of MBean references greater than the expected maximum degree.";
0N/A excMsgPart =
" has an MBean reference to an MBean not of the expected class of references for that role.";
0N/A excMsgPart =
" has a reference to null or to an MBean not registered.";
0N/A // No default as we must have been in one of those cases 0N/A // Sends a notification of given type, with given parameters 0N/A // -param intNtfType integer to represent notification type: 0N/A // -param message human-readable message 0N/A // -param unregMBeanList list of ObjectNames of referenced MBeans 0N/A // expected to be unregistered due to relation removal (only for removal, 0N/A // due to CIM qualifiers, can be null) 0N/A // -param roleName role name 0N/A // -param roleNewValue role new value (ArrayList of ObjectNames) 0N/A // -param oldValue old role value (ArrayList of ObjectNames) 0N/A // -exception IllegalArgument if null parameter 0N/A // -exception RelationNotFoundException if no relation for given id 0N/A // Relation type name 0N/A // Note: do not use getRelationTypeName() as if it is a relation MBean 0N/A // it is already unregistered. 0N/A // ObjectName (for a relation MBean) 0N/A // Can also throw a RelationNotFoundException, but detected above 0N/A // Creation or removal 0N/A "sendNotificationInt");
0N/A // Checks, for the unregistration of an MBean referenced in the roles given 0N/A // in parameter, if the relation has to be removed or not, regarding 0N/A // expected minimum role cardinality and current number of 0N/A // references in each role after removal of the current one. 0N/A // If the relation is kept, calls handleMBeanUnregistration() callback of 0N/A // the relation to update it. 0N/A // -param relationId relation id 0N/A // -param objectName ObjectName of the unregistered MBean 0N/A // -param roleNameList list of names of roles where the unregistered 0N/A // MBean is referenced. 0N/A // -exception IllegalArgumentException if null parameter 0N/A // -exception RelationServiceNotRegisteredException if the Relation 0N/A // Service is not registered in the MBean Server 0N/A // -exception RelationNotFoundException if unknown relation id 0N/A // -exception RoleNotFoundException if one role given as parameter does 0N/A // not exist in the relation 0N/A "handleReferenceUnregistration",
0N/A // Can throw RelationServiceNotRegisteredException 0N/A // Retrieves the relation type name of the relation 0N/A // Can throw RelationNotFoundException 0N/A // Retrieves the relation 0N/A // Can throw RelationNotFoundException, but already detected above 0N/A // Flag to specify if the relation has to be deleted 0N/A // Retrieves number of MBeans currently referenced in role 0N/A // BEWARE! Do not use getRole() as role may be not readable 0N/A // Can throw RelationNotFoundException (but already checked), 0N/A // RoleNotFoundException 0N/A // Retrieves new number of element in role 0N/A // Retrieves role info for that role 0N/A // Shall not throw RelationTypeNotFoundException or 0N/A // RoleInfoNotFoundException 0N/A // Checks with expected minimum number of elements 0N/A // The relation has to be deleted 0N/A // Removes the relation 0N/A // Updates each role in the relation using 0N/A // handleMBeanUnregistration() callback 0N/A // BEWARE: this roleNameList list MUST BE A COPY of a role name 0N/A // list for a referenced MBean in a relation, NOT a 0N/A // reference to an original one part of the 0N/A // myRefedMBeanObjName2RelIdsMap!!!! Because each role 0N/A // which name is in that list will be updated (potentially 0N/A // using setRole(). So the Relation Service will update the 0N/A // myRefedMBeanObjName2RelIdsMap to refelect the new role 0N/A // Internal relation 0N/A // Can throw RoleNotFoundException (but already checked) 0N/A // RelationTypeNotFoundException, 0N/A // InvalidRoleValueException (value was correct, removing 0N/A // one reference shall not invalidate it, else detected 0N/A // Shall not throw InstanceNotFoundException, or 0N/A // MBeanException (wrapping RoleNotFoundException or 0N/A // MBeanException or InvalidRoleValueException) or 0N/A // ReflectionException 0N/A "handleMBeanUnregistration",
0N/A "handleReferenceUnregistration");