org.objectweb.jac.aspects.distribution.consistency
Class ClientServerConsistencyWrapper

java.lang.Object
  extended byorg.objectweb.jac.core.Wrapper
      extended byorg.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
          extended byorg.objectweb.jac.aspects.distribution.consistency.ClientServerConsistencyWrapper
All Implemented Interfaces:
Advice, ConstructorInterceptor, Interceptor, MethodInterceptor, Serializable

public class ClientServerConsistencyWrapper
extends ConsistencyWrapper

This wrapper implements a client-server consistency protocol.

It is a special consistency protocol since the wrappee acts as a pure client (a stub) for its known replicas.

Author:
Renaud Pawlak
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
ALL_GETTERS, ALL_METHODS, ALL_MODIFIERS, knownReplicas, visitedReplicas
 
Fields inherited from class org.objectweb.jac.core.Wrapper
ac, cr
 
Constructor Summary
ClientServerConsistencyWrapper(AspectComponent ac)
          An empty constructor for the Consistency class.
ClientServerConsistencyWrapper(AspectComponent ac, String hosts)
          A friendly constructor for a client-server consistency wrapper.
 
Method Summary
 Object acceptRemoteCall(Wrappee wrappee, RemoteRef remoteReplica, Object[] data)
          Calls the method on the server.
 Object whenCall(Interaction interaction)
          Forwards the call to the server(s).
 
Methods inherited from class org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
acceptRemoteCall, acceptRemoteRead, acceptRemoteWrite, addKnownReplica, addMember, construct, expandMethods, getConsistencyWrapperType, getKnownReplicas, getVisitedReplicas, invalidateTopology, invoke, setCallMethods, setKnownReplicas, setReadMethods, setWriteMethods, toString, whenBindingNewReplica, whenNewReplicaBounded, whenRead, whenWrite, wrap
 
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
 

Constructor Detail

ClientServerConsistencyWrapper

public ClientServerConsistencyWrapper(AspectComponent ac,
                                      String hosts)
A friendly constructor for a client-server consistency wrapper.

Parameters:
hosts - a regular expression that defines the host where the server is located

ClientServerConsistencyWrapper

public ClientServerConsistencyWrapper(AspectComponent ac)
An empty constructor for the Consistency class.

Method Detail

whenCall

public Object whenCall(Interaction interaction)
Forwards the call to the server(s).

Do not call the replica except if we do not know any server (in this case, we are a server).

Overrides:
whenCall in class ConsistencyWrapper
Returns:
the value returned by the server
See Also:
ConsistencyWrapper.acceptRemoteCall(RemoteRef,Object[])

acceptRemoteCall

public Object acceptRemoteCall(Wrappee wrappee,
                               RemoteRef remoteReplica,
                               Object[] data)
Calls the method on the server.

Parameters:
remoteReplica - the client remote reference
data - the name and the parameters of the server method