|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjawiro.Actor
public class Actor
Real world entities are modeled with a jawiro.Actor
instance and the required number of jawiro.Role
and/or jawiro.AggregateRole instances.
All those instances create a tree structure, e.g. a role
hierarchy, where the Actor instance is the root.
Role,
AggregateRole| Field Summary | |
|---|---|
java.lang.Class |
myClass
Keeps the type name to eliminate the need of calling the costly Object.getClass() method. |
java.lang.String |
myClassName
Keeps the type name to eliminate the need of calling the costly Object.getClass().getName() method. |
| Constructor Summary | |
|---|---|
Actor()
The default constructor. |
|
| Method Summary | |
|---|---|
boolean |
addRole(Role aNewRole)
Adds a new role to this object if it will not cause any ambiguities or role binding anomalies. |
java.lang.Object |
as(java.lang.Class roleClass)
The role switching command for regular roles. |
java.lang.Object |
as(java.lang.Class roleClass,
java.lang.String identifier)
The role switching command for aggregate roles. |
java.lang.Object |
as(java.lang.String className)
The role switching command for regular roles. |
java.lang.Object |
as(java.lang.String className,
java.lang.String identifier)
The role switching command for aggregate roles. |
java.lang.Object |
bringLocalMember(java.lang.String name)
Method for accessing a member field of this object. |
java.lang.Object |
bringMember(java.lang.String name)
Method for member field access without referring its owner. |
boolean |
canDelegate(Role aRole)
Checks whether a given role object exists in the same role hierarchy with this object. |
boolean |
canSwitch(java.lang.Class roleClass)
Checks whether this object has the given role type. |
boolean |
canSwitch(java.lang.Class roleClass,
java.lang.String identifier)
Checks whether this object has the given role type. |
boolean |
canSwitch(java.lang.String className)
Checks whether this object has the given role type. |
boolean |
canSwitch(java.lang.String className,
java.lang.String identifier)
Checks whether this object has the given role type. |
void |
dominateSearch(boolean dominate)
Method for determining this object as dominant. |
void |
enableDelegation(boolean use)
Enables the use of the delegation mechanism. |
java.lang.Object |
executeLocalMethod(java.lang.String name,
java.lang.Object... parameters)
Method for executing a member method of an Actor object. |
java.lang.Object |
executeMethod(java.lang.String name,
java.lang.Object... parameters)
Method for member method access without referring its owner. |
Actor |
getActor()
|
java.lang.String |
getClassName()
Method for finding the class name of an object. |
jawiro.ConstraintStrategy |
getConstraintManager()
Returns the constraint manager assigned to this role hierarchy. |
int |
getDepth()
Returns how deep this object resides in its role hierarchy. |
boolean |
getReflectionPrePopulationMode()
Shows the prepopulation behaviour for the entire hierarchy. |
jawiro.RoleList |
getRoleList()
Used for internal operations of JAWIRO. |
java.lang.Object |
getSelf()
Gives access to the self member which is used
in the delegation mechanism. |
boolean |
isDelegationEnabled()
Checks whether the use of the delegation mechanism is enabled or not. |
boolean |
isDelegationUsed()
Checks whether the delegation mechanism or the consultation mechanism is used. |
boolean |
isDominant()
Method for checking whether this object is dominant or not. |
void |
prePopulateReflectionTables(boolean prePopulate)
Determines the prepopulation behaviour for member and method tables for the entire hierarchy. |
boolean |
receiveRole(Role r)
Although this method is public, it belongs
to the inner workings of JAWIRO and a flagging mechanism
prevents its usage from outside of the jawiro
package. |
void |
removeAllDominance()
Removes the dominance marks of every participant of the role hierarchy. |
boolean |
resumeRole(java.lang.String className)
Method for resuming a jawiro.Role object of a
known type name, when the reference to this role is unavailable. |
boolean |
resumeRole(java.lang.String className,
java.lang.String identifier)
Method for resuming a jawiro.AggregateRole object
of whose type name and identifier is known, when the reference to
this role is unavailable. |
void |
setConstraintManager(jawiro.ConstraintStrategy cstr)
Assigns a constraint manager to this role hierarchy. |
boolean |
suspendRole(java.lang.String className)
The alternative way for suspending a role. |
boolean |
suspendRole(java.lang.String className,
java.lang.String identifier)
The alternative way for suspending an aggregate role. |
void |
useConsultation()
Switches to the consultation mechanism. |
void |
useDelegation()
Switches to the delegation mechanism. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.lang.String myClassName
Object.getClass().getName() method.
public final java.lang.Class myClass
Object.getClass() method.
| Constructor Detail |
|---|
public Actor()
enableDelegation(boolean),
prePopulateReflectionTables(boolean)| Method Detail |
|---|
public boolean addRole(Role aNewRole)
addRole in interface RoleInterfaceaNewRole - The new role to be added.
true if this operation is successful.RoleInterface.addRole(jawiro.Role),
ConstraintStrategy,
ConstraintStrategy.approveAddRole(String,String)public boolean canDelegate(Role aRole)
canDelegate in interface RoleInterfaceaRole - The role object whose existence to be checked.
true if aRole exists in this hierarchy.RoleInterface.canDelegate(jawiro.Role)public boolean canSwitch(java.lang.String className)
canSwitch in interface RoleInterfaceclassName - The fully qualified class name of a role type
of whose existence is to be checked.
For example, a customer role defined by the
Customer class of package examples,
the correct name is "examples.Customer"
true if this object is currently playing the
given role type.RoleInterface.canSwitch(java.lang.String)public boolean canSwitch(java.lang.Class roleClass)
canSwitch in interface RoleInterfaceroleClass - The Class object representing the
role type of whose existence is to be checked.
true if this object is currently playing the
given role type.RoleInterface.canSwitch(java.lang.Class)
public boolean canSwitch(java.lang.String className,
java.lang.String identifier)
canSwitch in interface RoleInterfaceclassName - The fully qualified class name of an aggregate
role type of whose existence is to be checked.
For example, a customer role defined by the
Customer class of package examples,
the correct name is "examples.Customer"identifier - The identifier of the aggregate role
of whose existence is to be checked.
true if this object is currently playing
the given role type.RoleInterface.canSwitch(java.lang.String, java.lang.String)
public boolean canSwitch(java.lang.Class roleClass,
java.lang.String identifier)
canSwitch in interface RoleInterfaceroleClass - The Class object representing the
role type of whose existence is to be checked.identifier - The identifier of the aggregate role
of whose existence is to be checked.
true if this object is currently playing
the given role type.RoleInterface.canSwitch(java.lang.Class, java.lang.String)public java.lang.Object as(java.lang.String className)
as in interface RoleInterfaceclassName - The fully qualified class name of the
'destination' role. For example, a customer role defined by the
Customer class of package examples,
the correct name is "examples.Customer"
RoleInterface.as(java.lang.String)public java.lang.Object as(java.lang.Class roleClass)
as in interface RoleInterfaceroleClass - The Class object representing
the 'destination' role.
RoleInterface.as(java.lang.Class)
public java.lang.Object as(java.lang.String className,
java.lang.String identifier)
as in interface RoleInterfaceclassName - The fully qualified class name of the
'destination' role. For example, a customer role defined by the
Customer class of package examples,
the correct name is "examples.Customer"identifier - The identifier of the 'destination'
aggregate role
RoleInterface.as(java.lang.String, java.lang.String)
public java.lang.Object as(java.lang.Class roleClass,
java.lang.String identifier)
as in interface RoleInterfaceroleClass - The Class object representing the
type of the 'destination' aggregate role.identifier - The identifier of the 'destination'
aggregate role
RoleInterface.as(java.lang.Class, java.lang.String)public jawiro.RoleList getRoleList()
jawiro.RoleList instance, which
represents the list of the child roles of this object.
However, all member fields of jawiro.RoleList
are private and all of its member methods are only visible
for the jawiro package.
public boolean receiveRole(Role r)
public, it belongs
to the inner workings of JAWIRO and a flagging mechanism
prevents its usage from outside of the jawiro
package.
public void dominateSearch(boolean dominate)
dominateSearch in interface RoleInterfacedominate - Determines whether this participant is dominant or not.RoleInterface.dominateSearch(boolean)public boolean isDominant()
isDominant in interface RoleInterfacetrue is this object is dominant.RoleInterface.isDominant()
public java.lang.Object executeMethod(java.lang.String name,
java.lang.Object... parameters)
executeMethod in interface RoleInterfacename - The name of the requested method.parameters - The parameters for the requested method.
RoleInterface.executeMethod(java.lang.String, java.lang.Object[])
public java.lang.Object executeLocalMethod(java.lang.String name,
java.lang.Object... parameters)
Actor object.
executeLocalMethod in interface RoleInterfacename - The name of the requested field.parameters - The parameters for the requested method.
RoleInterface.executeLocalMethod(java.lang.String, java.lang.Object[])public java.lang.Object bringMember(java.lang.String name)
bringMember in interface RoleInterfacename - The name of the requested field.
RoleInterface.bringMember(java.lang.String)public java.lang.Object bringLocalMember(java.lang.String name)
bringLocalMember in interface RoleInterfacename - The name of the requested field.
RoleInterface.bringLocalMember(java.lang.String)public int getDepth()
Actor.getDepth() always returns 1 as it is the root object.
getDepth in interface RoleInterfaceRoleInterface.getDepth()public void setConstraintManager(jawiro.ConstraintStrategy cstr)
cstr - The constraint manager to be assigned.ConstraintStrategypublic jawiro.ConstraintStrategy getConstraintManager()
ConstraintStrategypublic void enableDelegation(boolean use)
Enables the use of the delegation mechanism.
By default, JAWIRO works with the consultation mechanism,
where the implicit this parameter points to the
object that the method call has been forwarded to.
The alternative is the delegation mechanism where the implicit
this parameter points to the original receiver of
the message. JAWIRO does not alter the implicit this
parameter but it keeps the self member field of both
Actor and Role classes updated as
explained above. JAWIRO supports both consultation and delegation
in such a flexible way that a user can switch between these two
mechanisms at will.
Supporting the consultation mechanism is easier because it does not require the additional operations to keep the original recepient of a message. Moreover, these additional operations are expected to introduce some overhead. Therefore the default mechanism is consultation. These issues are kept in mind when implementing the commands related to the delegation and consultation mechanisms. However, benchmarks showed that the delegation and consultation mechanisms of JAWIRO complete the execution of messages in equal times.
use - Determines whether the use of the delegation mechanism
is allowed or not.useDelegation,
useConsultation(),
isDelegationEnabled(),
isDelegationUsed(),
getSelf()public boolean isDelegationEnabled()
true if delegation is enabledenableDelegation(boolean),
useDelegation,
useConsultation(),
isDelegationUsed()public void useDelegation()
enableDelegation(boolean),
useConsultation(),
isDelegationEnabled(),
isDelegationUsed()public boolean isDelegationUsed()
true if the delegation mechanism is being used,
false if the consultation mechanism is being used.enableDelegation(boolean),
useDelegation,
useConsultation(),
isDelegationEnabled()public void useConsultation()
enableDelegation(boolean),
useDelegation,
isDelegationEnabled(),
isDelegationUsed()public void removeAllDominance()
RoleInterface.dominateSearch(boolean)public java.lang.String getClassName()
Method for finding the class name of an object.
getClassName in interface RoleInterfacepublic boolean resumeRole(java.lang.String className)
Method for resuming a jawiro.Role object of a
known type name, when the reference to this role is unavailable.
If a role hierarchy is saved to secondary storage while some
of the roles are suspended, these roles cannot be resumed with
the jawiro.Role.resume() method because suspended
roles cannot be accessed with the commands of the JAWIRO API.
In this case, Actor.resumeRole(String) can be used.
className - The type name of the role to be resumed.
true if the role is found and a constraint
manager did not disallowed the operation, false otherwise.resumeRole( String, String )
public boolean resumeRole(java.lang.String className,
java.lang.String identifier)
Method for resuming a jawiro.AggregateRole object
of whose type name and identifier is known, when the reference to
this role is unavailable. This is the case when a role hierarchy
is saved to secondary storage while there are suspended roles.
className - The type name of the aggregate role to be resumed.identifier - The identifier of the aggregate role to be resumed.
resumeRole( String )public boolean suspendRole(java.lang.String className)
className - The type name of the role to be resumed.
public boolean suspendRole(java.lang.String className,
java.lang.String identifier)
className - The type name of the role to be resumed.identifier - The identifier of the aggregate role to be resumed.
public java.lang.Object getSelf()
Gives access to the self member which is used
in the delegation mechanism.
getSelf in interface RoleInterfaceenableDelegation(boolean)public void prePopulateReflectionTables(boolean prePopulate)
In order to let users access members and methods without the actual owner,
the Actor.hierarchy object needs to know what members and methods that
each participant of a role hierarchy have. It's sufficent to obtain this
information only once. This is done either when needed for the first time
or beforehand when a Role object is added to an owner for the
first time. The latter procedure is referred as "prepopulation of the
reflection tables".
For an Actor object, prepopulation means that the reflection
table is calculated when its addRole(Object) method is run
for the very first time.
prePopulate - If true, reflection tables are prepopulated.public boolean getReflectionPrePopulationMode()
prePopulateReflectionTables(boolean)public Actor getActor()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||