org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking
Class ErrorCheckingPolicy

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking.ErrorCheckingPolicy
Direct Known Subclasses:
ErrorCheckingAll, ErrorCheckingRandom, ErrorCheckingRoundRobin

public abstract class ErrorCheckingPolicy
extends java.lang.Object

Defines the policy to adopt for error checking.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
static int ALL
          Request is sent to all backends.
protected  int nbOfNodes
          Number of nodes that are involved in error-checking per request.
protected  int policy
           
static int RANDOM
          Pickup backends randomly.
static int ROUND_ROBIN
          Backends are chosen using a round-robin algorithm.
 
Constructor Summary
ErrorCheckingPolicy(int policy, int numberOfNodes)
          Creates a new CreateTableRule.
 
Method Summary
abstract  java.util.ArrayList getBackends(java.util.ArrayList backends)
          Pickups backends from the given backends arraylist according to the current rule policy.
abstract  java.lang.String getInformation()
          Gives information about the current policy.
 int getNumberOfNodes()
          Returns the number of nodes.
 int getPolicy()
          Returns the policy.
 java.lang.String getXml()
          Convert this error checking policy to xml
 void setNumberOfNodes(int numberOfNodes)
          Sets the number of nodes.
 void setPolicy(int policy)
          Sets the policy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM

public static final int RANDOM
Pickup backends randomly.

See Also:
Constant Field Values

ROUND_ROBIN

public static final int ROUND_ROBIN
Backends are chosen using a round-robin algorithm.

See Also:
Constant Field Values

ALL

public static final int ALL
Request is sent to all backends.

See Also:
Constant Field Values

nbOfNodes

protected int nbOfNodes
Number of nodes that are involved in error-checking per request.


policy

protected int policy
Constructor Detail

ErrorCheckingPolicy

public ErrorCheckingPolicy(int policy,
                           int numberOfNodes)
Creates a new CreateTableRule.

Parameters:
policy - implemented policy
numberOfNodes - number of nodes to use to check for errors on a query
Method Detail

getNumberOfNodes

public int getNumberOfNodes()
Returns the number of nodes.

Returns:
an int value
See Also:
setNumberOfNodes(int)

setNumberOfNodes

public void setNumberOfNodes(int numberOfNodes)
Sets the number of nodes.

Parameters:
numberOfNodes - the number of nodes to set
See Also:
getNumberOfNodes()

getPolicy

public int getPolicy()
Returns the policy.

Returns:
an int value
See Also:
setPolicy(int)

setPolicy

public void setPolicy(int policy)
Sets the policy.

Parameters:
policy - the policy to set
See Also:
getPolicy()

getBackends

public abstract java.util.ArrayList getBackends(java.util.ArrayList backends)
                                         throws ErrorCheckingException
Pickups backends from the given backends arraylist according to the current rule policy.

Parameters:
backends - backends to choose from
Returns:
Arraylist of choosen DatabaseBackend
Throws:
ErrorCheckingException - if the rule cannot be applied

getInformation

public abstract java.lang.String getInformation()
Gives information about the current policy.

Returns:
a String value

getXml

public java.lang.String getXml()
Convert this error checking policy to xml

Returns:
xml formatted string


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.