src/org/objectweb/cjdbc/controller/loadbalancer/policies/errorchecking/ErrorCheckingPolicy.java

説明を見る。
00001 00025 package org.objectweb.cjdbc.controller.loadbalancer.policies.errorchecking; 00026 00027 import java.util.ArrayList; 00028 00029 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags; 00030 00037 public abstract class ErrorCheckingPolicy 00038 { 00040 public static final int RANDOM = 0; 00041 00043 public static final int ROUND_ROBIN = 1; 00044 00046 public static final int ALL = 2; 00047 00049 protected int nbOfNodes = 0; 00050 00051 protected int policy; 00052 00059 public ErrorCheckingPolicy(int policy, int numberOfNodes) 00060 { 00061 setPolicy(policy); 00062 setNumberOfNodes(numberOfNodes); 00063 } 00064 00071 public int getNumberOfNodes() 00072 { 00073 return nbOfNodes; 00074 } 00075 00082 public void setNumberOfNodes(int numberOfNodes) 00083 { 00084 if (numberOfNodes < 3) 00085 throw new IllegalArgumentException( 00086 "You must use at least 3 nodes for error checking (" 00087 + numberOfNodes 00088 + " is not acceptable)"); 00089 this.nbOfNodes = numberOfNodes; 00090 } 00091 00098 public int getPolicy() 00099 { 00100 return policy; 00101 } 00102 00109 public void setPolicy(int policy) 00110 { 00111 this.policy = policy; 00112 } 00113 00122 public abstract ArrayList getBackends(ArrayList backends) 00123 throws ErrorCheckingException; 00124 00130 public abstract String getInformation(); 00131 00137 public String getXml() 00138 00139 { 00140 StringBuffer info = new StringBuffer(); 00141 info.append( 00142 "<" 00143 + DatabasesXmlTags.ELT_ErrorChecking 00144 + " />" 00145 + DatabasesXmlTags.ATT_numberOfNodes 00146 + "=\"" 00147 + this.getNumberOfNodes() 00148 + "\" " 00149 + DatabasesXmlTags.ATT_policy 00150 + "=\""); 00151 switch (policy) 00152 { 00153 case RANDOM : 00154 info.append(DatabasesXmlTags.VAL_random); 00155 case ROUND_ROBIN : 00156 info.append(DatabasesXmlTags.VAL_roundRobin); 00157 case ALL : 00158 info.append(DatabasesXmlTags.VAL_all); 00159 default : 00160 } 00161 info.append("\"/>"); 00162 return info.toString(); 00163 } 00164 }

CJDBCversion1.0.4に対してTue Oct 12 15:16:02 2004に生成されました。 doxygen 1.3.8