1 22 package org.jboss.cache.config; 23 24 import org.jboss.cache.buddyreplication.NextMemberBuddyLocator; 25 26 import java.util.Properties ; 27 28 29 public class BuddyReplicationConfig extends ConfigurationComponent 30 { 31 private static final long serialVersionUID = -4826380823985089339L; 32 33 36 private boolean enabled; 37 38 41 private String buddyPoolName; 42 43 private boolean autoDataGravitation = true; 44 private boolean dataGravitationRemoveOnFind = true; 45 private boolean dataGravitationSearchBackupTrees = true; 46 @Dynamic 47 private int buddyCommunicationTimeout = 10000; 48 private BuddyLocatorConfig buddyLocatorConfig; 49 50 public BuddyReplicationConfig() 51 { 52 } 53 54 public boolean isAutoDataGravitation() 55 { 56 return autoDataGravitation; 57 } 58 59 public void setAutoDataGravitation(boolean autoDataGravitation) 60 { 61 testImmutability("autoDataGravitation"); 62 this.autoDataGravitation = autoDataGravitation; 63 } 64 65 public int getBuddyCommunicationTimeout() 66 { 67 return buddyCommunicationTimeout; 68 } 69 70 public void setBuddyCommunicationTimeout(int buddyCommunicationTimeout) 71 { 72 testImmutability("buddyCommunicationTimeout"); 73 this.buddyCommunicationTimeout = buddyCommunicationTimeout; 74 } 75 76 public String getBuddyPoolName() 77 { 78 return buddyPoolName; 79 } 80 81 public void setBuddyPoolName(String buddyPoolName) 82 { 83 testImmutability("buddyPoolName"); 84 this.buddyPoolName = buddyPoolName; 85 } 86 87 public boolean isDataGravitationRemoveOnFind() 88 { 89 return dataGravitationRemoveOnFind; 90 } 91 92 public void setDataGravitationRemoveOnFind(boolean dataGravitationRemoveOnFind) 93 { 94 testImmutability("dataGravitationRemoveOnFind"); 95 this.dataGravitationRemoveOnFind = dataGravitationRemoveOnFind; 96 } 97 98 public boolean isDataGravitationSearchBackupTrees() 99 { 100 return dataGravitationSearchBackupTrees; 101 } 102 103 public void setDataGravitationSearchBackupTrees(boolean dataGravitationSearchBackupTrees) 104 { 105 testImmutability("dataGravitationSearchBackupTrees"); 106 this.dataGravitationSearchBackupTrees = dataGravitationSearchBackupTrees; 107 } 108 109 public boolean isEnabled() 110 { 111 return enabled; 112 } 113 114 public void setEnabled(boolean enabled) 115 { 116 testImmutability("enabled"); 117 this.enabled = enabled; 118 } 119 120 public BuddyLocatorConfig getBuddyLocatorConfig() 121 { 122 return buddyLocatorConfig; 123 } 124 125 public void setBuddyLocatorConfig(BuddyLocatorConfig buddyLocatorConfig) 126 { 127 testImmutability("buddyLocatorConfig"); 128 replaceChildConfig(this.buddyLocatorConfig, buddyLocatorConfig); 129 this.buddyLocatorConfig = buddyLocatorConfig; 130 } 131 132 public boolean equals(Object obj) 133 { 134 if (this == obj) 135 return true; 136 137 if (obj instanceof BuddyReplicationConfig) 138 { 139 BuddyReplicationConfig other = (BuddyReplicationConfig) obj; 140 return (this.autoDataGravitation == other.autoDataGravitation) 141 && (this.dataGravitationRemoveOnFind == other.dataGravitationRemoveOnFind) 142 && (this.dataGravitationSearchBackupTrees == other.dataGravitationSearchBackupTrees) 143 && (this.enabled == other.enabled) 144 && (this.buddyCommunicationTimeout == other.buddyCommunicationTimeout) 145 && safeEquals(this.buddyPoolName, other.buddyPoolName) 146 && safeEquals(this.buddyLocatorConfig, other.buddyLocatorConfig); 147 } 148 149 return false; 150 } 151 152 public int hashCode() 153 { 154 int result = 11; 155 result = 29 * result + (autoDataGravitation ? 0 : 1); 156 result = 29 * result + (dataGravitationRemoveOnFind ? 0 : 1); 157 result = 29 * result + (dataGravitationSearchBackupTrees ? 0 : 1); 158 result = 29 * result + (enabled ? 0 : 1); 159 result = 29 * result + buddyCommunicationTimeout; 160 result = 29 * result + (buddyPoolName == null ? 0 : buddyPoolName.hashCode()); 161 result = 29 * result + (buddyLocatorConfig == null ? 0 : buddyLocatorConfig.hashCode()); 162 return result; 163 } 164 165 public static class BuddyLocatorConfig extends ConfigurationComponent 166 { 167 private static final long serialVersionUID = -8003634097931826091L; 168 169 private String buddyLocatorClass = NextMemberBuddyLocator.class.getName(); 170 ; 171 private Properties buddyLocatorProperties; 172 173 public BuddyLocatorConfig() 174 { 175 } 176 177 public String getBuddyLocatorClass() 178 { 179 return buddyLocatorClass; 180 } 181 182 public void setBuddyLocatorClass(String buddyLocatorClass) 183 { 184 testImmutability("buddyLocatorClass"); 185 this.buddyLocatorClass = buddyLocatorClass; 186 if (buddyLocatorClass == null) 187 this.buddyLocatorClass = NextMemberBuddyLocator.class.getName(); 188 } 189 190 public Properties getBuddyLocatorProperties() 191 { 192 return buddyLocatorProperties; 193 } 194 195 public void setBuddyLocatorProperties(Properties buddyLocatorProperties) 196 { 197 testImmutability("buddyLocatorProperties"); 198 this.buddyLocatorProperties = buddyLocatorProperties; 199 } 200 201 public boolean equals(Object obj) 202 { 203 if (this == obj) 204 return true; 205 206 if (obj instanceof BuddyLocatorConfig) 207 { 208 BuddyLocatorConfig other = (BuddyLocatorConfig) obj; 209 return (safeEquals(this.buddyLocatorClass, other.buddyLocatorClass) 210 && safeEquals(this.buddyLocatorProperties, other.buddyLocatorProperties)); 211 } 212 return false; 213 } 214 215 public int hashCode() 216 { 217 int result = 19; 218 result = 41 * result + (buddyLocatorClass == null ? 0 : buddyLocatorClass.hashCode()); 219 result = 41 * result + (buddyLocatorProperties == null ? 0 : buddyLocatorProperties.hashCode()); 220 return result; 221 } 222 223 public String toString() 224 { 225 return super.toString() + " class=" + buddyLocatorClass + 226 " properties=" + buddyLocatorProperties; 227 } 228 229 } 230 } 231 | Popular Tags |