|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Referable
org.norther.tammi.core.relation.Relation
public class Relation
A default implementation of a relation MBean.
| Field Summary | |
|---|---|
static String |
RELATION_NOTIF_DESCRIPTION
The notification description. |
static MBeanNotificationInfo[] |
RELATION_NOTIFICATIONS
Relation notifications. |
protected InternalRole |
roleUpdate
The role to be updated and synchronized during use. |
| Fields inherited from class org.norther.tammi.core.base.Referable |
|---|
ID_LENGTH, REFERABLE_ATTRIBUTES, REFERABLE_NOTIF_DESCRIPTION, REFERABLE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.base.ReferableMBean |
|---|
DEFAULT_ID, ID, MBEAN, MBEAN_DESCRIPTION, TYPE |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
Relation()
Constructs a new relation MBean. |
|
Relation(ReferableMBean adapter,
String id,
String name)
Constructs a named relation adaptee. |
|
Relation(ReferableMBean adapter,
String id,
String name,
RoleList roles)
Constructs a named relation adaptee with initial roles. |
|
Relation(ReferableMBean adaptee,
String id,
String name,
RoleList roles,
boolean listener)
Constructs a named relation adapter with initial roles and an actor listener. |
|
Relation(String id,
String name)
Constructs a named relation MBean. |
|
Relation(String id,
String name,
RoleList roles)
Constructs a named relation MBean with initial roles. |
|
Relation(String id,
String name,
RoleList roles,
boolean listener)
Constructs a named relation MBean with initial roles and an actor listener. |
|
| 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. |
RoleResult |
getAllRoles()
Gets all roles present in the relation. |
MBeanNotificationInfo[] |
getNotificationInfo()
|
Map |
getReferencedMBeans()
Gets MBeans referenced in the various roles of the relation. |
String |
getRelationId()
Gets the relation identifier. |
RelationServiceMBean |
getRelationService()
Gets the configurable relation service. |
ObjectName |
getRelationServiceName()
Gets the object name of the relation service hadling the relation. |
String |
getRelationTypeName()
Gets the name of the associated relation type. |
List |
getRole(String theRoleName)
Gets role value for the given role name and checks if the role exists and is readable according to the relation type. |
List |
getRoleActors(String theRoleName)
Gets actors of the specified role. |
Integer |
getRoleCardinality(String theRoleName)
Gets the number of MBeans currently referenced in the given role. |
protected ArrayList |
getRoleDirect(String theRoleName,
boolean forced)
Gets the given role without cloning. |
RoleResult |
getRoles(String[] theRoleNameArray)
Gets values of roles with given names. |
protected Object |
getRoleWithStatus(String theRoleName,
boolean forced)
Gets the given role and return the status. |
void |
handleMBeanUnregistration(ObjectName theObjName,
String theRoleName)
Callback used by the relation service when an MBean referenced in a role is unregistered. |
void |
handleNotification(Notification notif,
Object handback)
A dummy notification handler. |
protected boolean |
isActorInDirectRole(String theRoleName,
ObjectName actor)
Checks directly whether an actor is in the specified role. |
Boolean |
isInRelationService()
Checks whether the relation is still handled by the relation service. |
boolean |
isNamedActorInRole(String theRoleName,
ObjectName actor)
Checks whether an actor is in the specified role. |
void |
postDeregister()
Allows the MBean to perform any operations needed after having been de-registered in the MBean server. |
void |
postRegister(Boolean done)
Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. |
void |
preDeregister()
Allows the MBean to perform any operations it needs before being de-registered by the MBean server. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Allows the MBean to perform any operations it needs before being registered in the MBean server. |
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. |
RoleList |
retrieveAllRoles()
Retrieves all roles in the relation without checking read mode. |
List |
retrieveRole(String theRoleName)
Retrieves actors from the specified role without checking read mode. |
Collection |
roleCollection()
Returns a snapshot collection of roles. |
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. |
void |
setRelationId(String id)
Sets the relation identifier. |
void |
setRelationServiceManagementFlag(Boolean theFlg)
Sets a flag to specify that the relation is handled or not by the relation service. |
void |
setRelationTypeName(String name)
Sets the name of the associated relation type. |
void |
setRole(Role theRole)
Sets the given role and checks if the role exists and is writable according to the relation type. |
protected void |
setRoleDirect(Role theRole,
ObjectName added,
ObjectName removed,
boolean update,
boolean forced)
Sets the given role without cloning. |
RoleResult |
setRoles(RoleList theRoleList)
Sets the given roles. |
protected Object |
setRoleWithStatus(Role theRole,
ObjectName added,
ObjectName removed,
boolean update,
boolean forced)
Sets the given role and returns the status. |
| Methods inherited from class org.norther.tammi.core.base.Referable |
|---|
addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNamePattern, getObjectName, getQueryPattern, getRegistrationTime, getSequenceNumber, getUniqueName, hasListeners, isUnregistered, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, setCanonicalName, setMBeanServer, setNamePattern, setObjectName, setQueryPattern, unregister, unregistered |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.core.base.ReferableMBean |
|---|
getMBean |
| Field Detail |
|---|
public static final String RELATION_NOTIF_DESCRIPTION
public static final MBeanNotificationInfo[] RELATION_NOTIFICATIONS
protected final InternalRole roleUpdate
| Constructor Detail |
|---|
public Relation()
public Relation(String id,
String name)
id - the relation id.name - the relation type name.
public Relation(String id,
String name,
RoleList roles)
id - the relation id.name - the relation type name.roles - an optional role list for initializing the relation.
public Relation(String id,
String name,
RoleList roles,
boolean listener)
id - the relation id.name - the relation type name.roles - an optional role list for initializing the relation.listener - a flag to listen to all actor notifications.
public Relation(ReferableMBean adapter,
String id,
String name)
adapter - the adapter MBean.id - the relation id.name - the relation type name.
public Relation(ReferableMBean adapter,
String id,
String name,
RoleList roles)
adapter - the adapter MBean.id - the relation id.name - the relation type name.roles - an optional role list for initializing the relation.
public Relation(ReferableMBean adaptee,
String id,
String name,
RoleList roles,
boolean listener)
adaptee - the adaptee MBean.id - the relation id.name - the relation type name.roles - an optional role list for initializing the relation.listener - a flag to listen to all actor notifications.| Method Detail |
|---|
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
Referable
preRegister in interface MBeanRegistrationpreRegister in class Referableserver - the MBean server in which the MBean will be registered.name - the object name of the MBean (may be null).
Exception - for errors.public void postRegister(Boolean done)
Referable
postRegister in interface MBeanRegistrationpostRegister in class Referabledone - indicates whether or not the MBean has been registered.
public void preDeregister()
throws Exception
Referable
preDeregister in interface MBeanRegistrationpreDeregister in class ReferableException - on errors.public void postDeregister()
Referable
postDeregister in interface MBeanRegistrationpostDeregister in class Referable
public RoleResult getAllRoles()
throws RelationServiceNotRegisteredException
getAllRoles in interface RelationRelationServiceNotRegisteredException - if the service is not
registered.public Map getReferencedMBeans()
getReferencedMBeans in interface Relationpublic String getRelationId()
getRelationId in interface Relationpublic ObjectName getRelationServiceName()
getRelationServiceName in interface Relationpublic String getRelationTypeName()
getRelationTypeName in interface Relation
public List getRole(String theRoleName)
throws RelationServiceNotRegisteredException,
RoleNotFoundException
getRole in interface RelationtheRoleName - the name of a role.
RoleNotFoundException - if there is no role with the given name.
RelationServiceNotRegisteredException - if the service is not
registered.
public Integer getRoleCardinality(String theRoleName)
throws RoleNotFoundException
getRoleCardinality in interface RelationtheRoleName - the name of a role.
RoleNotFoundException - if there is no role with the given name.
public RoleResult getRoles(String[] theRoleNameArray)
throws RelationServiceNotRegisteredException
getRoles in interface RelationtheRoleNameArray - an array of names of roles to be retrieved.
RelationServiceNotRegisteredException - if the service is not
registered.
public void handleMBeanUnregistration(ObjectName theObjName,
String theRoleName)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
handleMBeanUnregistration in interface RelationtheObjName - the object name of the unregistered MBean.theRoleName - the name of role where the MBean is referenced.
RoleNotFoundException - if there is no role with the 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.public Boolean isInRelationService()
isInRelationService in interface RelationSupportMBeanpublic RoleList retrieveAllRoles()
retrieveAllRoles in interface Relationpublic void setRelationServiceManagementFlag(Boolean theFlg)
setRelationServiceManagementFlag in interface RelationSupportMBeantheFlg - the flag.
public void setRole(Role theRole)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
setRole in interface RelationtheRole - the role to be set.
RoleNotFoundException - if there is no role with the 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.
public RoleResult setRoles(RoleList theRoleList)
throws RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
setRoles in interface RelationtheRoleList - the list of roles to be set.
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.
public RelationServiceMBean getRelationService()
throws RelationServiceNotRegisteredException
RelationMBean
getRelationService in interface RelationMBeanRelationServiceNotRegisteredException - if the service is not
registered.public List retrieveRole(String theRoleName)
RelationMBean
retrieveRole in interface RelationMBeantheRoleName - the name of the role.
public void clearRole(String theRoleName)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
clearRole in interface RelationMBeantheRoleName - the name of the role.
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.
public boolean isNamedActorInRole(String theRoleName,
ObjectName actor)
throws RoleNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
isNamedActorInRole in interface RelationMBeantheRoleName - the name of the role.actor - an actor for the role.
RoleNotFoundException - if there is no role with given name.
RelationServiceNotRegisteredException - if the service is not
registered.
public void setActorName(String theRoleName,
ObjectName actor)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
setActorName in interface RelationMBeantheRoleName - the name of the role.actor - an actor for the role.
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.
public ObjectName setActorName(String theRoleName,
int index,
ObjectName actor)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
setActorName in interface RelationMBeantheRoleName - the name of the role.index - the index of the actor.actor - an actor for the role.
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.
public boolean addActorName(String theRoleName,
ObjectName actor)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
addActorName in interface RelationMBeantheRoleName - the name of the role.actor - an actor for the role.
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.
public boolean addActorName(String theRoleName,
int index,
ObjectName actor)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
addActorName in interface RelationMBeantheRoleName - the name of the role.index - the index of the actor.actor - an actor for the role.
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.
public boolean addActorNames(String theRoleName,
Collection actors)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
addActorNames in interface RelationMBeantheRoleName - the name of the role.actors - a collection of actors for the role.
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.
public boolean removeActorName(String theRoleName,
ObjectName actor)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException
RelationMBean
removeActorName in interface RelationMBeantheRoleName - the name of the role.actor - an actor in the role.
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.
public ObjectName removeActorName(String theRoleName,
int index)
throws RoleNotFoundException,
InvalidRoleValueException,
RelationNotFoundException,
RelationTypeNotFoundException,
RelationServiceNotRegisteredException