|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jac.core.Wrapper
org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
This wrapper class is the base class for all the consistency wrappers that implement a consistency protocol.
By default it does nothing and provides no consistency at all between the replicas. A consistency programmer should define the wrapping and role method to implement a specific consistency protocol.
Field Summary | |
static String |
ALL_GETTERS
Use to indicate that you need all the getters. |
static String |
ALL_METHODS
Use to indicate that you need all the methods. |
static String |
ALL_MODIFIERS
Use to indicate that you need all the modifiers. |
protected Vector |
knownReplicas
Storage for known replicas. |
protected static String |
visitedReplicas
Visited sites global attribute name. |
Fields inherited from class org.objectweb.jac.core.Wrapper |
ac, cr |
Constructor Summary | |
ConsistencyWrapper(AspectComponent ac)
Default constructor. |
|
ConsistencyWrapper(AspectComponent ac,
Class type,
String[] readMethods,
String[] writeMethods,
String[] callMethods,
String hosts)
Contructor for initialization. |
Method Summary | |
Object |
acceptRemoteCall(RemoteRef remoteReplica,
Object[] data)
This role method can called by the whenCall
wrapping method of a remote replica. |
Object |
acceptRemoteRead(Wrappee wrappee,
RemoteRef remoteReplica,
Object[] data)
This role method can called by the whenRead
wrapping method of a remote replica. |
Object |
acceptRemoteWrite(Wrappee wrappee,
RemoteRef remoteReplica,
Object[] data)
This role method can called by the whenWrite
wrapping method of a remote replica. |
void |
addKnownReplica(RemoteRef newReplica)
Adds a known replica. |
void |
addMember(RemoteRef newReplica)
Add a replica to the knowledge graph. |
Object |
construct(ConstructorInvocation invocation)
|
protected String[] |
expandMethods(String[] methods)
Construct a real methods array with an array that can contain consistency specific strings (like the one that indicates that we need all the modifiers). |
Class |
getConsistencyWrapperType()
The get method for the consistency wrapper actual type. |
Vector |
getKnownReplicas()
The getter method for the known replicas. |
String |
getVisitedReplicas()
Returns the visited replicas global attribute of the collaboration. |
void |
invalidateTopology()
Invalidates the topology. |
Object |
invoke(MethodInvocation invocation)
|
void |
setCallMethods(String[] callMethods)
Set the call method names (methods that neither write or read the replica state). |
void |
setKnownReplicas(Vector knownReplicas)
The setter method for the known replicas. |
void |
setReadMethods(String[] readMethods)
Set the read method names (methods that read the replica state). |
void |
setWriteMethods(String[] writeMethods)
Set the write method names (methods that change the replica state). |
String |
toString()
Returns a string representation of the wrapper. |
void |
whenBindingNewReplica(RemoteRef newReplica)
This method is called when new member is bounded to the replication group. |
Object |
whenCall(Interaction interaction)
This wrapping method must be defined to implement a given builtin consistency protocol and must wrap the replica methods that need to be consistent with the other replicas. |
void |
whenNewReplicaBounded(RemoteRef remoteReplica)
This method is called on the new member when the binding is finished. |
Object |
whenRead(Interaction interaction)
This wrapping method must be defined to implement a given builtin consistency protocol and must wrap all the replica methods that read the replica state. |
Object |
whenWrite(Interaction interaction)
This wrapping method must be defined to implement a given builtin consistency protocol and must wrap all the replicas methods that provoque a change in this replica state. |
static void |
wrap(Wrappee wrappee,
Class wrapperClass,
String[] readMethods,
String[] writeMethods,
String[] callMethods,
String hosts)
Wraps a wrappee with a consistency wrapper. |
Methods inherited from class org.objectweb.jac.core.Wrapper |
attr, attrdef, defines, getAspectComponent, getAspectComponentName, getExceptionHandlers, proceed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Vector knownReplicas
protected static String visitedReplicas
public static String ALL_METHODS
public static String ALL_MODIFIERS
public static String ALL_GETTERS
Constructor Detail |
public ConsistencyWrapper(AspectComponent ac)
public ConsistencyWrapper(AspectComponent ac, Class type, String[] readMethods, String[] writeMethods, String[] callMethods, String hosts)
type
- the type of the wrappeereadMethods
- the methods that read the wrappee's statewriteMethods
- the methods that write the wrappee's statecallMethods
- the stateless methodsMethod Detail |
public static void wrap(Wrappee wrappee, Class wrapperClass, String[] readMethods, String[] writeMethods, String[] callMethods, String hosts)
public void addMember(RemoteRef newReplica)
The way the member is added to the knowledge graph depends on the knowledge graph.
newReplica
- the reference on the replica to addpublic void invalidateTopology()
When this method is called, the next consistency protocol run will recalculate the known replica with the new topology.
public void whenBindingNewReplica(RemoteRef newReplica)
It is typically used to initialize (in a push manner) the new member state with the data that need to be replicated. By default, this method does nothing.
newReplica
- the replica that is beeing addedpublic void whenNewReplicaBounded(RemoteRef remoteReplica)
It is typically used to initialize (in a pull manner) the new member state with the data that need to be replicated. By default, this method does nothing.
remoteReplica
- the replica that has just been boundedpublic String getVisitedReplicas()
public String toString()
toString
in class Wrapper
public void setReadMethods(String[] readMethods)
readMethods
- the names of the read methodspublic void setWriteMethods(String[] writeMethods)
writeMethods
- the names of the write methodspublic void setCallMethods(String[] callMethods)
callMethods
- the names of the call methodspublic Vector getKnownReplicas()
The known replicas of a consistency wrapper are remote
references on other member of the replication group. With this
information, the consistency wrapper can implement consistency
protocols. The most usual schemes are to be aware of all the
replicas of the group (see for instance
StrongPushConsistencyWrapper
) or to be aware of ony
one replica (see for instance
ClientServerConsistencyWrapper
.
public void addKnownReplica(RemoteRef newReplica)
newReplica
- the known replica to addpublic Class getConsistencyWrapperType()
public void setKnownReplicas(Vector knownReplicas)
The known replicas of a consistency wrapper are remote
references on other member of the replication group. With this
information, the consistency wrapper can implement consistency
protocols. The most usual schemes are to be aware of all the
replicas of the group (see for instance
StrongPushConsistencyWrapper
) or to be aware of ony
one replica (see for instance
ClientServerConsistencyWrapper
.
knownReplicas
- the new known replicaspublic Object whenCall(Interaction interaction)
It should not wrap a method that is allready wrapped by a
WhenWrite
or WhenRead
method.
Default: do nothing and call the replica.
acceptRemoteCall(RemoteRef,Object[])
public Object whenWrite(Interaction interaction)
Default: do nothing and call the replica.
acceptRemoteWrite(Wrappee,RemoteRef,Object[])
public Object whenRead(Interaction interaction)
Default: do nothing and call the replica.
acceptRemoteRead(Wrappee,RemoteRef,Object[])
public Object acceptRemoteCall(RemoteRef remoteReplica, Object[] data)
whenCall
wrapping method of a remote replica.By overloading this method, the programmer can implement specific consistency protocols.
Default: do nothing.
remoteReplica
- expected to be a reference on the remote
replica that recieved the call eventdata
- the data transmittedd by whenCall
whenCall(Interaction)
public Object acceptRemoteWrite(Wrappee wrappee, RemoteRef remoteReplica, Object[] data)
whenWrite
wrapping method of a remote replica.By overloading this method, the programmer can implement specific consistency protocols.
Default: do nothing.
remoteReplica
- expected to be a reference on the remote
replica that recieved the write eventdata
- the data transmittedd by whenWrite
whenWrite(Interaction)
public Object acceptRemoteRead(Wrappee wrappee, RemoteRef remoteReplica, Object[] data)
whenRead
wrapping method of a remote replica.By overloading this method, the programmer can implement specific consistency protocols.
Default: do nothing.
remoteReplica
- expected to be a reference on the remote
replica that recieved the read eventdata
- the data transmittedd by whenRead
whenRead(Interaction)
protected String[] expandMethods(String[] methods)
methods
- a set of methods to expand (can contain
ALL_METHODS, ALL_MODIFIERS, and ALL_GETTERS keywords)
public Object invoke(MethodInvocation invocation) throws Throwable
invoke
in interface MethodInterceptor
invoke
in class Wrapper
Throwable
public Object construct(ConstructorInvocation invocation) throws Throwable
construct
in interface ConstructorInterceptor
construct
in class Wrapper
Throwable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |