1 22 package org.jboss.cache.jmx; 23 24 import org.jboss.cache.config.BuddyReplicationConfig; 25 import org.jboss.cache.config.CacheLoaderConfig; 26 import org.jboss.cache.config.Configuration; 27 import org.jboss.cache.config.EvictionConfig; 28 import org.jboss.cache.factories.XmlConfigurationParser; 29 import org.jgroups.jmx.JChannelFactoryMBean; 30 import org.w3c.dom.Element ; 31 32 import javax.management.NotificationBroadcaster ; 33 import javax.transaction.TransactionManager ; 34 35 43 public class CacheLegacyJmxWrapper extends CacheJmxWrapper implements CacheLegacyJmxWrapperMBean, NotificationBroadcaster 44 { 45 private Element buddyReplConfig; 46 private Element evictionConfig; 47 private Element cacheLoaderConfig; 48 49 public CacheLegacyJmxWrapper() 50 { 51 super(); 52 setConfiguration(new Configuration()); 53 } 54 55 public Configuration getConfiguration() 56 { 57 Configuration result = super.getConfiguration(); 58 if (result == null) 59 { 60 result = new Configuration(); 61 setConfiguration(result); 62 } 63 return result; 64 } 65 66 public Element getBuddyReplicationConfig() 67 { 68 return buddyReplConfig; 69 } 70 71 public Element getCacheLoaderConfiguration() 72 { 73 return cacheLoaderConfig; 74 } 75 76 public String getCacheMode() 77 { 78 return getConfiguration().getCacheModeString(); 79 } 80 81 public String getClusterName() 82 { 83 return getConfiguration().getClusterName(); 84 } 85 86 public String getClusterProperties() 87 { 88 return getConfiguration().getClusterConfig(); 89 } 90 91 public Element getEvictionPolicyConfig() 92 { 93 return evictionConfig; 94 } 95 96 public boolean getExposeManagementStatistics() 97 { 98 return getConfiguration().getExposeManagementStatistics(); 99 } 100 101 public boolean getFetchInMemoryState() 102 { 103 return getConfiguration().isFetchInMemoryState(); 104 } 105 106 public long getInitialStateRetrievalTimeout() 107 { 108 return getConfiguration().getInitialStateRetrievalTimeout(); 109 } 110 111 public String getIsolationLevel() 112 { 113 return getConfiguration().getIsolationLevelString(); 114 } 115 116 public long getLockAcquisitionTimeout() 117 { 118 return getConfiguration().getLockAcquisitionTimeout(); 119 } 120 121 public String getMultiplexerService() 122 { 123 return getConfiguration().getMultiplexerService(); 124 } 125 126 public String getMultiplexerStack() 127 { 128 return getConfiguration().getMultiplexerStack(); 129 } 130 131 public JChannelFactoryMBean getMuxChannelFactory() 132 { 133 return getConfiguration().getRuntimeConfig().getMuxChannelFactory(); 134 } 135 136 public String getNodeLockingScheme() 137 { 138 return getConfiguration().getNodeLockingSchemeString(); 139 } 140 141 public long getReplQueueInterval() 142 { 143 return getConfiguration().getReplQueueInterval(); 144 } 145 146 public int getReplQueueMaxElements() 147 { 148 return getConfiguration().getReplQueueMaxElements(); 149 } 150 151 public String getReplicationVersion() 152 { 153 return getConfiguration().getReplVersionString(); 154 } 155 156 public boolean getSyncCommitPhase() 157 { 158 return getConfiguration().isSyncCommitPhase(); 159 } 160 161 public long getSyncReplTimeout() 162 { 163 return getConfiguration().getSyncReplTimeout(); 164 } 165 166 public boolean getSyncRollbackPhase() 167 { 168 return getConfiguration().isSyncRollbackPhase(); 169 } 170 171 public TransactionManager getTransactionManager() 172 { 173 return getConfiguration().getRuntimeConfig().getTransactionManager(); 174 } 175 176 public String getTransactionManagerLookupClass() 177 { 178 return getConfiguration().getTransactionManagerLookupClass(); 179 } 180 181 public boolean getUseRegionBasedMarshalling() 182 { 183 return getConfiguration().isUseRegionBasedMarshalling(); 184 } 185 186 public boolean getUseReplQueue() 187 { 188 return getConfiguration().isUseReplQueue(); 189 } 190 191 public boolean isInactiveOnStartup() 192 { 193 return getConfiguration().isInactiveOnStartup(); 194 } 195 196 public void setBuddyReplicationConfig(Element config) 197 { 198 BuddyReplicationConfig brc = null; 199 if (config != null) 200 { 201 brc = XmlConfigurationParser.parseBuddyReplicationConfig(config); 202 } 203 getConfiguration().setBuddyReplicationConfig(brc); 204 } 205 206 public void setCacheLoaderConfiguration(Element cache_loader_config) 207 { 208 CacheLoaderConfig clc = null; 209 if (cache_loader_config != null) 210 { 211 clc = XmlConfigurationParser.parseCacheLoaderConfig(cache_loader_config); 212 } 213 getConfiguration().setCacheLoaderConfig(clc); 214 } 215 216 public void setCacheMode(String mode) throws Exception 217 { 218 getConfiguration().setCacheModeString(mode); 219 } 220 221 public void setClusterConfig(Element config) 222 { 223 String props = null; 224 if (config != null) 225 { 226 props = XmlConfigurationParser.parseClusterConfigXml(config); 227 } 228 getConfiguration().setClusterConfig(props); 229 } 230 231 public void setClusterName(String name) 232 { 233 getConfiguration().setClusterName(name); 234 } 235 236 public void setClusterProperties(String cluster_props) 237 { 238 getConfiguration().setClusterConfig(cluster_props); 239 } 240 241 public void setEvictionPolicyConfig(Element config) 242 { 243 EvictionConfig ec = null; 244 if (config != null) 245 { 246 ec = XmlConfigurationParser.parseEvictionConfig(config, null); 247 } 248 getConfiguration().setEvictionConfig(ec); 249 } 250 251 public void setExposeManagementStatistics(boolean expose) 252 { 253 getConfiguration().setExposeManagementStatistics(expose); 254 } 255 256 public void setFetchInMemoryState(boolean flag) 257 { 258 getConfiguration().setFetchInMemoryState(flag); 259 } 260 261 public void setInactiveOnStartup(boolean inactiveOnStartup) 262 { 263 getConfiguration().setInactiveOnStartup(inactiveOnStartup); 264 } 265 266 public void setInitialStateRetrievalTimeout(long timeout) 267 { 268 getConfiguration().setInitialStateRetrievalTimeout(timeout); 269 } 270 271 public void setIsolationLevel(String level) 272 { 273 getConfiguration().setIsolationLevelString(level); 274 } 275 276 public void setLockAcquisitionTimeout(long timeout) 277 { 278 getConfiguration().setLockAcquisitionTimeout(timeout); 279 } 280 281 public void setMultiplexerService(String serviceName) 282 { 283 getConfiguration().setMultiplexerService(serviceName); 284 } 285 286 public void setMultiplexerStack(String stackName) 287 { 288 getConfiguration().setMultiplexerStack(stackName); 289 } 290 291 public void setMuxChannelFactory(JChannelFactoryMBean factory) 292 { 293 getConfiguration().getRuntimeConfig().setMuxChannelFactory(factory); 294 } 295 296 public void setNodeLockingScheme(String nodeLockingScheme) 297 { 298 getConfiguration().setNodeLockingSchemeString(nodeLockingScheme); 299 } 300 301 public void setReplQueueInterval(long interval) 302 { 303 getConfiguration().setReplQueueInterval(interval); 304 } 305 306 public void setReplQueueMaxElements(int max_elements) 307 { 308 getConfiguration().setReplQueueMaxElements(max_elements); 309 } 310 311 public void setReplicationVersion(String version) 312 { 313 getConfiguration().setReplVersionString(version); 314 } 315 316 public void setSyncCommitPhase(boolean sync_commit_phase) 317 { 318 getConfiguration().setSyncCommitPhase(sync_commit_phase); 319 } 320 321 public void setSyncReplTimeout(long timeout) 322 { 323 getConfiguration().setSyncReplTimeout(timeout); 324 } 325 326 public void setSyncRollbackPhase(boolean sync_rollback_phase) 327 { 328 getConfiguration().setSyncRollbackPhase(sync_rollback_phase); 329 } 330 331 public void setTransactionManager(TransactionManager manager) 332 { 333 getConfiguration().getRuntimeConfig().setTransactionManager(manager); 334 } 335 336 public void setTransactionManagerLookupClass(String cl) throws Exception 337 { 338 getConfiguration().setTransactionManagerLookupClass(cl); 339 } 340 341 public void setUseRegionBasedMarshalling(boolean isTrue) 342 { 343 getConfiguration().setUseRegionBasedMarshalling(isTrue); 344 } 345 346 public void setUseReplQueue(boolean flag) 347 { 348 getConfiguration().setUseReplQueue(flag); 349 } 350 351 } 352 | Popular Tags |