-
- All Known Subinterfaces:
- RelationSupportMBean
- All Known Implementing Classes:
- RelationSupport
public interface Relation
This interface has to be implemented by any MBean class expected to represent a relation managed using the Relation Service.Simple relations, i.e. having only roles, no properties or methods, can be created directly by the Relation Service (represented as RelationSupport objects, internally handled by the Relation Service).
If the user wants to represent more complex relations, involving properties and/or methods, he has to provide his own class implementing the Relation interface. This can be achieved either by inheriting from RelationSupport class, or by implementing the interface (fully or delegation to a RelationSupport object member).
Specifying such user relation class is to introduce properties and/or methods. Those have to be exposed for remote management. So this means that any user relation class must be a MBean class.
- Since:
- 1.5
-
-
Method Summary
Methods Modifier and Type Method and Description RoleResult
getAllRoles()
Returns all roles present in the relation.Map<ObjectName,List<String>>
getReferencedMBeans()
Retrieves MBeans referenced in the various roles of the relation.String
getRelationId()
Returns relation identifier (used to uniquely identify the relation inside the Relation Service).ObjectName
getRelationServiceName()
Returns ObjectName of the Relation Service handling the relation.String
getRelationTypeName()
Returns name of associated relation type.List<ObjectName>
getRole(String roleName)
Retrieves role value for given role name.Integer
getRoleCardinality(String roleName)
Returns the number of MBeans currently referenced in the given role.RoleResult
getRoles(String[] roleNameArray)
Retrieves values of roles with given names.void
handleMBeanUnregistration(ObjectName objectName, String roleName)
Callback used by the Relation Service when a MBean referenced in a role is unregistered.RoleList
retrieveAllRoles()
Returns all roles in the relation without checking read mode.void
setRole(Role role)
Sets the given role.RoleResult
setRoles(RoleList roleList)
Sets the given roles.
-
-
-
Method Detail
-
getRole
List<ObjectName> getRole(String roleName) throws IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException
Retrieves role value for given role name.Checks if the role exists and is readable according to the relation type.
- Parameters:
roleName
- name of role- Returns:
- the ArrayList of ObjectName objects being the role value
- Throws:
IllegalArgumentException
- if null role nameRoleNotFoundException
- if:- there is no role with given name
- the role is not readable.
RelationServiceNotRegisteredException
- if the Relation Service is not registered in the MBean Server- See Also:
setRole(javax.management.relation.Role)
-
getRoles
RoleResult getRoles(String[] roleNameArray) throws IllegalArgumentException, RelationServiceNotRegisteredException
Retrieves values of roles with given names.Checks for each role if it exists and is readable according to the relation type.
- Parameters:
roleNameArray
- array of names of roles to be retrieved- Returns:
- a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not retrieved).
- Throws:
IllegalArgumentException
- if null role nameRelationServiceNotRegisteredException
- if the Relation Service is not registered in the MBean Server- See Also:
setRoles(javax.management.relation.RoleList)
-
getRoleCardinality
Integer getRoleCardinality(String roleName) throws IllegalArgumentException, RoleNotFoundException
Returns the number of MBeans currently referenced in the given role.- Parameters:
roleName
- name of role- Returns:
- the number of currently referenced MBeans in that role
- Throws:
IllegalArgumentException
- if null role nameRoleNotFoundException
- if there is no role with given name
-
getAllRoles
RoleResult getAllRoles() throws RelationServiceNotRegisteredException
Returns all roles present in the relation.- Returns:
- a RoleResult object, including a RoleList (for roles successfully retrieved) and a RoleUnresolvedList (for roles not readable).
- Throws:
RelationServiceNotRegisteredException
- if the Relation Service is not registered in the MBean Server
-
retrieveAllRoles
RoleList retrieveAllRoles()
Returns all roles in the relation without checking read mode.- Returns:
- a RoleList.
-
setRole
void setRole(Role role) throws IllegalArgumentException, RoleNotFoundException, RelationTypeNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationNotFoundException
Sets the given role.Will check the role according to its corresponding role definition provided in relation's relation type
Will send a notification (RelationNotification with type RELATION_BASIC_UPDATE or RELATION_MBEAN_UPDATE, depending if the relation is a MBean or not).
- Parameters:
role
- role to be set (name and new value)- Throws:
IllegalArgumentException
- if null roleRoleNotFoundException
- if there is no role with the supplied role's name or if the role is not writable (no test on the write access mode performed when initializing the role)InvalidRoleValueException
- if value provided for role is not valid, i.e.:- the number of referenced MBeans in given value is less than expected minimum degree
- the number of referenced MBeans in provided value exceeds expected maximum degree
- one referenced MBean in the value is not an Object of the MBean class expected for that role
- a MBean provided for that role does not exist.
RelationServiceNotRegisteredException
- if the Relation Service is not registered in the MBean ServerRelationTypeNotFoundException
- if the relation type has not been declared in the Relation Service.RelationNotFoundException
- if the relation has not been added in the Relation Service.- See Also:
getRole(java.lang.String)
-
setRoles
RoleResult setRoles(RoleList roleList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
Sets the given roles.Will check the role according to its corresponding role definition provided in relation's relation type
Will send one notification (RelationNotification with type RELATION_BASIC_UPDATE or RELATION_MBEAN_UPDATE, depending if the relation is a MBean or not) per updated role.
- Parameters:
roleList
- list of roles to be set- Returns:
- a RoleResult object, including a RoleList (for roles successfully set) and a RoleUnresolvedList (for roles not set).
- Throws:
IllegalArgumentException
- if null role listRelationServiceNotRegisteredException
- if the Relation Service is not registered in the MBean ServerRelationTypeNotFoundException
- if the relation type has not been declared in the Relation Service.RelationNotFoundException
- if the relation MBean has not been added in the Relation Service.- See Also:
getRoles(java.lang.String[])
-
handleMBeanUnregistration
void handleMBeanUnregistration(ObjectName objectName, String roleName) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException
Callback used by the Relation Service when a MBean referenced in a role is unregistered.The Relation Service will call this method to let the relation take action to reflect the impact of such unregistration.
BEWARE. the user is not expected to call this method.
Current implementation is to set the role with its current value (list of ObjectNames of referenced MBeans) without the unregistered one.
- Parameters:
objectName
- ObjectName of unregistered MBeanroleName
- name of role where the MBean is referenced- Throws:
IllegalArgumentException
- if null parameterRoleNotFoundException
- if role does not exist in the relation or is not writableInvalidRoleValueException
- if role value does not conform to the associated role info (this will never happen when called from the Relation Service)RelationServiceNotRegisteredException
- if the Relation Service is not registered in the MBean ServerRelationTypeNotFoundException
- if the relation type has not been declared in the Relation Service.RelationNotFoundException
- if this method is called for a relation MBean not added in the Relation Service.
-
getReferencedMBeans
Map<ObjectName,List<String>> getReferencedMBeans()
Retrieves MBeans referenced in the various roles of the relation.- Returns:
- a HashMap mapping:
ObjectName -> ArrayList of String (role names)
-
getRelationTypeName
String getRelationTypeName()
Returns name of associated relation type.- Returns:
- the name of the relation type.
-
getRelationServiceName
ObjectName getRelationServiceName()
Returns ObjectName of the Relation Service handling the relation.- Returns:
- the ObjectName of the Relation Service.
-
getRelationId
String getRelationId()
Returns relation identifier (used to uniquely identify the relation inside the Relation Service).- Returns:
- the relation id.
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/management/relation/relation.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.