org.norther.tammi.core.relation
Interface RelationMBean

All Superinterfaces:
ReferableMBean, Relation, RelationSupportMBean
All Known Subinterfaces:
VariableRootMBean, VariableTreeMBean
All Known Implementing Classes:
Relation, VariableRoot, VariableTree

public interface RelationMBean
extends RelationSupportMBean, ReferableMBean

An interface to referable relations. It maintains direct handles to role actors in addition to their object names. It notifies about role updates with its own notifications instead of the ones provided by the relation service.

Author:
Ilkka Priha

Field Summary
 
Fields inherited from interface org.norther.tammi.core.base.ReferableMBean
DEFAULT_ID, ID, MBEAN, MBEAN_DESCRIPTION, TYPE
 
Method Summary
 boolean addActorName(String theRoleName, int index, ObjectName actor)
          Adds an actor to the specified index of the specified role.
 boolean addActorName(String theRoleName, ObjectName actor)
          Adds an actor to the specified role.
 boolean addActorNames(String theRoleName, Collection actors)
          Adds actors to the specified role.
 void addToService()
          Adds the relation to the relation service.
 void clearRole(String theRoleName)
          Clears all actors from the specified role without checking write mode.
 Object getActor(String theRoleName)
          Gets the first actor of the specified role.
 Object getActor(String theRoleName, int index)
          Gets the indexed actor of the specified role.
 Object getActor(String theRoleName, ObjectName actor)
          Gets the named actor of the specified role.
 ObjectName getActorName(String theRoleName)
          Gets the first actor of the specified role.
 ObjectName getActorName(String theRoleName, int index)
          Gets the indexed actor of the specified role.
 RelationServiceMBean getRelationService()
          Gets the configurable relation service.
 List getRoleActors(String theRoleName)
          Gets actors of the specified role.
 boolean isNamedActorInRole(String theRoleName, ObjectName actor)
          Checks whether an actor is in the specified role.
 ObjectName removeActorName(String theRoleName, int index)
          Removes an indexed actor from the specified role.
 boolean removeActorName(String theRoleName, ObjectName actor)
          Removes an actor from the specified role.
 boolean removeActorNames(String theRoleName, Collection actors)
          Removes actors from the specified role.
 void removeFromService()
          Removes the relation the relation service.
 List retrieveRole(String theRoleName)
          Retrieves actors from the specified role without checking read mode.
 ObjectName setActorName(String theRoleName, int index, ObjectName actor)
          Sets the indexed actor of the specified role.
 void setActorName(String theRoleName, ObjectName actor)
          Sets an actor to be the only one for the specified role.
 
Methods inherited from interface javax.management.relation.RelationSupportMBean
isInRelationService, setRelationServiceManagementFlag
 
Methods inherited from interface javax.management.relation.Relation
getAllRoles, getReferencedMBeans, getRelationId, getRelationServiceName, getRelationTypeName, getRole, getRoleCardinality, getRoles, handleMBeanUnregistration, retrieveAllRoles, setRole, setRoles
 
Methods inherited from interface org.norther.tammi.core.base.ReferableMBean
getMBean
 

Method Detail

getRelationService

RelationServiceMBean getRelationService()
                                        throws RelationServiceNotRegisteredException
Gets the configurable relation service.

Returns:
the relation service.
Throws:
RelationServiceNotRegisteredException - if the service is not registered.

retrieveRole

List retrieveRole(String theRoleName)
Retrieves actors from the specified role without checking read mode.

Parameters:
theRoleName - the name of the role.
Returns:
the role value or an empty list.

clearRole

void clearRole(String theRoleName)
               throws RoleNotFoundException,
                      InvalidRoleValueException,
                      RelationNotFoundException,
                      RelationTypeNotFoundException,
                      RelationServiceNotRegisteredException
Clears all actors from the specified role without checking write mode.

Parameters:
theRoleName - the name of the role.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.

isNamedActorInRole

boolean isNamedActorInRole(String theRoleName,
                           ObjectName actor)
                           throws RoleNotFoundException,
                                  RelationServiceNotRegisteredException
Checks whether an actor is in the specified role.

Parameters:
theRoleName - the name of the role.
actor - an actor for the role.
Returns:
true if the actor is in the role, otherwise false.
Throws:
RoleNotFoundException - if there is no role with given name.
RelationServiceNotRegisteredException - if the service is not registered.

setActorName

void setActorName(String theRoleName,
                  ObjectName actor)
                  throws RoleNotFoundException,
                         InvalidRoleValueException,
                         RelationNotFoundException,
                         RelationTypeNotFoundException,
                         RelationServiceNotRegisteredException
Sets an actor to be the only one for the specified role.

Parameters:
theRoleName - the name of the role.
actor - an actor for the role.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.

setActorName

ObjectName setActorName(String theRoleName,
                        int index,
                        ObjectName actor)
                        throws RoleNotFoundException,
                               InvalidRoleValueException,
                               RelationNotFoundException,
                               RelationTypeNotFoundException,
                               RelationServiceNotRegisteredException
Sets the indexed actor of the specified role.

Parameters:
theRoleName - the name of the role.
index - the index of the actor.
actor - an actor for the role.
Returns:
the previous actor of the index and role.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.
IndexOutOfBoundsException - if the index is not within the limits.

addActorName

boolean addActorName(String theRoleName,
                     ObjectName actor)
                     throws RoleNotFoundException,
                            InvalidRoleValueException,
                            RelationNotFoundException,
                            RelationTypeNotFoundException,
                            RelationServiceNotRegisteredException
