org.objectweb.cjdbc.controller.loadbalancer.policies.createtable
Class CreateTableRule

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule
Direct Known Subclasses:
CreateTableAll, CreateTableRandom, CreateTableRoundRobin

public abstract class CreateTableRule
extends java.lang.Object

Defines the policy to adopt when creating a new table.

Version:
1.0
Author:
Emmanuel Cecchet , Jean-Bernard van Zuylen

Field Summary
protected  java.util.ArrayList backendList
          List of backend names to wait for.
protected  int nbOfNodes
          Number of nodes that must create the table.
protected  int policy
           
protected  java.lang.String tableName
          Table name pattern to which this rule apply (null means it is the default rule).
 
Constructor Summary
CreateTableRule(int policy)
          Constructor for CreateTableRule.
CreateTableRule(int policy, java.util.ArrayList backendList)
          Creates a new CreateTableRule instance.
 
Method Summary
 void addBackendName(java.lang.String name)
          Add a backend name to the list of backends to wait for.
 java.util.ArrayList getBackendList()
          Returns the backendList.
 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 getTableName()
          Returns the table name.
 java.lang.String getXml()
          Gives information about the current policy in xml
 boolean isDefaultRule()
          Returns true if this rule is the default rule.
 void setNumberOfNodes(int numberOfNodes)
          Sets the number of nodes.
 void setPolicy(int policy)
          Sets the policy.
 void setTableName(java.lang.String tableName)
          Sets the table name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backendList

protected java.util.ArrayList backendList
List of backend names to wait for.


nbOfNodes

protected int nbOfNodes
Number of nodes that must create the table.


tableName

protected java.lang.String tableName
Table name pattern to which this rule apply (null means it is the default rule).


policy

protected int policy
Constructor Detail

CreateTableRule

public CreateTableRule(int policy)
Constructor for CreateTableRule.

Parameters:
policy - the implemented policy

CreateTableRule

public CreateTableRule(int policy,
                       java.util.ArrayList backendList)
Creates a new CreateTableRule instance.

Parameters:
policy - the implemented policy
backendList - the backend list to use
Method Detail

addBackendName

public void addBackendName(java.lang.String name)
Add a backend name to the list of backends to wait for.

Parameters:
name - backend name

getBackendList

public java.util.ArrayList getBackendList()
Returns the backendList.

Returns:
ArrayList

getNumberOfNodes

public int getNumberOfNodes()
Returns the number of nodes.

Returns:
an int value

setNumberOfNodes

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

Parameters:
numberOfNodes - the number of nodes to set

getTableName

public java.lang.String getTableName()
Returns the table name.

Returns:
a String value

setTableName

public void setTableName(java.lang.String tableName)
Sets the table name.

Parameters:
tableName - the table name to set

getPolicy

public int getPolicy()
Returns the policy.

Returns:
an int value

setPolicy

public void setPolicy(int policy)
Sets the policy.

Parameters:
policy - the policy to set

isDefaultRule

public boolean isDefaultRule()
Returns true if this rule is the default rule.

Returns:
boolean

getBackends

public java.util.ArrayList getBackends(java.util.ArrayList backends)
                                throws CreateTableException
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:
CreateTableException - in some specific implementations (not this one)

getInformation

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

Returns:
a String value

getXml

public java.lang.String getXml()
Gives information about the current policy in xml

Returns:
a String value in xml


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