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

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTablePolicy
All Implemented Interfaces:
XmlComponent

public class CreateTablePolicy
extends java.lang.Object
implements XmlComponent

Defines the policy to adopt when creating a new table.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
static int ALL
          Table is created on all backends in the backend list.
static int RANDOM
          Pickup a backend name randomly in the backend list.
static int ROUND_ROBIN
          Backends are chosen using a round-robin algorithm.
private  java.util.HashMap ruleList
          List of backends to wait for.
 
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent
DOCTYPE_CONTROLLER, DOCTYPE_DB, XML_VERSION
 
Constructor Summary
CreateTablePolicy()
           
 
Method Summary
 void addRule(CreateTableRule rule)
          Adds a rule to this policy.
 CreateTableRule getDefaultRule()
          Returns the default rule or null if no default rule has been defined.
 java.util.HashMap getRuleList()
          Returns the rule Hashmap(table name,rule).
 CreateTableRule getTableRule(java.lang.String tableName)
          Gets the rule corresponding to a table name.
 java.lang.String getXml()
          Returns xml formatted string containing information on all rules of the system
static java.lang.String getXmlValue(int policy)
          Returns the xml attribute value for the given 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 a backend name randomly in the backend list.

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
Table is created on all backends in the backend list.

See Also:
Constant Field Values

ruleList

private java.util.HashMap ruleList
List of backends to wait for.

Constructor Detail

CreateTablePolicy

public CreateTablePolicy()
Method Detail

addRule

public void addRule(CreateTableRule rule)
Adds a rule to this policy.
If the rule's table name is null, the rule is considered as the default rule

Parameters:
rule - rule to add

getRuleList

public java.util.HashMap getRuleList()
Returns the rule Hashmap(table name,rule).

Returns:
Hashmap

getTableRule

public CreateTableRule getTableRule(java.lang.String tableName)
Gets the rule corresponding to a table name.

Parameters:
tableName - table name of the rule
Returns:
the rule or null if no specific rule has been defined for this table

getDefaultRule

public CreateTableRule getDefaultRule()
Returns the default rule or null if no default rule has been defined.

Returns:
a CreateTableRule

getXmlValue

public static final java.lang.String getXmlValue(int policy)
Returns the xml attribute value for the given policy

Parameters:
policy - the policy to convert
Returns:
xml attribute value or "" if not found

getXml

public java.lang.String getXml()
Returns xml formatted string containing information on all rules of the system

Specified by:
getXml in interface XmlComponent
Returns:
xml formatted string.


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