JAC project
AOPSYS
CEDRIC & LIP6 labs

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

java.lang.Object
  |
  +--org.objectweb.jac.aspects.distribution.consistency.Consistency

public class Consistency
extends Object

This class handles any type of consistency protocol on a replicaction group.

A replication group is a set of objects of the same class that are related through a consistency protocol.

Author:
Renaud Pawlak

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.
static int KS_ALL
          With this knowledge style, all the replicas know all the other replicas (none info is required at construction time).
static int KS_BTREE
          With this knowledge style, each replica knows only one replica which is its father in a binary tree (the top of the tree has to be defined at construction time).
static int KS_NEXT
          With this knowledge style, each replica knows only one replica which is its neighbour in the replicas list (and last knows the first) (none info is required at construction time).
static int KS_ONE
          With this knowledge style, all the replicas know the same unique replica (to be defined at construction time).
static int KS_USER
          The knowledge style is defined by the user (the whole knowledge graph has to be defined at construction time).
 
Constructor Summary
Consistency(Class consistencyWrapperType, int knowledgeStyle, int[] knowledgeGraph)
          Creates a new consistency.
 
Method Summary
static void bindToDistObj(String name, Wrappee tobind)
          This method binds a new object to the group of replicas of this consistency.
 void deploy(RemoteRef[] members, Class type, String[] readMethods, String[] writeMethods, String[] callMethods)
          Deploy the consistency on a set of remote objects.
protected  String[] expandMethods(Class type, 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).
static boolean isReplicatedOn(String name, RemoteContainer container)
          Says if a replica is deployed on the given site.
protected  void wrapMember(RemoteRef member, String[] wrappingMethods, String[][] wrappedMethods, RemoteRef[] knowledge, String kstag)
          Internally used to wrap a remote member with a consistency wrapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KS_USER

public static int KS_USER
The knowledge style is defined by the user (the whole knowledge graph has to be defined at construction time).


KS_ONE

public static int KS_ONE
With this knowledge style, all the replicas know the same unique replica (to be defined at construction time).


KS_ALL

public static int KS_ALL
With this knowledge style, all the replicas know all the other replicas (none info is required at construction time).


KS_NEXT

public static int KS_NEXT
With this knowledge style, each replica knows only one replica which is its neighbour in the replicas list (and last knows the first) (none info is required at construction time).


KS_BTREE

public static int KS_BTREE
With this knowledge style, each replica knows only one replica which is its father in a binary tree (the top of the tree has to be defined at construction time).


ALL_METHODS

public static String ALL_METHODS
Use to indicate that you need all the methods.


ALL_MODIFIERS

public static String ALL_MODIFIERS
Use to indicate that you need all the modifiers.


ALL_GETTERS

public static String ALL_GETTERS
Use to indicate that you need all the getters.

Constructor Detail

Consistency

public Consistency(Class consistencyWrapperType,
                   int knowledgeStyle,
                   int[] knowledgeGraph)
Creates a new consistency.

The knowledge style can be one the following:

Parameters:
consistencyWrapperType - the wrapper type that actually implements the consistency protocol
knowledgeStyle - can be KS_USER, KS_ONE, KS_ALL, KS_NEXT, or KS_BTREE
knowledgeGraph - depending on the knowledge style, can be empty or describing what set of replicas are known by other replicas
Method Detail

isReplicatedOn

public static boolean isReplicatedOn(String name,
                                     RemoteContainer container)
Says if a replica is deployed on the given site.

Parameters:
name - the name of the replica
container - the remote container to check
Returns:
true if a replica of the given name is found on the given container

expandMethods

protected String[] expandMethods(Class type,
                                 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).

Parameters:
type - the class to expand
methods - a set of methods to expand (can contain ALL_METHODS, ALL_MODIFIERS, and ALL_GETTERS keywords)
Returns:
a set of methods where the keywords have been expanded with the corresponding method of the type

deploy

public void deploy(RemoteRef[] members,
                   Class type,
                   String[] readMethods,
                   String[] writeMethods,
                   String[] callMethods)
            throws org.objectweb.jac.aspects.distribution.consistency.WrongConsistencyDefinitionException
Deploy the consistency on a set of remote objects.

PRE: the objects must have been previously deployed.

Parameters:
members - the references on the replicated members
type - the class of these members
readMethods - the names of the methods of the type that read the objects states
writeMethods - the names of the methods of the type that write the objects states
callMethods - the names of the methods of the type that neither read or write the objects states
org.objectweb.jac.aspects.distribution.consistency.WrongConsistencyDefinitionException
See Also:
Deployment.deployStruct(Object[]), Deployment.deploy(Object[]), Deployment.replicateStruct(Object), Deployment.replicate(Object)

wrapMember

protected void wrapMember(RemoteRef member,
                          String[] wrappingMethods,
                          String[][] wrappedMethods,
                          RemoteRef[] knowledge,
                          String kstag)
                   throws InstantiationException
Internally used to wrap a remote member with a consistency wrapper.

Parameters:
member - the member to wrap
wrappingMethods - the methods of the consistency wrapper that will wrap this member
wrappedMethods - for each wrapping method, the set of methods of the member that will be actually wrapped
knowledge - the set of other members known by the newly wrapped member
kstag - the knowledge style tag
InstantiationException

bindToDistObj

public static void bindToDistObj(String name,
                                 Wrappee tobind)
This method binds a new object to the group of replicas of this consistency.

Parameters:
name - the name of the replica to bind to

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli