Public Member Functions | |
BackendRecoveryPolicy (String backendName, boolean recoveryPolicy) | |
String | getBackendName () |
boolean | getRecoveryPolicy () |
void | addController (String controllerName) throws ControllerException |
boolean | isEligibleForRecovery (String controllerName) |
String | getXml () |
Definition at line 40 of file BackendRecoveryPolicy.java.
|
Create a new BackendRecoveryPolicy
Definition at line 52 of file BackendRecoveryPolicy.java. 00053 { 00054 this.backendName = backendName; 00055 this.recoveryPolicy = recoveryPolicy; 00056 }
|
|
Add a controller name that can recover this backend in case of the failure of the current controller.
Definition at line 85 of file BackendRecoveryPolicy.java. 00086 { 00087 if (recoveryPolicy == false) 00088 throw new ControllerException( 00089 "Cannot define controllers when recovery policy is off."); 00090 if (controllers == null) 00091 controllers = new ArrayList(); 00092 controllers.add(controllerName); 00093 }
|
|
Get the backend name
Definition at line 63 of file BackendRecoveryPolicy.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase.addBackendRecoveryPolicy(). 00064 {
00065 return backendName;
00066 }
|
|
Get the recoveryPolicy
Definition at line 73 of file BackendRecoveryPolicy.java. 00074 {
00075 return recoveryPolicy;
00076 }
|
|
Get the XML dump of this BackendRecoveryPolicy element
Definition at line 117 of file BackendRecoveryPolicy.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase.getDistributionXml(). 00118 { 00119 String xml = "<" + DatabasesXmlTags.ELT_BackendRecoveryPolicy + " " 00120 + DatabasesXmlTags.ATT_backendName + "=\"" + backendName + "\" " 00121 + DatabasesXmlTags.ATT_recoveryPolicy + "=\"" 00122 + (recoveryPolicy ? DatabasesXmlTags.VAL_on : DatabasesXmlTags.VAL_off); 00123 if (controllers != null) 00124 { 00125 xml += ">"; 00126 int size = controllers.size(); 00127 for (int i = 0; i < size; i++) 00128 xml += "<" + DatabasesXmlTags.ELT_ControllerName + " " 00129 + DatabasesXmlTags.ATT_name + "=\"" + backendName + "\"/>"; 00130 xml += "</" + DatabasesXmlTags.ELT_BackendRecoveryPolicy + ">"; 00131 } 00132 else 00133 xml += "\"/>"; 00134 return xml; 00135 }
|
|
Returns whether the given controller name is authorized to recover this backend or not.
Definition at line 102 of file BackendRecoveryPolicy.java. 00103 { 00104 if (recoveryPolicy == false) 00105 return false; 00106 if (controllers == null) 00107 return true; 00108 else 00109 return controllers.contains(controllerName); 00110 }
|