0N/A/*
2362N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
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
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
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 *
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 *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.management.relation;
0N/A
0N/Aimport javax.management.ObjectName;
0N/Aimport javax.management.InstanceNotFoundException;
0N/A
0N/Aimport java.util.List;
0N/Aimport java.util.Map;
0N/A
0N/A/**
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 * mechanisms.
0N/A *
0N/A * @since 1.5
0N/A */
0N/Apublic interface RelationServiceMBean {
0N/A
0N/A /**
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 * MBean Server
0N/A *
0N/A * @exception RelationServiceNotRegisteredException if it is not
0N/A * registered
0N/A */
0N/A public void isActive()
0N/A throws RelationServiceNotRegisteredException;
0N/A
0N/A //
0N/A // Accessors
0N/A //
0N/A
0N/A /**
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 is explicitly called.
0N/A * <P>true is immediate purge.
0N/A *
0N/A * @return true if purges are immediate.
0N/A *
0N/A * @see #setPurgeFlag
0N/A */
0N/A public boolean getPurgeFlag();
0N/A
0N/A /**
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 is explicitly called.
0N/A * <P>true is immediate purge.
0N/A *
0N/A * @param purgeFlag flag
0N/A *
0N/A * @see #getPurgeFlag
0N/A */
0N/A public void setPurgeFlag(boolean purgeFlag);
0N/A
0N/A //
0N/A // Relation type handling
0N/A //
0N/A
0N/A /**
0N/A * Creates a relation type (RelationTypeSupport object) with given
0N/A * role infos (provided by the RoleInfo objects), and adds it in the
0N/A * Relation Service.
0N/A *
0N/A * @param relationTypeName name of the relation type
0N/A * @param roleInfoArray array of role infos
0N/A *
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 */
0N/A public void createRelationType(String relationTypeName,
0N/A RoleInfo[] roleInfoArray)
0N/A throws IllegalArgumentException,
0N/A InvalidRelationTypeException;
0N/A
0N/A /**
0N/A * Adds given object as a relation type. The object is expected to
0N/A * implement the RelationType interface.
0N/A *
0N/A * @param relationTypeObj relation type object (implementing the
0N/A * RelationType interface)
0N/A *
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 there is already a relation
0N/A * type with that name
0N/A */
0N/A public void addRelationType(RelationType relationTypeObj)
0N/A throws IllegalArgumentException,
0N/A InvalidRelationTypeException;
0N/A
0N/A /**
0N/A * Retrieves names of all known relation types.
0N/A *
0N/A * @return ArrayList of relation type names (Strings)
0N/A */
0N/A public List<String> getAllRelationTypeNames();
0N/A
0N/A /**
0N/A * Retrieves list of role infos (RoleInfo objects) of a given relation
0N/A * type.
0N/A *
0N/A * @param relationTypeName name of relation type
0N/A *
0N/A * @return ArrayList of RoleInfo.
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationTypeNotFoundException if there is no relation type
0N/A * with that name.
0N/A */
0N/A public List<RoleInfo> getRoleInfos(String relationTypeName)
0N/A throws IllegalArgumentException,
0N/A RelationTypeNotFoundException;
0N/A
0N/A /**
0N/A * Retrieves role info for given role of a given relation type.
0N/A *
0N/A * @param relationTypeName name of relation type
0N/A * @param roleInfoName name of role
0N/A *
0N/A * @return RoleInfo object.
0N/A *
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 * relation type.
0N/A */
0N/A public RoleInfo getRoleInfo(String relationTypeName,
0N/A String roleInfoName)
0N/A throws IllegalArgumentException,
0N/A RelationTypeNotFoundException,
0N/A RoleInfoNotFoundException;
0N/A
0N/A /**
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 * Relation Service.
0N/A *
0N/A * @param relationTypeName name of the relation type to be removed
0N/A *
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 * with that name
0N/A */
0N/A public void removeRelationType(String relationTypeName)
0N/A throws RelationServiceNotRegisteredException,
0N/A IllegalArgumentException,
0N/A RelationTypeNotFoundException;
0N/A
0N/A //
0N/A // Relation handling
0N/A //
0N/A
0N/A /**
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 *
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 * be null).
0N/A *
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 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 * Relation Service
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 * maximum degree
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 */
0N/A public void createRelation(String relationId,
0N/A String relationTypeName,
0N/A RoleList roleList)
0N/A throws RelationServiceNotRegisteredException,
0N/A IllegalArgumentException,
0N/A RoleNotFoundException,
0N/A InvalidRelationIdException,
0N/A RelationTypeNotFoundException,
0N/A InvalidRoleValueException;
0N/A
0N/A /**
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 * following:
0N/A * <P>- implement the Relation interface
0N/A * <P>- have for RelationService ObjectName the ObjectName of current
0N/A * Relation Service
0N/A * <P>- have a relation id that is unique and unused in current Relation Service
0N/A * <P>- have for relation type a relation type created in the Relation
0N/A * Service
0N/A * <P>- have roles conforming to the role info provided in the relation
0N/A * type.
0N/A *
0N/A * @param relationObjectName ObjectName of the relation MBean to be added.
0N/A *
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 * maximum degree
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 */
0N/A public void addRelation(ObjectName relationObjectName)
0N/A throws IllegalArgumentException,
0N/A RelationServiceNotRegisteredException,
0N/A NoSuchMethodException,
0N/A InvalidRelationIdException,
0N/A InstanceNotFoundException,
0N/A InvalidRelationServiceException,
0N/A RelationTypeNotFoundException,
0N/A RoleNotFoundException,
0N/A InvalidRoleValueException;
0N/A
0N/A /**
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 * the MBean.
0N/A *
0N/A * @param relationId relation id identifying the relation
0N/A *
0N/A * @return ObjectName of the corresponding relation MBean, or null if
0N/A * the relation is not an MBean.
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationNotFoundException there is no relation associated
0N/A * to that id
0N/A */
0N/A public ObjectName isRelationMBean(String relationId)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
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 *
0N/A * @param objectName ObjectName of supposed relation
0N/A *
0N/A * @return relation id (String) or null (if the ObjectName is not a
0N/A * relation handled by the Relation Service)
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A */
0N/A public String isRelation(ObjectName objectName)
0N/A throws IllegalArgumentException;
0N/A
0N/A /**
0N/A * Checks if there is a relation identified in Relation Service with given
0N/A * relation id.
0N/A *
0N/A * @param relationId relation id identifying the relation
0N/A *
0N/A * @return boolean: true if there is a relation, false else
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A */
0N/A public Boolean hasRelation(String relationId)
0N/A throws IllegalArgumentException;
0N/A
0N/A /**
0N/A * Returns all the relation ids for all the relations handled by the
0N/A * Relation Service.
0N/A *
0N/A * @return ArrayList of String
0N/A */
0N/A public List<String> getAllRelationIds();
0N/A
0N/A /**
0N/A * Checks if given Role can be read in a relation of the given type.
0N/A *
0N/A * @param roleName name of role to be checked
0N/A * @param relationTypeName name of the relation type
0N/A *
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 *
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 */
0N/A public Integer checkRoleReading(String roleName,
0N/A String relationTypeName)
0N/A throws IllegalArgumentException,
0N/A RelationTypeNotFoundException;
0N/A
0N/A /**
0N/A * Checks if given Role can be set in a relation of given type.
0N/A *
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 *
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 *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationTypeNotFoundException if unknown relation type
0N/A */
0N/A public Integer checkRoleWriting(Role role,
0N/A String relationTypeName,
0N/A Boolean initFlag)
0N/A throws IllegalArgumentException,
0N/A RelationTypeNotFoundException;
0N/A
0N/A /**
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 *
0N/A * @param relationId relation identifier of the updated relation
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationNotFoundException if there is no relation for given
0N/A * relation id
0N/A */
0N/A public void sendRelationCreationNotification(String relationId)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
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 *
0N/A * @param relationId relation identifier of the updated relation
0N/A * @param newRole new role (name and new value)
0N/A * @param oldRoleValue old role value (List of ObjectName objects)
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationNotFoundException if there is no relation for given
0N/A * relation id
0N/A */
0N/A public void sendRoleUpdateNotification(String relationId,
0N/A Role newRole,
0N/A List<ObjectName> oldRoleValue)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
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 *
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 *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationNotFoundException if there is no relation for given
0N/A * relation id
0N/A */
0N/A public void sendRelationRemovalNotification(String relationId,
0N/A List<ObjectName> unregMBeanList)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
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 *
0N/A * @param relationId relation identifier of the updated relation
0N/A * @param newRole new role (name and new value)
0N/A * @param oldRoleValue old role value (List of ObjectName objects)
0N/A *
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 */
0N/A public void updateRoleMap(String relationId,
0N/A Role newRole,
0N/A List<ObjectName> oldRoleValue)
0N/A throws IllegalArgumentException,
0N/A RelationServiceNotRegisteredException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
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 *
0N/A * @param relationId relation id of the relation to be removed
0N/A *
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 * given relation id
0N/A */
0N/A public void removeRelation(String relationId)
0N/A throws RelationServiceNotRegisteredException,
0N/A IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
0N/A * Purges the relations.
0N/A *
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 *
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 *
0N/A * @exception RelationServiceNotRegisteredException if the Relation
0N/A * Service is not registered in the MBean Server.
0N/A */
0N/A public void purgeRelations()
0N/A throws RelationServiceNotRegisteredException;
0N/A
0N/A /**
0N/A * Retrieves the relations where a given MBean is referenced.
0N/A * <P>This corresponds to the CIM "References" and "ReferenceNames"
0N/A * operations.
0N/A *
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 * 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 returned. Else all
0N/A * roles are considered.
0N/A *
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 *
0N/A * @exception IllegalArgumentException if null parameter
0N/A */
0N/A public Map<String,List<String>>
0N/A findReferencingRelations(ObjectName mbeanName,
0N/A String relationTypeName,
0N/A String roleName)
0N/A throws IllegalArgumentException;
0N/A
0N/A /**
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 *
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 *
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 * relations).
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A */
0N/A public Map<ObjectName,List<String>>
0N/A findAssociatedMBeans(ObjectName mbeanName,
0N/A String relationTypeName,
0N/A String roleName)
0N/A throws IllegalArgumentException;
0N/A
0N/A /**
0N/A * Returns the relation ids for relations of the given type.
0N/A *
0N/A * @param relationTypeName relation type name
0N/A *
0N/A * @return an ArrayList of relation ids.
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationTypeNotFoundException if there is no relation type
0N/A * with that name.
0N/A */
0N/A public List<String> findRelationsOfType(String relationTypeName)
0N/A throws IllegalArgumentException,
0N/A RelationTypeNotFoundException;
0N/A
0N/A /**
0N/A * Retrieves role value for given role name in given relation.
0N/A *
0N/A * @param relationId relation id
0N/A * @param roleName name of role
0N/A *
0N/A * @return the ArrayList of ObjectName objects being the role value
0N/A *
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>or
0N/A * <P>- the role is not readable.
0N/A *
0N/A * @see #setRole
0N/A */
0N/A public List<ObjectName> getRole(String relationId,
0N/A String roleName)
0N/A throws RelationServiceNotRegisteredException,
0N/A IllegalArgumentException,
0N/A RelationNotFoundException,
0N/A RoleNotFoundException;
0N/A
0N/A /**
0N/A * Retrieves values of roles with given names in given relation.
0N/A *
0N/A * @param relationId relation id
0N/A * @param roleNameArray array of names of roles to be retrieved
0N/A *
0N/A * @return a RoleResult object, including a RoleList (for roles
0N/A * successfully retrieved) and a RoleUnresolvedList (for roles not
0N/A * retrieved).
0N/A *
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 *
0N/A * @see #setRoles
0N/A */
0N/A public RoleResult getRoles(String relationId,
0N/A String[] roleNameArray)
0N/A throws RelationServiceNotRegisteredException,
0N/A IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
0N/A * Returns all roles present in the relation.
0N/A *
0N/A * @param relationId relation id
0N/A *
0N/A * @return a RoleResult object, including a RoleList (for roles
0N/A * successfully retrieved) and a RoleUnresolvedList (for roles not
0N/A * readable).
0N/A *
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 */
0N/A public RoleResult getAllRoles(String relationId)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException,
0N/A RelationServiceNotRegisteredException;
0N/A
0N/A /**
0N/A * Retrieves the number of MBeans currently referenced in the
0N/A * given role.
0N/A *
0N/A * @param relationId relation id
0N/A * @param roleName name of role
0N/A *
0N/A * @return the number of currently referenced MBeans in that role
0N/A *
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 */
0N/A public Integer getRoleCardinality(String relationId,
0N/A String roleName)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException,
0N/A RoleNotFoundException;
0N/A
0N/A /**
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 *
0N/A * @param relationId relation id
0N/A * @param role role to be set (name and new value)
0N/A *
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:
0N/A * <P>- internal relation
0N/A * <P>and
0N/A * <P>- the role does not exist or is not writable
0N/A * @exception InvalidRoleValueException if internal relation and value
0N/A * provided for role is not valid:
0N/A * <P>- the number of referenced MBeans in given value is less than
0N/A * expected minimum degree
0N/A * <P>or
0N/A * <P>- the number of referenced MBeans in provided value exceeds expected
0N/A * maximum degree
0N/A * <P>or
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>or
0N/A * <P>- an MBean provided for that role does not exist
0N/A * @exception RelationTypeNotFoundException if unknown relation type
0N/A *
0N/A * @see #getRole
0N/A */
0N/A public void setRole(String relationId,
0N/A Role role)
0N/A throws RelationServiceNotRegisteredException,
0N/A IllegalArgumentException,
0N/A RelationNotFoundException,
0N/A RoleNotFoundException,
0N/A InvalidRoleValueException,
0N/A RelationTypeNotFoundException;
0N/A
0N/A /**
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 *
0N/A * @param relationId relation id
0N/A * @param roleList list of roles to be set
0N/A *
0N/A * @return a RoleResult object, including a RoleList (for roles
0N/A * successfully set) and a RoleUnresolvedList (for roles not
0N/A * set).
0N/A *
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 *
0N/A * @see #getRoles
0N/A */
0N/A public RoleResult setRoles(String relationId,
0N/A RoleList roleList)
0N/A throws RelationServiceNotRegisteredException,
0N/A IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
0N/A * Retrieves MBeans referenced in the various roles of the relation.
0N/A *
0N/A * @param relationId relation id
0N/A *
0N/A * @return a HashMap mapping:
0N/A * <P> ObjectName -> ArrayList of String (role
0N/A * names)
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationNotFoundException if no relation for given
0N/A * relation id
0N/A */
0N/A public Map<ObjectName,List<String>> getReferencedMBeans(String relationId)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A
0N/A /**
0N/A * Returns name of associated relation type for given relation.
0N/A *
0N/A * @param relationId relation id
0N/A *
0N/A * @return the name of the associated relation type.
0N/A *
0N/A * @exception IllegalArgumentException if null parameter
0N/A * @exception RelationNotFoundException if no relation for given
0N/A * relation id
0N/A */
0N/A public String getRelationTypeName(String relationId)
0N/A throws IllegalArgumentException,
0N/A RelationNotFoundException;
0N/A}