Adds an actor to the specified role.

Parameters:
theRoleName - the name of the role.
actor - an actor for the role.
Returns:
true if the actor was added, false if it existed already.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.

addActorName

boolean addActorName(String theRoleName,
                     int index,
                     ObjectName actor)
                     throws RoleNotFoundException,
                            InvalidRoleValueException,
                            RelationNotFoundException,
                            RelationTypeNotFoundException,
                            RelationServiceNotRegisteredException
Adds an actor to the specified index of the specified role.

Parameters:
theRoleName - the name of the role.
index - the index of the actor.
actor - an actor for the role.
Returns:
true if the actor was added, false if it existed already.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.
IndexOutOfBoundsException - if the index is not within the limits.

addActorNames

boolean addActorNames(String theRoleName,
                      Collection actors)
                      throws RoleNotFoundException,
                             InvalidRoleValueException,
                             RelationNotFoundException,
                             RelationTypeNotFoundException,
                             RelationServiceNotRegisteredException
Adds actors to the specified role.

Parameters:
theRoleName - the name of the role.
actors - a collection of actors for the role.
Returns:
true if any new actors were added, otherwe false.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.

removeActorName

boolean removeActorName(String theRoleName,
                        ObjectName actor)
                        throws RoleNotFoundException,
                               InvalidRoleValueException,
                               RelationNotFoundException,
                               RelationTypeNotFoundException,
                               RelationServiceNotRegisteredException
Removes an actor from the specified role.

Parameters:
theRoleName - the name of the role.
actor - an actor in the role.
Returns:
true if removed, otherwise false.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.

removeActorName

ObjectName removeActorName(String theRoleName,
                           int index)
                           throws RoleNotFoundException,
                                  InvalidRoleValueException,
                                  RelationNotFoundException,
                                  RelationTypeNotFoundException,
                                  RelationServiceNotRegisteredException
Removes an indexed actor from the specified role.

Parameters:
theRoleName - the name of the role.
index - the index of the actor.
Returns:
the removed actor or null.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.
IndexOutOfBoundsException - if the index is not within the limits.

removeActorNames

boolean removeActorNames(String theRoleName,
                         Collection actors)
                         throws RoleNotFoundException,
                                InvalidRoleValueException,
                                RelationNotFoundException,
                                RelationTypeNotFoundException,
                                RelationServiceNotRegisteredException
Removes actors from the specified role.

Parameters:
theRoleName - the name of the role.
actors - a collection of actors to remove.
Returns:
true if any actors were removed, otherwise false.
Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRoleValueException - if the value provided for the role is not valid.
RelationNotFoundException - if the relation has not been added in the service.
RelationTypeNotFoundException - if the relation type has not been declared.
RelationServiceNotRegisteredException - if the service is not registered.
IndexOutOfBoundsException - if the index is not within the limits.

getActorName

ObjectName getActorName(String theRoleName)
                        throws RoleNotFoundException,
                               RelationServiceNotRegisteredException
Gets the first actor of the specified role.

Parameters:
theRoleName - the name of the role.
Returns:
the first actor of the role or null.
Throws:
RoleNotFoundException - if there is no role with given name.
RelationServiceNotRegisteredException - if the service is not registered.

getActorName

ObjectName getActorName(String theRoleName,
                        int index)
                        throws RoleNotFoundException,
                               RelationServiceNotRegisteredException
Gets the indexed actor of the specified role.

Parameters:
theRoleName - the name of the role.
index - the index of the actor.
Returns:
the indexed actor of the role or null.
Throws:
RoleNotFoundException - if there is no role with given name.
RelationServiceNotRegisteredException - if the service is not registered.
IndexOutOfBoundsException - if the index is not within the limits.

getActor

Object getActor(String theRoleName)
Gets the first actor of the specified role.

Parameters:
theRoleName - the name of the role.
Returns:
the actor or null if not available.

getActor

Object getActor(String theRoleName,
                int index)
Gets the indexed actor of the specified role.

Parameters:
theRoleName - the name of the role.
index - the index of the actor.
Returns:
the actor or null if not available.
Throws:
IndexOutOfBoundsException - if the index is not within the limits.

getActor

Object getActor(String theRoleName,
                ObjectName actor)
Gets the named actor of the specified role.

Parameters:
theRoleName - the name of the role.
actor - an actor in the role.
Returns:
the actor or null if not available.

getRoleActors

List getRoleActors(String theRoleName)
Gets actors of the specified role.

Parameters:
theRoleName - the name of the role.
Returns:
a list of actors or an empty list if not available.

addToService

void addToService()
                  throws RoleNotFoundException,
                         InvalidRelationIdException,
                         InvalidRoleValueException,
                         InstanceNotFoundException,
                         RelationTypeNotFoundException,
                         InvalidRelationServiceException,
                         RelationServiceNotRegisteredException
Adds the relation to the relation service.

Throws:
RoleNotFoundException - if there is no role with given name.
InvalidRelationIdException - if the relation id is not valid.
InvalidRoleValueException - if the value provided for the role is not valid.
InstanceNotFoundException - if the relation has not been registered.
RelationTypeNotFoundException - if the relation type has not been declared.
InvalidRelationServiceException - if the service is not the correct one.
RelationServiceNotRegisteredException - if the service is not registered.

removeFromService

void removeFromService()
Removes the relation the relation service.



Copyright © 2004 The Norther Organization. All rights reserved.