JBoss Cache SVN: r7598 - in core/branches/flat/src: main/java/org/horizon/config and 8 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-26 20:51:15 -0500 (Mon, 26 Jan 2009)
New Revision: 7598
Added:
core/branches/flat/src/test/java/org/horizon/config/parsing/
core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java
core/branches/flat/src/test/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java
core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java
Removed:
core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java
core/branches/flat/src/test/java/org/horizon/config/parser/
Modified:
core/branches/flat/src/main/java/org/horizon/CacheDelegate.java
core/branches/flat/src/main/java/org/horizon/Version.java
core/branches/flat/src/main/java/org/horizon/config/AbstractConfigurationBean.java
core/branches/flat/src/main/java/org/horizon/config/CacheLoaderConfig.java
core/branches/flat/src/main/java/org/horizon/config/Configuration.java
core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java
core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java
core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java
core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java
core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java
core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManager.java
core/branches/flat/src/main/java/org/horizon/loader/SingletonStoreDefaultConfig.java
core/branches/flat/src/main/resources/config-samples/all.xml
core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd
core/branches/flat/src/test/resources/configs/named-cache-test.xml
core/branches/flat/src/test/resources/configs/string-property-replaced.xml
Log:
More configuration fixes
Modified: core/branches/flat/src/main/java/org/horizon/CacheDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/CacheDelegate.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/CacheDelegate.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -365,7 +365,7 @@
}
public String getVersion() {
- return Version.decodeVersion(Version.getVersionShort());
+ return Version.version;
}
public void setName(String name) {
Modified: core/branches/flat/src/main/java/org/horizon/Version.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/Version.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/Version.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -129,6 +129,15 @@
return major + "." + minor + "." + patch;
}
+ /**
+ * Serialization only looks at major and minor, not micro or below.
+ */
+ public static String decodeVersionForSerialization(short version) {
+ int major = (version & MAJOR_MASK) >> MAJOR_SHIFT;
+ int minor = (version & MINOR_MASK) >> MINOR_SHIFT;
+ return major + "." + minor;
+ }
+
private static String[] getParts(String versionString) {
return versionString.split("[\\.\\-]");
}
Modified: core/branches/flat/src/main/java/org/horizon/config/AbstractConfigurationBean.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/AbstractConfigurationBean.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/AbstractConfigurationBean.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -46,9 +46,9 @@
@Scope(Scopes.NAMED_CACHE)
public abstract class AbstractConfigurationBean implements CloneableConfigurationComponent {
private static final long serialVersionUID = 4879873994727821938L;
-
+ protected static final TypedProperties EMPTY_PROPERTIES = new TypedProperties();
protected transient Log log = LogFactory.getLog(getClass());
-// private transient CacheSPI cache; // back-reference to test whether the cache is running.
+ // private transient CacheSPI cache; // back-reference to test whether the cache is running.
// private transient ComponentRegistry cr;
// a workaround to get over immutability checks
private boolean accessible;
Modified: core/branches/flat/src/main/java/org/horizon/config/CacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/CacheLoaderConfig.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/CacheLoaderConfig.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -42,16 +42,12 @@
private static final long serialVersionUID = 2210349340378984424L;
private boolean passivation;
- private String preload;
+ private boolean preload;
private List<IndividualCacheLoaderConfig> cacheLoaderConfigs = new ArrayList<IndividualCacheLoaderConfig>();
private boolean shared;
- public String getPreload() {
- return preload;
- }
-
- public void setPreload(String preload) {
+ public void setPreload(boolean preload) {
testImmutability("preload");
this.preload = preload;
}
@@ -122,7 +118,7 @@
int result = 19;
result = 51 * result + (passivation ? 0 : 1);
result = 51 * result + (shared ? 0 : 1);
- result = 51 * result + (preload == null ? 0 : preload.hashCode());
+ result = 51 * result + (preload ? 0 : 1);
result = 51 * result + (cacheLoaderConfigs == null ? 0 : cacheLoaderConfigs.hashCode());
return result;
}
@@ -151,7 +147,11 @@
return false;
}
+ public boolean isPreload() {
+ return preload;
+ }
+
/**
* Configuration object that holds the confguration of an individual cache loader.
*
@@ -340,11 +340,11 @@
setClassName(className);
}
- public Properties getSingletonStoreproperties() {
+ public Properties getSingletonStoreProperties() {
return properties;
}
- public void setSingletonStoreproperties(Properties properties) {
+ public void setSingletonStoreProperties(Properties properties) {
setProperties(properties);
}
Modified: core/branches/flat/src/main/java/org/horizon/config/Configuration.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/Configuration.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/Configuration.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -45,6 +45,7 @@
private Map<String, EvictionCacheConfig> evictionCacheConfigs = new HashMap<String, EvictionCacheConfig>(4);
private GlobalConfiguration globalConfiguration;
+ private boolean useAsyncSerialization = true;
public EvictionCacheConfig getEvictionCacheConfig(String cacheName) {
return evictionCacheConfigs.values().iterator().next();
@@ -63,6 +64,10 @@
this.globalConfiguration = globalConfiguration;
}
+ public boolean isUseAsyncSerialization() {
+ return useAsyncSerialization;
+ }
+
/**
* Cache replication mode.
*/
@@ -320,6 +325,11 @@
this.useLazyDeserialization = useLazyDeserialization;
}
+ public void setUseAsyncSerialization(boolean useAsyncSerialization) {
+ testImmutability("useAsyncSerialization");
+ this.useAsyncSerialization = useAsyncSerialization;
+ }
+
// ------------------------------------------------------------------------------------------------------------
// GETTERS
// ------------------------------------------------------------------------------------------------------------
Modified: core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -30,7 +30,6 @@
* Default replication version, from {@link org.horizon.Version#getVersionShort}.
*/
public static final short DEFAULT_MARSHALL_VERSION = Version.getVersionShort();
- private static final TypedProperties EMPTY_PROPERTIES = new TypedProperties();
String asyncListenerExecutorFactoryClass = DefaultExecutorFactory.class.getName();
TypedProperties asyncListenerExecutorProperties = EMPTY_PROPERTIES;
@@ -264,13 +263,9 @@
}
public String getMarshallVersionString() {
- return Version.decodeVersion(marshallVersion);
+ return Version.decodeVersionForSerialization(marshallVersion);
}
- public String getReplicationVersionString() {
- return Version.decodeVersion(marshallVersion);
- }
-
public void setMarshallVersion(short marshallVersion) {
testImmutability("marshallVersion");
this.marshallVersion = marshallVersion;
Modified: core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -35,7 +35,7 @@
*/
public abstract class PluggableConfigurationComponent extends AbstractNamedCacheConfigurationBean {
protected String className;
- protected Properties properties;
+ protected Properties properties = EMPTY_PROPERTIES;
public String getClassName() {
return className;
Deleted: core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -1,200 +0,0 @@
-package org.horizon.config.parsing;
-
-import org.horizon.config.GlobalConfiguration;
-import org.horizon.executors.DefaultExecutorFactory;
-import org.horizon.executors.DefaultScheduledExecutorFactory;
-import org.horizon.marshall.HorizonMarshaller;
-import org.horizon.marshall.VersionAwareMarshaller;
-import org.horizon.remoting.transport.jgroups.JGroupsTransport;
-import org.testng.annotations.Test;
-import org.w3c.dom.Element;
-
-
-@Test(groups = "unit")
-public class GlobalConfigurationParserTest {
-
- public void testTransport() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String transportClass = "org.blah.Blah";
- String xml = "<transport transportClass=\"" + transportClass + "\"><property name=\"something\">value</property></transport>";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureTransport(e, gc);
-
- assert gc.getTransportClass().equals(transportClass);
- assert gc.getTransportProperties().size() == 1;
- assert gc.getTransportProperties().getProperty("something").equals("value");
- }
-
- public void testDefaultTransport() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<transport />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureTransport(e, gc);
-
- assert gc.getTransportClass().equals(JGroupsTransport.class.getName());
- assert gc.getTransportProperties().size() == 0;
- }
-
- public void testShutdown() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<shutdown hookBehavior=\"REGISTER\" />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureShutdown(e, gc);
-
- assert gc.getShutdownHookBehavior() == GlobalConfiguration.ShutdownHookBehavior.REGISTER;
- }
-
- public void testDefaultShutdown() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<shutdown />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureShutdown(e, gc);
-
- assert gc.getShutdownHookBehavior() == GlobalConfiguration.ShutdownHookBehavior.DEFAULT;
- }
-
- public void testMarshalling() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<serialization marshallerClass=\"org.horizon.marshall.HorizonMarshaller\" version=\"9.2\"\n" +
- " objectInputStreamPoolSize=\"100\" objectOutputStreamPoolSize=\"100\"/>";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureMarshalling(e, gc);
-
- assert gc.getMarshallerClass().equals(HorizonMarshaller.class.getName());
- assert gc.getMarshallVersionString().equals("9.2.0");
- assert gc.getObjectInputStreamPoolSize() == 100;
- assert gc.getObjectOutputStreamPoolSize() == 100;
- }
-
- public void testMarshallingDefaults() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<serialization />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureMarshalling(e, gc);
-
- assert gc.getMarshallerClass().equals(VersionAwareMarshaller.class.getName());
- assert gc.getMarshallVersionString().equals("1.0.0");
- assert gc.getObjectInputStreamPoolSize() == 50;
- assert gc.getObjectOutputStreamPoolSize() == 50;
- }
-
- public void testAsyncListenerExecutor() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<asyncListenerExecutor factory=\"com.mycompany.Factory\">\n" +
- " <property name=\"maxThreads\" value=\"5\" />" +
- " </asyncListenerExecutor>";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureAsyncListenerExecutor(e, gc);
-
- assert gc.getAsyncListenerExecutorFactoryClass().equals("com.mycompany.Factory");
- assert gc.getAsyncListenerExecutorProperties().size() == 1;
- assert gc.getAsyncListenerExecutorProperties().get("maxThreads").equals("5");
- }
-
- public void testAsyncSerializationExecutor() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<asyncSerializationExecutor factory=\"com.mycompany.Factory\">\n" +
- " <property name=\"maxThreads\" value=\"5\" />" +
- " </asyncSerializationExecutor>";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureAsyncSerializationExecutor(e, gc);
-
- assert gc.getAsyncSerializationExecutorFactoryClass().equals("com.mycompany.Factory");
- assert gc.getAsyncSerializationExecutorProperties().size() == 1;
- assert gc.getAsyncSerializationExecutorProperties().get("maxThreads").equals("5");
- }
-
- public void testEvictionScheduledExecutor() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<evictionScheduledExecutor factory=\"com.mycompany.Factory\">\n" +
- " <property name=\"maxThreads\" value=\"5\" />" +
- " </evictionScheduledExecutor>";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureEvictionScheduledExecutor(e, gc);
-
- assert gc.getEvictionScheduledExecutorFactoryClass().equals("com.mycompany.Factory");
- assert gc.getEvictionScheduledExecutorProperties().size() == 1;
- assert gc.getEvictionScheduledExecutorProperties().get("maxThreads").equals("5");
- }
-
- public void testReplicationQueueScheduledExecutor() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<replicationQueueScheduledExecutor factory=\"com.mycompany.Factory\">\n" +
- " <property name=\"maxThreads\" value=\"5\" />" +
- " </replicationQueueScheduledExecutor>";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureReplicationQueueScheduledExecutor(e, gc);
-
- assert gc.getReplicationQueueScheduledExecutorFactoryClass().equals("com.mycompany.Factory");
- assert gc.getReplicationQueueScheduledExecutorProperties().size() == 1;
- assert gc.getReplicationQueueScheduledExecutorProperties().get("maxThreads").equals("5");
- }
-
- public void testAsyncListenerExecutorDefaults() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<asyncListenerExecutor />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureAsyncListenerExecutor(e, gc);
-
- assert gc.getAsyncListenerExecutorFactoryClass().equals(DefaultExecutorFactory.class.getName());
- assert gc.getAsyncListenerExecutorProperties().size() == 0;
- }
-
- public void testAsyncSerializationExecutorDefaults() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<asyncSerializationExecutor />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureAsyncSerializationExecutor(e, gc);
-
- assert gc.getAsyncSerializationExecutorFactoryClass().equals(DefaultExecutorFactory.class.getName());
- assert gc.getAsyncSerializationExecutorProperties().size() == 0;
- }
-
- public void testEvictionScheduledExecutorDefaults() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<evictionScheduledExecutor />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureEvictionScheduledExecutor(e, gc);
-
- assert gc.getEvictionScheduledExecutorFactoryClass().equals(DefaultScheduledExecutorFactory.class.getName());
- assert gc.getEvictionScheduledExecutorProperties().size() == 0;
- }
-
- public void testReplicationQueueScheduledExecutorDefaults() throws Exception {
- XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<replicationQueueScheduledExecutor />";
- Element e = XmlConfigHelper.stringToElement(xml);
-
- GlobalConfiguration gc = new GlobalConfiguration();
- parser.configureReplicationQueueScheduledExecutor(e, gc);
-
- assert gc.getReplicationQueueScheduledExecutorFactoryClass().equals(DefaultScheduledExecutorFactory.class.getName());
- assert gc.getReplicationQueueScheduledExecutorProperties().size() == 0;
- }
-}
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -4,11 +4,13 @@
import org.horizon.config.Configuration;
import org.horizon.config.ConfigurationException;
import org.horizon.config.CustomInterceptorConfig;
+import org.horizon.config.DuplicateCacheNameException;
import org.horizon.config.GlobalConfiguration;
import org.horizon.config.parsing.element.CustomInterceptorsElementParser;
import org.horizon.config.parsing.element.EvictionElementParser;
import org.horizon.config.parsing.element.LoadersElementParser;
import org.horizon.lock.IsolationLevel;
+import org.horizon.transaction.GenericTransactionManagerLookup;
import org.horizon.util.FileLookup;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -16,9 +18,12 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
/**
* The default XML configuration parser
@@ -81,39 +86,57 @@
public Configuration parseDefaultConfiguration() throws ConfigurationException {
assertInitialized();
-// Element defaultConfiguration = getSingleElementInCoreNS("default", rootElement);
-// rootElementBuilder = new RootElementBuilder();
-// rootElement = defaultConfiguration;
-// return parseElementIgnoringRoot();
- return null;
+ Element defaultElement = getSingleElementInCoreNS("default", rootElement);
+ defaultElement.normalize();
+ return parseConfiguration(defaultElement);
}
public Map<String, Configuration> parseNamedConfigurations() throws ConfigurationException {
assertInitialized();
-// Set<Element> elements = getAllElementsInCoreNS("namedCache", rootElement);
-// if (elements.isEmpty()) return Collections.emptyMap();
-// Map<String, Configuration> namedConfigurations = new HashMap<String, Configuration>(elements.size(), 1.0f);
-// rootElementBuilder = new RootElementBuilder();
-// for (Element e : elements) {
-// String configurationName = getAttributeValue(e, "name");
-// if (namedConfigurations.containsKey(configurationName))
-// throw new ConfigurationException("Named cache " + configurationName + " contains duplicate entries!");
-//
-// namedConfigurations.put(configurationName, parseElementIgnoringRoot());
-// }
-//
-// return namedConfigurations;
- return null;
+ Set<Element> elements = getAllElementsInCoreNS("namedCache", rootElement);
+ if (elements.isEmpty()) return Collections.emptyMap();
+ Map<String, Configuration> namedConfigurations = new HashMap<String, Configuration>(elements.size(), 1.0f);
+ for (Element e : elements) {
+ String configurationName = getAttributeValue(e, "name");
+ if (namedConfigurations.containsKey(configurationName))
+ throw new DuplicateCacheNameException("Named cache " + configurationName + " is declared more than once!");
+ namedConfigurations.put(configurationName, parseConfiguration(e));
+ }
+
+ return namedConfigurations;
}
public GlobalConfiguration parseGlobalConfiguration() {
assertInitialized();
Element globalElement = getSingleElementInCoreNS("global", rootElement);
globalElement.normalize();
+ GlobalConfiguration gc = new GlobalConfiguration();
- return null;
+ configureAsyncListenerExecutor(getSingleElementInCoreNS("asyncListenerExecutor", globalElement), gc);
+ configureAsyncSerializationExecutor(getSingleElementInCoreNS("asyncSerializationExecutor", globalElement), gc);
+ configureEvictionScheduledExecutor(getSingleElementInCoreNS("evictionScheduledExecutor", globalElement), gc);
+ configureReplicationQueueScheduledExecutor(getSingleElementInCoreNS("replicationQueueScheduledExecutor", globalElement), gc);
+ configureTransport(getSingleElementInCoreNS("transport", globalElement), gc);
+ configureShutdown(getSingleElementInCoreNS("shutdown", globalElement), gc);
+ configureSerialization(getSingleElementInCoreNS("serialization", globalElement), gc);
+
+ return gc;
}
+ private Configuration parseConfiguration(Element e) {
+ Configuration c = new Configuration();
+ configureLocking(getSingleElementInCoreNS("locking", e), c);
+ configureTransaction(getSingleElementInCoreNS("transaction", e), c);
+ configureJmxStatistics(getSingleElementInCoreNS("jmxStatistics", e), c);
+ configureInvocationBatching(getSingleElementInCoreNS("invocationBatching", e), c);
+ configureClustering(getSingleElementInCoreNS("clustering", e), c);
+ configureEviction(getSingleElementInCoreNS("eviction", e), c);
+ configureCacheLoaders(getSingleElementInCoreNS("loaders", e), c);
+ configureCustomInterceptors(getSingleElementInCoreNS("customInterceptors", e), c);
+
+ return c;
+ }
+
private void assertInitialized() {
if (!initialized)
throw new ConfigurationException("Parser not initialized. Please invoke initialize() first, or use a constructor that initializes the parser.");
@@ -192,35 +215,21 @@
}
void configureTransaction(Element element, Configuration config) {
- if (element == null) return;
- String attrName = "transactionManagerLookupClass";
- String txMngLookupClass = getAttributeValue(element, attrName);
- if (existsAttribute(txMngLookupClass)) config.setTransactionManagerLookupClass(txMngLookupClass);
- String syncRollbackPhase = getAttributeValue(element, "syncRollbackPhase");
- if (existsAttribute(syncRollbackPhase)) config.setSyncRollbackPhase(getBoolean(syncRollbackPhase));
- String syncCommitPhase = getAttributeValue(element, "syncCommitPhase");
- if (existsAttribute(syncCommitPhase)) config.setSyncCommitPhase(getBoolean(syncCommitPhase));
+ if (element != null) {
+ String tmp = getAttributeValue(element, "transactionManagerLookupClass");
+ if (existsAttribute(tmp)) {
+ config.setTransactionManagerLookupClass(tmp);
+ } else {
+ // use defaults since the transaction element is still present!
+ config.setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
+ }
+ String syncRollbackPhase = getAttributeValue(element, "syncRollbackPhase");
+ if (existsAttribute(syncRollbackPhase)) config.setSyncRollbackPhase(getBoolean(syncRollbackPhase));
+ String syncCommitPhase = getAttributeValue(element, "syncCommitPhase");
+ if (existsAttribute(syncCommitPhase)) config.setSyncCommitPhase(getBoolean(syncCommitPhase));
+ }
}
- void configureSerialization(Element element, Configuration config) {
- if (element == null) return;
- String objectInputStreamPoolSize = getAttributeValue(element, "objectInputStreamPoolSize");
-// if (existsAttribute(objectInputStreamPoolSize))
-// config.setObjectInputStreamPoolSize(getInt(objectInputStreamPoolSize));
- String objectOutputStreamPoolSize = getAttributeValue(element, "objectOutputStreamPoolSize");
-// if (existsAttribute(objectOutputStreamPoolSize))
-// config.setObjectOutputStreamPoolSize(getInt(objectOutputStreamPoolSize));
- String version = getAttributeValue(element, "version");
-// if (existsAttribute(version)) config.setReplVersionString(version);
- String marshallerClass = getAttributeValue(element, "marshallerClass");
-// if (existsAttribute(marshallerClass)) config.setMarshallerClass(marshallerClass);
- String useLazyDeserialization = getAttributeValue(element, "useLazyDeserialization");
- if (existsAttribute(useLazyDeserialization)) config.setUseLazyDeserialization(getBoolean(useLazyDeserialization));
- String useRegionBasedMarshalling = getAttributeValue(element, "useRegionBasedMarshalling");
-// if (existsAttribute(useRegionBasedMarshalling))
-// config.setUseRegionBasedMarshalling(getBoolean(useRegionBasedMarshalling));
- }
-
void configureCustomInterceptors(Element element, Configuration config) {
if (element == null) return; //this element might be missing
CustomInterceptorsElementParser parser = new CustomInterceptorsElementParser();
@@ -228,21 +237,19 @@
config.setCustomInterceptors(interceptorConfigList);
}
- void configureListeners(Element element, Configuration config) {
- if (element == null) return; //this element is optional
- String asyncPoolSizeStr = getAttributeValue(element, "asyncPoolSize");
-// if (existsAttribute(asyncPoolSizeStr)) config.setListenerAsyncPoolSize(getInt(asyncPoolSizeStr));
+ void configureInvocationBatching(Element element, Configuration config) {
+ if (element != null) {
+ String enabled = getAttributeValue(element, "enabled");
+ if (existsAttribute(enabled)) {
+ config.setInvocationBatchingEnabled(getBoolean(enabled));
+ } else {
+ // enable this anyway since the XML element is present
+ config.setInvocationBatchingEnabled(true);
+ }
- String asyncQueueSizeStr = getAttributeValue(element, "asyncQueueSize");
-// if (existsAttribute(asyncQueueSizeStr)) config.setListenerAsyncQueueSize(getInt(asyncQueueSizeStr));
+ }
}
- void configureInvocationBatching(Element element, Configuration config) {
- if (element == null) return; //this element is optional
- boolean enabled = getBoolean(getAttributeValue(element, "enabled"));
- config.setInvocationBatchingEnabled(enabled);
- }
-
void configureCacheLoaders(Element element, Configuration config) {
if (element == null) return; //null cache loaders are allowed
LoadersElementParser clElementParser = new LoadersElementParser();
@@ -257,9 +264,15 @@
}
void configureJmxStatistics(Element element, Configuration config) {
- if (element == null) return; //might not be specified
- String enabled = getAttributeValue(element, "enabled");
- config.setExposeManagementStatistics(getBoolean(enabled));
+ if (element != null) {
+ String enabled = getAttributeValue(element, "enabled");
+ if (existsAttribute(enabled)) {
+ config.setExposeManagementStatistics(getBoolean(enabled));
+ } else {
+ // by default enable this since the element is present!
+ config.setExposeManagementStatistics(true);
+ }
+ }
}
void configureInvalidation(Element element, Configuration config) {
@@ -282,20 +295,14 @@
}
void configureAsyncMode(Element element, Configuration config) {
- String useReplQueue = getAttributeValue(element, "useReplQueue");
- if (existsAttribute(useReplQueue)) config.setUseReplQueue(getBoolean(useReplQueue));
- String replQueueInterval = getAttributeValue(element, "replQueueInterval");
- if (existsAttribute(replQueueInterval)) config.setReplQueueInterval(getLong(replQueueInterval));
- String replQueueMaxElements = getAttributeValue(element, "replQueueMaxElements");
-
- if (existsAttribute(replQueueMaxElements)) config.setReplQueueMaxElements(getInt(replQueueMaxElements));
- String serializationExecutorPoolSize = getAttributeValue(element, "serializationExecutorPoolSize");
-// if (existsAttribute(serializationExecutorPoolSize))
-// config.setSerializationExecutorPoolSize(getInt(serializationExecutorPoolSize));
-
- String serializationExecutorQueueSize = getAttributeValue(element, "serializationExecutorQueueSize");
-// if (existsAttribute(serializationExecutorQueueSize))
-// config.setSerializationExecutorQueueSize(getInt(serializationExecutorQueueSize));
+ String tmp = getAttributeValue(element, "useReplQueue");
+ if (existsAttribute(tmp)) config.setUseReplQueue(getBoolean(tmp));
+ tmp = getAttributeValue(element, "replQueueInterval");
+ if (existsAttribute(tmp)) config.setReplQueueInterval(getLong(tmp));
+ tmp = getAttributeValue(element, "replQueueMaxElements");
+ if (existsAttribute(tmp)) config.setReplQueueMaxElements(getInt(tmp));
+ tmp = getAttributeValue(element, "useAsyncSerialization");
+ if (existsAttribute(tmp)) config.setUseAsyncSerialization(getBoolean(tmp));
}
void configureLocking(Element element, Configuration config) {
@@ -323,29 +330,26 @@
}
}
- void configureTransport(Element element, GlobalConfiguration config) {
-// if (element == null) return; //transport might be missing
-//
-// // first see if a configFile is provided
-// String cfgFile = getAttributeValue(element, "configFile");
-// if (existsAttribute(cfgFile)) {
-// // try and load this file
-// URL u = new FileLookup().lookupFileLocation(cfgFile);
-// config.setJgroupsConfigFile(u);
-// } else {
-// String multiplexerStack = getAttributeValue(element, "multiplexerStack");
-// if (existsAttribute(multiplexerStack)) {
-// config.setMultiplexerStack(multiplexerStack);
-// } else {
-// JGroupsStackParser stackParser = new JGroupsStackParser();
-// String clusterConfigStr = stackParser.parseClusterConfigXml(element);
-// if (clusterConfigStr != null && clusterConfigStr.trim().length() > 0)
-// config.setClusterConfig(clusterConfigStr);
-// }
-// }
+ void configureTransport(Element e, GlobalConfiguration gc) {
+ // if the element does NOT exist then don't use a transport class at all!
+ if (e != null) {
+ String tmp = getAttributeValue(e, "transportClass");
+ if (existsAttribute(tmp)) {
+ gc.setTransportClass(tmp);
+ } else {
+ // the class is not specified; use the default
+ gc.setTransportClass(GlobalConfiguration.getClusteredDefault().getTransportClass());
+ }
+
+ tmp = getAttributeValue(e, "clusterName");
+ if (existsAttribute(tmp)) gc.setClusterName(tmp);
+
+ Properties p = XmlConfigHelper.extractProperties(e);
+ if (p != null) gc.setTransportProperties(p);
+ }
}
- void configureMarshalling(Element e, GlobalConfiguration configuration) {
+ void configureSerialization(Element e, GlobalConfiguration configuration) {
if (e != null) {
String tmp = getAttributeValue(e, "marshallerClass");
if (existsAttribute(tmp)) configuration.setMarshallerClass(tmp);
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -71,7 +71,11 @@
*/
protected Element getSingleElement(String namespace, String elementName, Element parent) {
NodeList nodeList = parent.getElementsByTagNameNS(namespace, elementName);
- if (nodeList.getLength() == 0) return null;
+ if (nodeList.getLength() == 0) {
+ // Try outside the core NS
+ nodeList = parent.getElementsByTagName(elementName);
+ if (nodeList.getLength() == 0) return null;
+ }
return (Element) nodeList.item(0);
}
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -47,8 +47,8 @@
if (existsAttribute(passivation)) cacheLoaderConfig.setPassivation(getBoolean(passivation));
String shared = getAttributeValue(element, "shared");
if (existsAttribute(shared)) cacheLoaderConfig.setShared(getBoolean(shared));
- String preload = getPreloadString(getSingleElementInCoreNS("preload", element));
- if (preload != null) cacheLoaderConfig.setPreload(preload);
+ boolean preload = getBoolean(getAttributeValue(element, "preload"));
+ cacheLoaderConfig.setPreload(preload);
NodeList cacheLoaderNodes = element.getElementsByTagName("loader");
for (int i = 0; i < cacheLoaderNodes.getLength(); i++) {
@@ -82,25 +82,6 @@
return iclc;
}
- private String getPreloadString(Element preloadElement) {
- if (preloadElement == null) return null; //might be no preload
- NodeList nodesToPreload = preloadElement.getElementsByTagName("node");
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < nodesToPreload.getLength(); i++) {
- Element node = (Element) nodesToPreload.item(i);
- String fqn2preload = getAttributeValue(node, "fqn");
- if (!existsAttribute(fqn2preload))
- throw new ConfigurationException("Missing 'fqn' attribute in 'preload' element");
- if (i > 0) result.append(",");
- result.append(fqn2preload);
- }
- //no elements defined for preload so by default load the root
- if (nodesToPreload.getLength() == 0) {
- result.append("/");
- }
- return result.toString();
- }
-
public CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig parseSingletonStoreConfig(Element element) {
if (element == null) return null; //might happen, this config option is not mandatory
boolean singletonStoreEnabled = getBoolean(getAttributeValue(element, "enabled"));
@@ -110,7 +91,7 @@
Properties singletonStoreproperties = XmlConfigHelper.readPropertiesContents(element, "properties");
ssc.setSingletonStoreEnabled(singletonStoreEnabled);
ssc.setSingletonStoreClass(singletonStoreClass);
- ssc.setSingletonStoreproperties(singletonStoreproperties);
+ ssc.setSingletonStoreProperties(singletonStoreproperties);
return ssc;
}
}
Modified: core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManager.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManager.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManager.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -38,7 +38,6 @@
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.StringTokenizer;
/**
* Manages all cache loader functionality. This class is typically initialised with an XML DOM Element, represeting a
@@ -253,42 +252,22 @@
@Start(priority = 50)
public void preloadCache() throws CacheException {
if (loader != null) {
- if (config.getPreload() == null || config.getPreload().equals("")) return;
- if (log.isDebugEnabled()) log.debug("preloading transient state from cache loader " + loader);
- StringTokenizer st = new StringTokenizer(config.getPreload(), ",");
- long start, stop, total;
- start = System.currentTimeMillis();
- while (st.hasMoreTokens()) {
- String tok = st.nextToken().trim();
- if (log.isTraceEnabled()) log.trace("preloading " + tok);
- preload(tok);
+ if (config.isPreload()) {
+ if (log.isDebugEnabled()) log.debug("preloading transient state from cache loader {0}", loader);
+ long start, stop, total;
+ start = System.currentTimeMillis();
+ // TODO: Call preload on the cache loader interface
+ if (true) throw new RuntimeException("implement me");
+ stop = System.currentTimeMillis();
+ total = stop - start;
+ if (log.isDebugEnabled()) {
+ log.debug("preloading transient state from cache loader was successful (in " + total + " milliseconds)");
+ }
}
-
- stop = System.currentTimeMillis();
- total = stop - start;
- if (log.isDebugEnabled()) {
- log.debug("preloading transient state from cache loader was successful (in " + total + " milliseconds)");
- }
}
}
/**
- * Preloads a specific Fqn into the cache from the configured cacheloader
- *
- * @param fqn fqn to preload
- * @param preloadParents whether we preload parents
- * @param preloadChildren whether we preload children
- * @throws CacheException if we are unable to preload
- */
- public void preload(String key) throws CacheException {
-
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- // 1. Load the attributes first
- // but this will go down the entire damn chain!! :S
- cache.get(key);
- }
-
- /**
* Returns the configuration element of the cache loaders
*/
public CacheLoaderConfig getCacheLoaderConfig() {
Modified: core/branches/flat/src/main/java/org/horizon/loader/SingletonStoreDefaultConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/loader/SingletonStoreDefaultConfig.java 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/java/org/horizon/loader/SingletonStoreDefaultConfig.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -73,7 +73,7 @@
*/
public SingletonStoreDefaultConfig(SingletonStoreConfig base) {
this();
- setSingletonStoreproperties(base.getSingletonStoreproperties());
+ setSingletonStoreProperties(base.getSingletonStoreProperties());
}
@Override
@@ -103,8 +103,8 @@
* @param props is an instance of Properties containing these values.
*/
@Override
- public void setSingletonStoreproperties(Properties props) {
- super.setSingletonStoreproperties(props);
+ public void setSingletonStoreProperties(Properties props) {
+ super.setSingletonStoreProperties(props);
String pushStateWhenCoordinatorStr = props.getProperty("pushStateWhenCoordinator");
if (pushStateWhenCoordinatorStr != null) {
/* if not null, we use the defined value, otherwise we leave it to the default value, true */
Modified: core/branches/flat/src/main/resources/config-samples/all.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/all.xml 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/resources/config-samples/all.xml 2009-01-27 01:51:15 UTC (rev 7598)
@@ -10,21 +10,21 @@
<!-- Note that if these are left blank, defaults are used. See the user guide for what these defaults are -->
<asyncListenerExecutor factory="org.horizon.executors.DefaultExecutorFactory">
- <property name="maxThreads">5</property>
- <property name="threadNamePrefix">AsyncListenerThread</property>
+ <property name="maxThreads" value="5"/>
+ <property name="threadNamePrefix" value="AsyncListenerThread"/>
</asyncListenerExecutor>
<asyncSerializationExecutor factory="org.horizon.executors.DefaultExecutorFactory">
- <property name="maxThreads">25</property>
- <property name="threadNamePrefix">AsyncSerializationThread</property>
+ <property name="maxThreads" value="25"/>
+ <property name="threadNamePrefix" value="AsyncSerializationThread"/>
</asyncSerializationExecutor>
<evictionScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix">EvictionThread</property>
+ <property name="threadNamePrefix" value="EvictionThread"/>
</evictionScheduledExecutor>
<replicationQueueScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix">ReplicationQueueThread</property>
+ <property name="threadNamePrefix" value="ReplicationQueueThread"/>
</replicationQueueScheduledExecutor>
@@ -33,14 +33,14 @@
There is no added cost to defining a transport but not creating a cache that uses one, since the transport
is created and initialized lazily.
-->
- <transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport">
+ <transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport" clusterName="horizon-cluster">
<!-- Note that the JGroups transport uses sensible defaults if no configuration property is defined. -->
- <property name="configurationFile">udp.xml</property>
+ <property name="configurationFile" value="udp.xml"/>
<!-- See the JGroupsTransport javadocs for more options -->
</transport>
<!-- Again, sensible defaults are used here if this is omitted. -->
- <serialization marshallerClass="org.horizon.marshall.HorizonMarshaller" version="1.0"
+ <serialization marshallerClass="org.horizon.marshall.VersionAwareMarshaller" version="1.0"
objectInputStreamPoolSize="100" objectOutputStreamPoolSize="100"/>
<!--
@@ -86,7 +86,7 @@
This element specifies that the cache is clustered.
modes supported: replication (r) or invalidation (i).
-->
- <clustering mode="replication" clusterName="JBossCache-cluster">
+ <clustering mode="replication">
<!--
Defines whether to retrieve state on startup
Modified: core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd
===================================================================
--- core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd 2009-01-27 01:51:15 UTC (rev 7598)
@@ -70,7 +70,6 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
- <xs:attribute name="clusterName" type="xs:string"/>
</xs:complexType>
<xs:complexType name="lockingType">
@@ -138,6 +137,7 @@
<xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="tns:propertyType"/>
</xs:sequence>
<xs:attribute name="transportClass" type="xs:string"/>
+ <xs:attribute name="clusterName" type="xs:string"/>
</xs:complexType>
<xs:complexType name="syncType">
@@ -216,12 +216,8 @@
</xs:complexType>
<xs:complexType name="propertyType">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="value" type="xs:string"/>
- </xs:extension>
- </xs:simpleContent>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="value" type="xs:string"/>
</xs:complexType>
</xs:schema>
Added: core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java (rev 0)
+++ core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -0,0 +1,239 @@
+package org.horizon.config.parsing;
+
+import org.horizon.config.CacheLoaderConfig;
+import org.horizon.config.Configuration;
+import org.horizon.lock.IsolationLevel;
+import org.horizon.transaction.GenericTransactionManagerLookup;
+import org.testng.annotations.Test;
+import org.w3c.dom.Element;
+
+@Test(groups = "unit")
+public class ConfigurationParserTest {
+
+ public void testLocking() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<locking\n" +
+ " isolationLevel=\"REPEATABLE_READ\"\n" +
+ " lockAcquisitionTimeout=\"200000\"\n" +
+ " writeSkewCheck=\"true\"\n" +
+ " concurrencyLevel=\"5\"/>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureLocking(e, c);
+
+ assert c.getIsolationLevel() == IsolationLevel.REPEATABLE_READ;
+ assert c.getLockAcquisitionTimeout() == 200000;
+ assert c.isWriteSkewCheck();
+ assert c.getConcurrencyLevel() == 5;
+ }
+
+ public void testTransactions() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<transaction\n" +
+ " transactionManagerLookupClass=\"org.blah.Blah\"\n" +
+ " syncRollbackPhase=\"true\"\n" +
+ " syncCommitPhase=\"true\"/>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureTransaction(e, c);
+
+ assert c.getTransactionManagerLookupClass().equals("org.blah.Blah");
+ assert c.isSyncCommitPhase();
+ assert c.isSyncRollbackPhase();
+ }
+
+ public void testTransactionsDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<transaction />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureTransaction(e, c);
+
+ assert c.getTransactionManagerLookupClass().equals(GenericTransactionManagerLookup.class.getName());
+ assert !c.isSyncCommitPhase();
+ assert !c.isSyncRollbackPhase();
+ }
+
+ public void testJmxStatistics() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<jmxStatistics enabled=\"true\"/>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureJmxStatistics(e, c);
+
+ assert c.isExposeManagementStatistics();
+ }
+
+ public void testJmxStatisticsDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<jmxStatistics />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureJmxStatistics(e, c);
+
+ assert c.isExposeManagementStatistics();
+ }
+
+ public void testInvocationBatching() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<invocationBatching enabled=\"true\"/>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureInvocationBatching(e, c);
+
+ assert c.isInvocationBatchingEnabled();
+ }
+
+ public void testInvocationBatchingDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<invocationBatching />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureInvocationBatching(e, c);
+
+ assert c.isInvocationBatchingEnabled();
+ }
+
+ public void testClustering() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<clustering mode=\"invalidation\">\n" +
+ " <stateRetrieval timeout=\"20000\" fetchInMemoryState=\"false\"/>\n" +
+ " <async useReplQueue=\"true\" replQueueInterval=\"10000\" replQueueMaxElements=\"500\"/>\n" +
+ " </clustering>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureClustering(e, c);
+
+ assert c.getCacheMode() == Configuration.CacheMode.INVALIDATION_ASYNC;
+ assert c.getStateRetrievalTimeout() == 20000;
+ assert !c.isFetchInMemoryState();
+ assert c.isUseReplQueue();
+ assert c.getReplQueueInterval() == 10000;
+ assert c.getReplQueueMaxElements() == 500;
+ }
+
+ public void testClusteringDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<clustering />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureClustering(e, c);
+
+ assert c.getCacheMode() == Configuration.CacheMode.REPL_SYNC;
+ assert c.getStateRetrievalTimeout() == 10000;
+ assert c.isFetchInMemoryState();
+ assert !c.isUseReplQueue();
+ }
+
+ /*
+
+ <loaders passivation="true" shared="true" preload="true">
+ <loader class="org.horizon.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
+ ignoreModifications="false" purgeOnStartup="false">
+ <properties>
+ horizon.jdbc.datasource=HorizonDS
+ horizon.jdbc.table.name=horizon
+ horizon.jdbc.table.create=true
+ horizon.jdbc.table.drop=false
+ </properties>
+ <singletonStore enabled="true" class="org.horizon.loader.SingletonStoreCacheLoader">
+ <properties>
+ horizon.singletonStore.pushStateWhenCoordinator=true
+ horizon.singletonStore.pushStateWhenCoordinatorTimeout=20000
+ </properties>
+ </singletonStore>
+ </loader>
+ </loaders>
+
+ */
+
+ public void testCacheLoaders() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<loaders passivation=\"true\" shared=\"true\" preload=\"true\">\n" +
+ " <loader class=\"org.horizon.loader.JDBCCacheLoader\" async=\"true\" fetchPersistentState=\"true\"\n" +
+ " ignoreModifications=\"false\" purgeOnStartup=\"false\">\n" +
+ " <properties>\n" +
+ " horizon.jdbc.datasource=HorizonDS\n" +
+ " horizon.jdbc.table.name=horizon\n" +
+ " horizon.jdbc.table.create=true\n" +
+ " horizon.jdbc.table.drop=false\n" +
+ " </properties>\n" +
+ " <singletonStore enabled=\"true\" class=\"com.blah.Blah\">\n" +
+ " <properties>\n" +
+ " horizon.singletonStore.pushStateWhenCoordinator=true\n" +
+ " horizon.singletonStore.pushStateWhenCoordinatorTimeout=20000\n" +
+ " </properties>\n" +
+ " </singletonStore>\n" +
+ " </loader>\n" +
+ " </loaders>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureCacheLoaders(e, c);
+
+ CacheLoaderConfig clc = c.getCacheLoaderConfig();
+ assert clc != null;
+ assert clc.isFetchPersistentState();
+ assert clc.isPassivation();
+ assert clc.isShared();
+ assert clc.isPreload();
+
+ CacheLoaderConfig.IndividualCacheLoaderConfig iclc = clc.getFirstCacheLoaderConfig();
+ assert iclc.getClassName().equals("org.horizon.loader.JDBCCacheLoader");
+ assert iclc.isAsync();
+ assert iclc.isFetchPersistentState();
+ assert !iclc.isIgnoreModifications();
+ assert !iclc.isPurgeOnStartup();
+
+ CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig ssc = iclc.getSingletonStoreConfig();
+ assert ssc.isSingletonStoreEnabled();
+ assert ssc.getClassName().equals("com.blah.Blah");
+ assert ssc.getSingletonStoreProperties().size() == 2;
+ }
+
+ public void testCacheLoadersDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<loaders>\n" +
+ " <loader class=\"org.horizon.loader.JDBCCacheLoader\">\n" +
+ " <properties />\n" +
+ " <singletonStore enabled=\"true\" />\n" +
+ " </loader>\n" +
+ " </loaders>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ Configuration c = new Configuration();
+ parser.configureCacheLoaders(e, c);
+
+ CacheLoaderConfig clc = c.getCacheLoaderConfig();
+ assert clc != null;
+ assert !clc.isFetchPersistentState();
+ assert !clc.isPassivation();
+ assert !clc.isShared();
+ assert !clc.isPreload();
+
+ CacheLoaderConfig.IndividualCacheLoaderConfig iclc = clc.getFirstCacheLoaderConfig();
+ assert iclc.getClassName().equals("org.horizon.loader.JDBCCacheLoader");
+ assert !iclc.isAsync();
+ assert !iclc.isFetchPersistentState();
+ assert !iclc.isIgnoreModifications();
+ assert !iclc.isPurgeOnStartup();
+
+ CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig ssc = iclc.getSingletonStoreConfig();
+ assert ssc.isSingletonStoreEnabled();
+ assert ssc.getClassName().equals("org.horizon.loader.SingletonStoreCacheLoader");
+ assert ssc.getSingletonStoreProperties().isEmpty();
+ }
+
+ public void testEviction() throws Exception {
+ assert false : "Implement me once the eviction config beans have been fixed!";
+ }
+}
Copied: core/branches/flat/src/test/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java (from rev 7597, core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java)
===================================================================
--- core/branches/flat/src/test/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java (rev 0)
+++ core/branches/flat/src/test/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -0,0 +1,200 @@
+package org.horizon.config.parsing;
+
+import org.horizon.config.GlobalConfiguration;
+import org.horizon.executors.DefaultExecutorFactory;
+import org.horizon.executors.DefaultScheduledExecutorFactory;
+import org.horizon.marshall.HorizonMarshaller;
+import org.horizon.marshall.VersionAwareMarshaller;
+import org.horizon.remoting.transport.jgroups.JGroupsTransport;
+import org.testng.annotations.Test;
+import org.w3c.dom.Element;
+
+
+@Test(groups = "unit")
+public class GlobalConfigurationParserTest {
+
+ public void testTransport() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String transportClass = "org.blah.Blah";
+ String xml = "<transport transportClass=\"" + transportClass + "\"><property name=\"something\" value=\"value\"/></transport>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureTransport(e, gc);
+
+ assert gc.getTransportClass().equals(transportClass);
+ assert gc.getTransportProperties().size() == 1;
+ assert gc.getTransportProperties().getProperty("something").equals("value");
+ }
+
+ public void testDefaultTransport() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<transport />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureTransport(e, gc);
+
+ assert gc.getTransportClass().equals(JGroupsTransport.class.getName());
+ assert gc.getTransportProperties().size() == 0;
+ }
+
+ public void testShutdown() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<shutdown hookBehavior=\"REGISTER\" />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureShutdown(e, gc);
+
+ assert gc.getShutdownHookBehavior() == GlobalConfiguration.ShutdownHookBehavior.REGISTER;
+ }
+
+ public void testDefaultShutdown() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<shutdown />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureShutdown(e, gc);
+
+ assert gc.getShutdownHookBehavior() == GlobalConfiguration.ShutdownHookBehavior.DEFAULT;
+ }
+
+ public void testMarshalling() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<serialization marshallerClass=\"org.horizon.marshall.HorizonMarshaller\" version=\"9.2\"\n" +
+ " objectInputStreamPoolSize=\"100\" objectOutputStreamPoolSize=\"100\"/>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureSerialization(e, gc);
+
+ assert gc.getMarshallerClass().equals(HorizonMarshaller.class.getName());
+ assert gc.getMarshallVersionString().equals("9.2");
+ assert gc.getObjectInputStreamPoolSize() == 100;
+ assert gc.getObjectOutputStreamPoolSize() == 100;
+ }
+
+ public void testMarshallingDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<serialization />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureSerialization(e, gc);
+
+ assert gc.getMarshallerClass().equals(VersionAwareMarshaller.class.getName());
+ assert gc.getMarshallVersionString().equals("1.0");
+ assert gc.getObjectInputStreamPoolSize() == 50;
+ assert gc.getObjectOutputStreamPoolSize() == 50;
+ }
+
+ public void testAsyncListenerExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncListenerExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </asyncListenerExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncListenerExecutor(e, gc);
+
+ assert gc.getAsyncListenerExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getAsyncListenerExecutorProperties().size() == 1;
+ assert gc.getAsyncListenerExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testAsyncSerializationExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncSerializationExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </asyncSerializationExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncSerializationExecutor(e, gc);
+
+ assert gc.getAsyncSerializationExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getAsyncSerializationExecutorProperties().size() == 1;
+ assert gc.getAsyncSerializationExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testEvictionScheduledExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<evictionScheduledExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </evictionScheduledExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureEvictionScheduledExecutor(e, gc);
+
+ assert gc.getEvictionScheduledExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getEvictionScheduledExecutorProperties().size() == 1;
+ assert gc.getEvictionScheduledExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testReplicationQueueScheduledExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<replicationQueueScheduledExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </replicationQueueScheduledExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureReplicationQueueScheduledExecutor(e, gc);
+
+ assert gc.getReplicationQueueScheduledExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getReplicationQueueScheduledExecutorProperties().size() == 1;
+ assert gc.getReplicationQueueScheduledExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testAsyncListenerExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncListenerExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncListenerExecutor(e, gc);
+
+ assert gc.getAsyncListenerExecutorFactoryClass().equals(DefaultExecutorFactory.class.getName());
+ assert gc.getAsyncListenerExecutorProperties().size() == 0;
+ }
+
+ public void testAsyncSerializationExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncSerializationExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncSerializationExecutor(e, gc);
+
+ assert gc.getAsyncSerializationExecutorFactoryClass().equals(DefaultExecutorFactory.class.getName());
+ assert gc.getAsyncSerializationExecutorProperties().size() == 0;
+ }
+
+ public void testEvictionScheduledExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<evictionScheduledExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureEvictionScheduledExecutor(e, gc);
+
+ assert gc.getEvictionScheduledExecutorFactoryClass().equals(DefaultScheduledExecutorFactory.class.getName());
+ assert gc.getEvictionScheduledExecutorProperties().size() == 0;
+ }
+
+ public void testReplicationQueueScheduledExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<replicationQueueScheduledExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureReplicationQueueScheduledExecutor(e, gc);
+
+ assert gc.getReplicationQueueScheduledExecutorFactoryClass().equals(DefaultScheduledExecutorFactory.class.getName());
+ assert gc.getReplicationQueueScheduledExecutorProperties().size() == 0;
+ }
+}
Added: core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java (rev 0)
+++ core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java 2009-01-27 01:51:15 UTC (rev 7598)
@@ -0,0 +1,83 @@
+package org.horizon.config.parsing;
+
+import org.horizon.config.Configuration;
+import org.horizon.config.GlobalConfiguration;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.Map;
+
+@Test(groups = "unit")
+public class XmlFileParsingTest {
+ public void testNamedCacheFile() throws IOException {
+ XmlConfigurationParser parser = new XmlConfigurationParserImpl("configs/named-cache-test.xml");
+
+ GlobalConfiguration gc = parser.parseGlobalConfiguration();
+
+ assert gc.getAsyncListenerExecutorFactoryClass().equals("org.horizon.executors.DefaultExecutorFactory");
+ assert gc.getAsyncListenerExecutorProperties().getProperty("maxThreads").equals("5");
+ assert gc.getAsyncListenerExecutorProperties().getProperty("threadNamePrefix").equals("AsyncListenerThread");
+
+ assert gc.getAsyncSerializationExecutorFactoryClass().equals("org.horizon.executors.DefaultExecutorFactory");
+ assert gc.getAsyncSerializationExecutorProperties().getProperty("maxThreads").equals("25");
+ assert gc.getAsyncSerializationExecutorProperties().getProperty("threadNamePrefix").equals("AsyncSerializationThread");
+
+ assert gc.getEvictionScheduledExecutorFactoryClass().equals("org.horizon.executors.DefaultScheduledExecutorFactory");
+ assert gc.getEvictionScheduledExecutorProperties().getProperty("threadNamePrefix").equals("EvictionThread");
+
+ assert gc.getReplicationQueueScheduledExecutorFactoryClass().equals("org.horizon.executors.DefaultScheduledExecutorFactory");
+ assert gc.getReplicationQueueScheduledExecutorProperties().getProperty("threadNamePrefix").equals("ReplicationQueueThread");
+
+ assert gc.getTransportClass().equals("org.horizon.remoting.transport.jgroups.JGroupsTransport");
+ assert gc.getTransportProperties().isEmpty();
+
+ assert gc.getMarshallerClass().equals("org.horizon.marshall.VersionAwareMarshaller");
+ assert gc.getMarshallVersionString().equals("1.0");
+ assert gc.getObjectOutputStreamPoolSize() == 100;
+ assert gc.getObjectInputStreamPoolSize() == 100;
+
+ Configuration defaultConfiguration = parser.parseDefaultConfiguration();
+
+ assert defaultConfiguration.getLockAcquisitionTimeout() == 1000;
+ assert defaultConfiguration.getConcurrencyLevel() == 100;
+
+ Map<String, Configuration> namedCaches = parser.parseNamedConfigurations();
+
+ Configuration c = namedCaches.get("transactional");
+
+ assert c.getTransactionManagerLookupClass().equals("org.horizon.transaction.GenericTransactionManagerLookup");
+
+ c = namedCaches.get("syncRepl");
+
+ assert c.getCacheMode() == Configuration.CacheMode.REPL_SYNC;
+ assert c.isFetchInMemoryState();
+ assert c.getStateRetrievalTimeout() == 15000;
+ assert c.getSyncReplTimeout() == 15000;
+
+ c = namedCaches.get("asyncRepl");
+
+ assert c.getCacheMode() == Configuration.CacheMode.REPL_ASYNC;
+ assert !c.isUseReplQueue();
+ assert !c.isUseAsyncSerialization();
+ assert c.isFetchInMemoryState();
+ assert c.getStateRetrievalTimeout() == 15000;
+
+ c = namedCaches.get("asyncReplQueue");
+
+ assert c.getCacheMode() == Configuration.CacheMode.REPL_ASYNC;
+ assert c.isUseReplQueue();
+ assert c.isUseAsyncSerialization();
+ assert c.isFetchInMemoryState();
+ assert c.getStateRetrievalTimeout() == 15000;
+
+ c = namedCaches.get("txSyncRepl");
+
+ assert c.getTransactionManagerLookupClass().equals("org.horizon.transaction.GenericTransactionManagerLookup");
+ assert c.getCacheMode() == Configuration.CacheMode.REPL_SYNC;
+ assert c.isFetchInMemoryState();
+ assert c.getStateRetrievalTimeout() == 15000;
+ assert c.getSyncReplTimeout() == 15000;
+
+
+ }
+}
Modified: core/branches/flat/src/test/resources/configs/named-cache-test.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-01-27 01:51:15 UTC (rev 7598)
@@ -4,26 +4,26 @@
<global>
<asyncListenerExecutor factory="org.horizon.executors.DefaultExecutorFactory">
- <property name="maxThreads">5</property>
- <property name="threadNamePrefix">AsyncListenerThread</property>
+ <property name="maxThreads" value="5"/>
+ <property name="threadNamePrefix" value="AsyncListenerThread"/>
</asyncListenerExecutor>
<asyncSerializationExecutor factory="org.horizon.executors.DefaultExecutorFactory">
- <property name="maxThreads">25</property>
- <property name="threadNamePrefix">AsyncSerializationThread</property>
+ <property name="maxThreads" value="25"/>
+ <property name="threadNamePrefix" value="AsyncSerializationThread"/>
</asyncSerializationExecutor>
<evictionScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix">EvictionThread</property>
+ <property name="threadNamePrefix" value="EvictionThread"/>
</evictionScheduledExecutor>
<replicationQueueScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix">ReplicationQueueThread</property>
+ <property name="threadNamePrefix" value="ReplicationQueueThread"/>
</replicationQueueScheduledExecutor>
<transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport"/>
- <serialization marshallerClass="org.horizon.marshall.HorizonMarshaller" version="1.0"
+ <serialization marshallerClass="org.horizon.marshall.VersionAwareMarshaller" version="1.0"
objectInputStreamPoolSize="100" objectOutputStreamPoolSize="100"/>
</global>
@@ -58,7 +58,7 @@
</namedCache>
<namedCache name="txSyncRepl">
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
+ <transaction/>
<clustering>
<stateRetrieval fetchInMemoryState="true" timeout="15000"/>
<sync replTimeout="15000"/>
Modified: core/branches/flat/src/test/resources/configs/string-property-replaced.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/string-property-replaced.xml 2009-01-26 16:56:02 UTC (rev 7597)
+++ core/branches/flat/src/test/resources/configs/string-property-replaced.xml 2009-01-27 01:51:15 UTC (rev 7598)
@@ -9,12 +9,12 @@
<global>
<asyncListenerExecutor factory="org.horizon.executors.DefaultExecutorFactory">
- <property name="maxThreads">${test.property.asyncListenerMaxThreads:5}</property>
- <property name="threadNamePrefix">AsyncListenerThread</property>
+ <property name="maxThreads" value="${test.property.asyncListenerMaxThreads:5}"/>
+ <property name="threadNamePrefix" value="AsyncListenerThread"/>
</asyncListenerExecutor>
<transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport">
- <property name="configurationFile">${test.property.jgroupsConfigFile:udp.xml}</property>
+ <property name="configurationFile" value="${test.property.jgroupsConfigFile:udp.xml}"/>
</transport>
</global>
@@ -34,7 +34,7 @@
syncRollbackPhase="false"
syncCommitPhase="${test.property.SyncCommitPhase:true}"/>
- <clustering clusterName="BlahBlah">
+ <clustering mode="R">
<sync/>
</clustering>
</default>
15 years, 11 months
JBoss Cache SVN: r7597 - in core/branches/flat/src: main/java/org/horizon/config and 9 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-26 11:56:02 -0500 (Mon, 26 Jan 2009)
New Revision: 7597
Added:
core/branches/flat/src/main/java/org/horizon/config/DuplicateCacheNameException.java
core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java
core/branches/flat/src/main/java/org/horizon/marshall/HorizonMarshaller.java
core/branches/flat/src/test/java/org/horizon/config/
core/branches/flat/src/test/java/org/horizon/config/parser/
Removed:
core/branches/flat/src/main/java/org/horizon/config/XmlParsingConfigurationRegistry.java
core/branches/flat/src/main/java/org/horizon/config/parsing/CacheConfigsXmlParser.java
core/branches/flat/src/main/java/org/horizon/config/parsing/ConfigFilesConvertor.java
core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserJBC3.java
core/branches/flat/src/main/java/org/horizon/manager/CacheNameExistsException.java
core/branches/flat/src/main/java/org/horizon/marshall/CacheMarshallerStarobrno.java
Modified:
core/branches/flat/src/main/java/org/horizon/Version.java
core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java
core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java
core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigHelper.java
core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParser.java
core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java
core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java
core/branches/flat/src/main/java/org/horizon/manager/CacheManager.java
core/branches/flat/src/main/java/org/horizon/manager/DefaultCacheManager.java
core/branches/flat/src/main/java/org/horizon/marshall/VersionAwareMarshaller.java
core/branches/flat/src/main/resources/config-samples/all.xml
core/branches/flat/src/test/java/org/horizon/UnitTestCacheFactory.java
core/branches/flat/src/test/java/org/horizon/manager/CacheManagerComponentRegistryTest.java
core/branches/flat/src/test/java/org/horizon/manager/CacheManagerTest.java
core/branches/flat/src/test/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java
core/branches/flat/src/test/java/org/horizon/util/internals/ReplicationListener.java
core/branches/flat/src/test/resources/configs/named-cache-test.xml
Log:
Started work on parser
Modified: core/branches/flat/src/main/java/org/horizon/Version.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/Version.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/Version.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -49,8 +49,7 @@
System.out.println();
System.out.println("\nVersion: \t" + version);
System.out.println("Codename: \t" + codename);
- //System.out.println("CVS: \t" + cvs);
- System.out.println("History: \t(see http://jira.jboss.com/jira/browse/JBCACHE for details)\n");
+ System.out.println("History: \t(see http://jira.jboss.org for details)\n");
}
/**
@@ -104,13 +103,7 @@
if (versionString == null)
throw new IllegalArgumentException("versionString is null");
- // Special cases for version prior to 1.2.4.SP2
- if ("1.2.4".equals(versionString))
- return 124;
- else if ("1.2.4.SP1".equals(versionString))
- return 1241;
-
- String parts[] = versionString.split("[\\.\\-]");
+ String parts[] = getParts(versionString);
int a = 0;
int b = 0;
int c = 0;
@@ -135,4 +128,13 @@
int patch = (version & PATCH_MASK);
return major + "." + minor + "." + patch;
}
+
+ private static String[] getParts(String versionString) {
+ return versionString.split("[\\.\\-]");
+ }
+
+ public static String getMajorVersion() {
+ String[] parts = getParts(version);
+ return parts[0] + "." + parts[1];
+ }
}
Added: core/branches/flat/src/main/java/org/horizon/config/DuplicateCacheNameException.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/DuplicateCacheNameException.java (rev 0)
+++ core/branches/flat/src/main/java/org/horizon/config/DuplicateCacheNameException.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -0,0 +1,25 @@
+package org.horizon.config;
+
+/**
+ * Thrown if a duplicate named cache is detected
+ *
+ * @author Manik Surtani
+ * @since 1.0
+ */
+public class DuplicateCacheNameException extends ConfigurationException {
+ public DuplicateCacheNameException(Exception e) {
+ super(e);
+ }
+
+ public DuplicateCacheNameException(String string) {
+ super(string);
+ }
+
+ public DuplicateCacheNameException(String string, String erroneousAttribute) {
+ super(string, erroneousAttribute);
+ }
+
+ public DuplicateCacheNameException(String string, Throwable throwable) {
+ super(string, throwable);
+ }
+}
Modified: core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -10,6 +10,7 @@
import org.horizon.factories.annotations.NonVolatile;
import org.horizon.factories.scopes.Scope;
import org.horizon.factories.scopes.Scopes;
+import org.horizon.marshall.VersionAwareMarshaller;
import org.horizon.remoting.transport.jgroups.JGroupsTransport;
import org.horizon.util.TypedProperties;
@@ -28,26 +29,26 @@
/**
* Default replication version, from {@link org.horizon.Version#getVersionShort}.
*/
- public static final short DEFAULT_REPLICATION_VERSION = Version.getVersionShort();
+ public static final short DEFAULT_MARSHALL_VERSION = Version.getVersionShort();
+ private static final TypedProperties EMPTY_PROPERTIES = new TypedProperties();
String asyncListenerExecutorFactoryClass = DefaultExecutorFactory.class.getName();
- TypedProperties asyncListenerExecutorProperties;
+ TypedProperties asyncListenerExecutorProperties = EMPTY_PROPERTIES;
String asyncSerializationExecutorFactoryClass = DefaultExecutorFactory.class.getName();
- TypedProperties asyncSerializationExecutorProperties;
+ TypedProperties asyncSerializationExecutorProperties = EMPTY_PROPERTIES;
String evictionScheduledExecutorFactoryClass = DefaultScheduledExecutorFactory.class.getName();
- TypedProperties evictionScheduledExecutorProperties;
+ TypedProperties evictionScheduledExecutorProperties = EMPTY_PROPERTIES;
String replicationQueueScheduledExecutorFactoryClass = DefaultScheduledExecutorFactory.class.getName();
- TypedProperties replicationQueueScheduledExecutorProperties;
- String marshallerClass;
- String marshallVersion;
- int objectInputStreamPoolSize;
- int objectOutputStreamPoolSize;
+ TypedProperties replicationQueueScheduledExecutorProperties = EMPTY_PROPERTIES;
+ String marshallerClass = VersionAwareMarshaller.class.getName(); // the default
+ int objectInputStreamPoolSize = 50; // defaults
+ int objectOutputStreamPoolSize = 50; // defaults
String transportClass = null; // this defaults to a non-clustered cache.
- TypedProperties transportProperties;
+ TypedProperties transportProperties = EMPTY_PROPERTIES;
Configuration defaultConfiguration;
String clusterName = "Horizon-Cluster";
ShutdownHookBehavior shutdownHookBehavior = ShutdownHookBehavior.DEFAULT;
- short replicationVersion = DEFAULT_REPLICATION_VERSION;
+ short marshallVersion = DEFAULT_MARSHALL_VERSION;
private GlobalComponentRegistry gcr;
@@ -123,15 +124,6 @@
this.marshallerClass = marshallerClass;
}
- public String getMarshallVersion() {
- return marshallVersion;
- }
-
- public void setMarshallVersion(String marshallVersion) {
- testImmutability("marshallVersion");
- this.marshallVersion = marshallVersion;
- }
-
public int getObjectInputStreamPoolSize() {
return objectInputStreamPoolSize;
}
@@ -267,22 +259,26 @@
this.replicationQueueScheduledExecutorProperties = toTypedProperties(replicationQueueScheduledExecutorPropertiesString);
}
- public short getReplicationVersion() {
- return replicationVersion;
+ public short getMarshallVersion() {
+ return marshallVersion;
}
+ public String getMarshallVersionString() {
+ return Version.decodeVersion(marshallVersion);
+ }
+
public String getReplicationVersionString() {
- return Version.decodeVersion(replicationVersion);
+ return Version.decodeVersion(marshallVersion);
}
- public void setReplicationVersion(short replicationVersion) {
- testImmutability("replicationVersion");
- this.replicationVersion = replicationVersion;
+ public void setMarshallVersion(short marshallVersion) {
+ testImmutability("marshallVersion");
+ this.marshallVersion = marshallVersion;
}
- public void setReplicationVersionString(String replicationVersionString) {
- testImmutability("replicationVersion");
- this.replicationVersion = Version.getVersionShort(replicationVersionString);
+ public void setMarshallVersion(String marshallVersion) {
+ testImmutability("marshallVersion");
+ this.marshallVersion = Version.getVersionShort(marshallVersion);
}
@Override
@@ -294,7 +290,7 @@
if (objectInputStreamPoolSize != that.objectInputStreamPoolSize) return false;
if (objectOutputStreamPoolSize != that.objectOutputStreamPoolSize) return false;
- if (replicationVersion != that.replicationVersion) return false;
+ if (marshallVersion != that.marshallVersion) return false;
if (asyncListenerExecutorFactoryClass != null ? !asyncListenerExecutorFactoryClass.equals(that.asyncListenerExecutorFactoryClass) : that.asyncListenerExecutorFactoryClass != null)
return false;
if (asyncListenerExecutorProperties != null ? !asyncListenerExecutorProperties.equals(that.asyncListenerExecutorProperties) : that.asyncListenerExecutorProperties != null)
@@ -310,8 +306,6 @@
return false;
if (evictionScheduledExecutorProperties != null ? !evictionScheduledExecutorProperties.equals(that.evictionScheduledExecutorProperties) : that.evictionScheduledExecutorProperties != null)
return false;
- if (marshallVersion != null ? !marshallVersion.equals(that.marshallVersion) : that.marshallVersion != null)
- return false;
if (marshallerClass != null ? !marshallerClass.equals(that.marshallerClass) : that.marshallerClass != null)
return false;
if (replicationQueueScheduledExecutorFactoryClass != null ? !replicationQueueScheduledExecutorFactoryClass.equals(that.replicationQueueScheduledExecutorFactoryClass) : that.replicationQueueScheduledExecutorFactoryClass != null)
@@ -338,7 +332,6 @@
result = 31 * result + (replicationQueueScheduledExecutorFactoryClass != null ? replicationQueueScheduledExecutorFactoryClass.hashCode() : 0);
result = 31 * result + (replicationQueueScheduledExecutorProperties != null ? replicationQueueScheduledExecutorProperties.hashCode() : 0);
result = 31 * result + (marshallerClass != null ? marshallerClass.hashCode() : 0);
- result = 31 * result + (marshallVersion != null ? marshallVersion.hashCode() : 0);
result = 31 * result + objectInputStreamPoolSize;
result = 31 * result + objectOutputStreamPoolSize;
result = 31 * result + (transportClass != null ? transportClass.hashCode() : 0);
@@ -346,7 +339,7 @@
result = 31 * result + (defaultConfiguration != null ? defaultConfiguration.hashCode() : 0);
result = 31 * result + (clusterName != null ? clusterName.hashCode() : 0);
result = 31 * result + (shutdownHookBehavior != null ? shutdownHookBehavior.hashCode() : 0);
- result = 31 * result + (int) replicationVersion;
+ result = 31 * result + (int) marshallVersion;
return result;
}
Deleted: core/branches/flat/src/main/java/org/horizon/config/XmlParsingConfigurationRegistry.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/XmlParsingConfigurationRegistry.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/XmlParsingConfigurationRegistry.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.horizon.config;
-
-import org.horizon.config.parsing.CacheConfigsXmlParser;
-
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * {@link ConfigurationRegistry} that obtains its initial set of configurations by parsing an XML document.
- *
- * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
- * @since 1.0
- */
-public class XmlParsingConfigurationRegistry implements ConfigurationRegistry {
- private final CacheConfigsXmlParser parser;
- private final String configResource;
- private final Map<String, Configuration> configs = new Hashtable<String, Configuration>();
- private boolean started;
-
- public XmlParsingConfigurationRegistry(String configResource) {
- parser = new CacheConfigsXmlParser();
- this.configResource = configResource;
- }
-
- public void start() throws Exception {
- if (!started) {
- if (configResource != null)
- configs.putAll(parser.parseConfigs(configResource));
- started = true;
- }
- }
-
- public void stop() {
- if (started) {
- synchronized (configs) {
- configs.clear();
- }
- started = false;
- }
- }
-
- public String getConfigResource() {
- return configResource;
- }
-
- public Set<String> getConfigurationNames() {
- return new HashSet<String>(configs.keySet());
- }
-
- public void registerConfiguration(String configName, Configuration config)
- throws CloneNotSupportedException {
- synchronized (configs) {
- if (configs.containsKey(configName))
- throw new IllegalStateException(configName + " already registered");
- configs.put(configName, config.clone());
- }
- }
-
- public void unregisterConfiguration(String configName) {
- synchronized (configs) {
- if (configs.remove(configName) == null)
- throw new IllegalStateException(configName + " not registered");
- }
- }
-
- public Configuration getConfiguration(String configName) {
- Configuration config;
- synchronized (configs) {
- config = configs.get(configName);
- }
-
- if (config == null)
- throw new IllegalArgumentException("unknown config " + configName);
-
- // Don't hand out a ref to our master copy
- return config.clone();
- }
-}
Deleted: core/branches/flat/src/main/java/org/horizon/config/parsing/CacheConfigsXmlParser.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/CacheConfigsXmlParser.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/CacheConfigsXmlParser.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.horizon.config.parsing;
-
-import org.horizon.config.Configuration;
-import org.horizon.config.ConfigurationException;
-import org.horizon.logging.Log;
-import org.horizon.logging.LogFactory;
-import org.horizon.util.FileLookup;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Parser able to parse a series of cache configurations stored in an XML document with the following structure:
- * <pre>
- * <cache-configs>
- * <cache-config name="configA">
- * ....
- * </cache-config>
- * <cache-config name="configB">
- * ....
- * </cache-config>
- * </cache-configs>
- * </pre>
- * <p/>
- * The '....' represents the normal content of the mbean element in a JBC -service.xml config file.
- *
- * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
- * @since 1.0
- */
-public class CacheConfigsXmlParser {
- /**
- * Name of the root element in a cache configs XML document
- */
- public static final String DOCUMENT_ROOT = "cache-configs";
- /**
- * Name of the element that represents an individual cache configuration in a cache configs XML document.
- */
- public static final String CONFIG_ROOT = "cache-config";
- public static final String QUALIFIED_CONFIG_ROOT = "registry:cache-config";
-
- /**
- * Name of the attribute in a {@link #CONFIG_ROOT cache-config} element that specifies the name of the
- * configuration.
- */
- public static final String CONFIG_NAME = "name";
-
- private static final Log log = LogFactory.getLog(CacheConfigsXmlParser.class);
-
-
- public Map<String, Configuration> parseConfigs(String fileName) throws CloneNotSupportedException {
- FileLookup fileLookup = new FileLookup();
- InputStream is = fileLookup.lookupFile(fileName);
- if (is == null) {
- throw new ConfigurationException("Unable to find config file " + fileName + " either in classpath or on the filesystem!");
- }
-
- return parseConfigs(is);
- }
-
- public Map<String, Configuration> parseConfigs(InputStream stream) throws CloneNotSupportedException {
- // loop through all elements in XML.
- Element root = getDocumentRoot(stream);
-
- NodeList list = root.getElementsByTagName(CONFIG_ROOT);
- if (list == null || list.getLength() == 0) {
- // try looking for a QUALIFIED_CONFIG_ROOT
- list = root.getElementsByTagName(QUALIFIED_CONFIG_ROOT);
- if (list == null || list.getLength() == 0)
- throw new ConfigurationException("Can't find " + CONFIG_ROOT + " or " + QUALIFIED_CONFIG_ROOT + " tag");
- }
-
- Map<String, Configuration> result = new HashMap<String, Configuration>();
-
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- if (node.getNodeType() != Node.ELEMENT_NODE) {
- continue;
- }
-
- Element element = (Element) node;
- String name = element.getAttribute(CONFIG_NAME);
- if (name == null || name.trim().length() == 0)
- throw new ConfigurationException("Element " + element + " has no name attribute");
-
- XmlConfigurationParserJBC3 parser = new XmlConfigurationParserJBC3();
- Configuration c = null;
- if (parser.isValidElementRoot(element)) {
- c = parser.parseElementIgnoringRoot(element);
- }
-
- // Prove that we can successfully clone it
- c = c.clone();
- result.put(name.trim(), c);
- }
-
- return result;
- }
-
- private Element getDocumentRoot(InputStream stream) {
- RootElementBuilder rootElementBuilder = new RootElementBuilder(false);
- return rootElementBuilder.readRoot(stream);
- }
-}
\ No newline at end of file
Deleted: core/branches/flat/src/main/java/org/horizon/config/parsing/ConfigFilesConvertor.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/ConfigFilesConvertor.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/ConfigFilesConvertor.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.horizon.config.parsing;
-
-import org.horizon.util.FileLookup;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * Class used for converting a config file from from 2.x version to 3.x verison.
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 1.0
- */
-public class ConfigFilesConvertor {
- /**
- * Writes to the <b>os</b> the 3.x configuration file resulted by transforming the 2.x configuration file passed in
- * as <b>is</b>. Transformation is performed according to the <b>xsltFile</b>. The xslt file is looked up using a
- * {@link org.horizon.util.FileLookup}
- */
- public void parse(InputStream is, OutputStream os, String xsltFile) throws Exception {
- InputStream xsltInStream = new FileLookup().lookupFile(xsltFile);
-
- Document document = getInputDocument(is);
-
- // Use a Transformer for output
- Transformer transformer = getTransformer(xsltInStream);
-
- DOMSource source = new DOMSource(document);
- StreamResult result = new StreamResult(os);
- transformer.transform(source, result);
- xsltInStream.close();
- }
-
- /**
- * Writes to the <b>os</b> the 3.x configuration file resulted by transforming the 2.x configuration file passed in
- * as <b>inputFile</b>. Transformation is performed according to the <b>xsltFile</b>. Both <b>inputFile</b> and he
- * xslt file are looked up using a {@link org.horizon.util.FileLookup}
- */
- public void parse(String inputFile, OutputStream os, String xsltFile) throws Exception {
- InputStream stream = new FileLookup().lookupFile(inputFile);
- try {
- parse(stream, os, xsltFile);
- }
- finally {
- stream.close();
- }
- }
-
- /**
- * usage : java ConfigFilesConvertor -Dsource=config-2.x.xml -Ddestination=config-3.x.xnl
- */
- public static void main(String[] argv) throws Exception {
- String sourceName = System.getProperty("source");
- if (sourceName == null) {
- System.err.println("Missing property 'source'.");
- System.exit(1);
- }
- String destinationName = System.getProperty("destination");
- if (destinationName == null) {
- System.err.println("Missing property 'destination'.");
- System.exit(1);
- }
- File oldConfig = new File(sourceName);
- if (!oldConfig.exists()) {
- System.err.println("File specified as input ('" + sourceName + ") does not exist.");
- System.exit(1);
- }
- ConfigFilesConvertor convertor = new ConfigFilesConvertor();
- File destination = new File(destinationName);
- if (!destination.exists()) destination.createNewFile();
-
- FileInputStream is = new FileInputStream(oldConfig);
- FileOutputStream fos = new FileOutputStream(destinationName);
- convertor.parse(is, fos, "config2to3.xslt");
- is.close();
- System.out.println("File successfully created.");
- }
-
- private Transformer getTransformer(InputStream xsltInStream)
- throws TransformerConfigurationException {
- TransformerFactory tFactory = TransformerFactory.newInstance();
- StreamSource stylesource = new StreamSource(xsltInStream);
- return tFactory.newTransformer(stylesource);
- }
-
- private Document getInputDocument(InputStream is)
- throws ParserConfigurationException, SAXException, IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- return builder.parse(is);
- }
-}
\ No newline at end of file
Added: core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java (rev 0)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/GlobalConfigurationParserTest.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -0,0 +1,200 @@
+package org.horizon.config.parsing;
+
+import org.horizon.config.GlobalConfiguration;
+import org.horizon.executors.DefaultExecutorFactory;
+import org.horizon.executors.DefaultScheduledExecutorFactory;
+import org.horizon.marshall.HorizonMarshaller;
+import org.horizon.marshall.VersionAwareMarshaller;
+import org.horizon.remoting.transport.jgroups.JGroupsTransport;
+import org.testng.annotations.Test;
+import org.w3c.dom.Element;
+
+
+@Test(groups = "unit")
+public class GlobalConfigurationParserTest {
+
+ public void testTransport() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String transportClass = "org.blah.Blah";
+ String xml = "<transport transportClass=\"" + transportClass + "\"><property name=\"something\">value</property></transport>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureTransport(e, gc);
+
+ assert gc.getTransportClass().equals(transportClass);
+ assert gc.getTransportProperties().size() == 1;
+ assert gc.getTransportProperties().getProperty("something").equals("value");
+ }
+
+ public void testDefaultTransport() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<transport />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureTransport(e, gc);
+
+ assert gc.getTransportClass().equals(JGroupsTransport.class.getName());
+ assert gc.getTransportProperties().size() == 0;
+ }
+
+ public void testShutdown() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<shutdown hookBehavior=\"REGISTER\" />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureShutdown(e, gc);
+
+ assert gc.getShutdownHookBehavior() == GlobalConfiguration.ShutdownHookBehavior.REGISTER;
+ }
+
+ public void testDefaultShutdown() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<shutdown />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureShutdown(e, gc);
+
+ assert gc.getShutdownHookBehavior() == GlobalConfiguration.ShutdownHookBehavior.DEFAULT;
+ }
+
+ public void testMarshalling() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<serialization marshallerClass=\"org.horizon.marshall.HorizonMarshaller\" version=\"9.2\"\n" +
+ " objectInputStreamPoolSize=\"100\" objectOutputStreamPoolSize=\"100\"/>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureMarshalling(e, gc);
+
+ assert gc.getMarshallerClass().equals(HorizonMarshaller.class.getName());
+ assert gc.getMarshallVersionString().equals("9.2.0");
+ assert gc.getObjectInputStreamPoolSize() == 100;
+ assert gc.getObjectOutputStreamPoolSize() == 100;
+ }
+
+ public void testMarshallingDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<serialization />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureMarshalling(e, gc);
+
+ assert gc.getMarshallerClass().equals(VersionAwareMarshaller.class.getName());
+ assert gc.getMarshallVersionString().equals("1.0.0");
+ assert gc.getObjectInputStreamPoolSize() == 50;
+ assert gc.getObjectOutputStreamPoolSize() == 50;
+ }
+
+ public void testAsyncListenerExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncListenerExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </asyncListenerExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncListenerExecutor(e, gc);
+
+ assert gc.getAsyncListenerExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getAsyncListenerExecutorProperties().size() == 1;
+ assert gc.getAsyncListenerExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testAsyncSerializationExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncSerializationExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </asyncSerializationExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncSerializationExecutor(e, gc);
+
+ assert gc.getAsyncSerializationExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getAsyncSerializationExecutorProperties().size() == 1;
+ assert gc.getAsyncSerializationExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testEvictionScheduledExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<evictionScheduledExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </evictionScheduledExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureEvictionScheduledExecutor(e, gc);
+
+ assert gc.getEvictionScheduledExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getEvictionScheduledExecutorProperties().size() == 1;
+ assert gc.getEvictionScheduledExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testReplicationQueueScheduledExecutor() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<replicationQueueScheduledExecutor factory=\"com.mycompany.Factory\">\n" +
+ " <property name=\"maxThreads\" value=\"5\" />" +
+ " </replicationQueueScheduledExecutor>";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureReplicationQueueScheduledExecutor(e, gc);
+
+ assert gc.getReplicationQueueScheduledExecutorFactoryClass().equals("com.mycompany.Factory");
+ assert gc.getReplicationQueueScheduledExecutorProperties().size() == 1;
+ assert gc.getReplicationQueueScheduledExecutorProperties().get("maxThreads").equals("5");
+ }
+
+ public void testAsyncListenerExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncListenerExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncListenerExecutor(e, gc);
+
+ assert gc.getAsyncListenerExecutorFactoryClass().equals(DefaultExecutorFactory.class.getName());
+ assert gc.getAsyncListenerExecutorProperties().size() == 0;
+ }
+
+ public void testAsyncSerializationExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<asyncSerializationExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureAsyncSerializationExecutor(e, gc);
+
+ assert gc.getAsyncSerializationExecutorFactoryClass().equals(DefaultExecutorFactory.class.getName());
+ assert gc.getAsyncSerializationExecutorProperties().size() == 0;
+ }
+
+ public void testEvictionScheduledExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<evictionScheduledExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureEvictionScheduledExecutor(e, gc);
+
+ assert gc.getEvictionScheduledExecutorFactoryClass().equals(DefaultScheduledExecutorFactory.class.getName());
+ assert gc.getEvictionScheduledExecutorProperties().size() == 0;
+ }
+
+ public void testReplicationQueueScheduledExecutorDefaults() throws Exception {
+ XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
+ String xml = "<replicationQueueScheduledExecutor />";
+ Element e = XmlConfigHelper.stringToElement(xml);
+
+ GlobalConfiguration gc = new GlobalConfiguration();
+ parser.configureReplicationQueueScheduledExecutor(e, gc);
+
+ assert gc.getReplicationQueueScheduledExecutorFactoryClass().equals(DefaultScheduledExecutorFactory.class.getName());
+ assert gc.getReplicationQueueScheduledExecutorProperties().size() == 0;
+ }
+}
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -36,8 +36,8 @@
import java.io.InputStream;
/**
- * Parses an xml files and validates xml elements form {@link RootElementBuilder#JBOSSCACHE_CORE_NS} namespace according
- * to the configured schema.
+ * Parses an xml files and validates xml elements form {@link RootElementBuilder#HORIZON_NS} namespace according to the
+ * configured schema.
*
* @author Mircea.Markus(a)jboss.com
* @since 1.0
@@ -46,19 +46,17 @@
private static final JBossEntityResolver resolver = new JBossEntityResolver();
- public static final String JBOSSCACHE_CORE_NS = "urn:jboss:starobrno-core:config:1.0";
- public static final String JBOSSCACHE_REPO_NS = "urn:jboss:starobrno-core:cache-repo:1.0";
+ public static final String HORIZON_NS = "urn:horizon:config:1.0";
static {
// Globally register this namespace
- JBossEntityResolver.registerEntity(JBOSSCACHE_CORE_NS, "horizon-config-1.0.xsd");
- JBossEntityResolver.registerEntity(JBOSSCACHE_REPO_NS, "starobrno-registry-1.0.xsd");
+ JBossEntityResolver.registerEntity(HORIZON_NS, "horizon-config-1.0.xsd");
}
private static final Log log = LogFactory.getLog(RootElementBuilder.class);
private ErrorHandler errorHandler;
private boolean isValidating;
- public static final String VALIDATING_SYSTEM_PROPERTY = "jbosscache.config.validate";
+ public static final String VALIDATING_SYSTEM_PROPERTY = "horizon.config.validate";
public RootElementBuilder(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
@@ -85,7 +83,7 @@
if (isValidating) {
docBuilderFactory.setValidating(true);
docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- String[] value = {JBOSSCACHE_CORE_NS, JBOSSCACHE_REPO_NS};
+ String[] value = {HORIZON_NS};
docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", value);
}
DocumentBuilder parser = docBuilderFactory.newDocumentBuilder();
@@ -98,7 +96,7 @@
}
catch (Exception e) {
log.error(e);
- throw new ConfigurationException("Could not parse the config file");
+ throw new ConfigurationException("Could not parse the config file", e);
}
}
@@ -120,7 +118,7 @@
private void logAndThrowException(SAXParseException exception) {
log.error("Configuration warning: " + exception.getMessage());
- throw new ConfigurationException("Incorrect configuration file. Use '-Djbosscache.config.validate=false' to disable validation.", exception);
+ throw new ConfigurationException("Incorrect configuration file. Use '-Dhorizon.config.validate=false' to disable validation.", exception);
}
}
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigHelper.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigHelper.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigHelper.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -25,6 +25,7 @@
import org.horizon.logging.Log;
import org.horizon.logging.LogFactory;
import org.horizon.util.BeanUtils;
+import org.horizon.util.TypedProperties;
import org.jboss.util.StringPropertyReplacer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -49,7 +50,6 @@
import java.io.InputStream;
import java.io.StringWriter;
import java.lang.reflect.Method;
-import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -63,28 +63,6 @@
private static final Log log = LogFactory.getLog(XmlConfigHelper.class);
/**
- * The root of a JBoss Cache configuration XML file. This is the <tt><mbean></tt> tag.
- */
- public static final String ROOT = "mbean";
-
- /**
- * The <tt><attribute></tt> tag which forms the bulk of JBoss Cache configuration elements
- */
- public static final String ATTR = "attribute";
-
- /**
- * The <tt><config></tt> tag may be embedded in the contents of an <tt><attribute></tt>, to specify more
- * complex configuration for certain parameters.
- */
- public static final String CONFIG_ATTR = "config";
-
- /**
- * The <tt><name></tt> attribute to an <tt><attribute></tt> tag.
- */
- public static final String NAME = "name";
-
-
- /**
* Returns the contents of a specific node of given element name, provided a certain attribute exists and is set to
* value. E.g., if you have a {@link Element} which represents the following XML snippet:
* <pre>
@@ -350,7 +328,7 @@
* @throws Exception if unable to parse the String or if it doesn't contain valid XML.
*/
public static Element stringToElementInCoreNS(String xml) throws Exception {
- xml = "<wrapper xmlns='" + RootElementBuilder.JBOSSCACHE_CORE_NS + "'>" + xml + "</wrapper>";
+ xml = "<wrapper xmlns='" + RootElementBuilder.HORIZON_NS + "'>" + xml + "</wrapper>";
ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("utf8"));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
@@ -479,7 +457,7 @@
if (paramTypes.length != 1) {
if (log.isTraceEnabled())
log.trace("Rejecting setter " + m + " on class " + objectClass + " due to incorrect number of parameters");
- continue; // try another param with the same name.
+ continue; // try another param with the same name.
}
Class parameterType = paramTypes[0];
@@ -508,38 +486,10 @@
}
}
- public static ParsedAttributes extractAttributes(Element source) {
- Map<String, String> stringAttribs = new HashMap<String, String>();
- Map<String, Element> xmlAttribs = new HashMap<String, Element>();
- NodeList list = source.getElementsByTagName(ATTR);
- if (log.isDebugEnabled()) log.debug("Attribute size: {0}", list.getLength());
-
- // loop through attributes
- for (int loop = 0; loop < list.getLength(); loop++) {
- Node node = list.item(loop);
- if (node.getNodeType() != Node.ELEMENT_NODE) continue;
-
- // for each element (attribute) ...
- Element element = (Element) node;
- String name = element.getAttribute(NAME);
- String valueStr = getElementContent(element, true);
-
- Element valueXml = null;
- if (valueStr.length() == 0) {
- // This may be an XML element ...
- valueXml = getSubElement(element, CONFIG_ATTR);
- if (valueXml != null) xmlAttribs.put(name, valueXml);
- } else {
- if (valueStr.length() > 0) stringAttribs.put(name, valueStr);
- }
- }
- return new ParsedAttributes(stringAttribs, xmlAttribs);
- }
-
public static Properties extractProperties(Element source) {
- Properties p = new Properties();
+ TypedProperties p = new TypedProperties();
NodeList list = source.getElementsByTagName("property");
-
+ if (list == null) return null;
// loop through attributes
for (int loop = 0; loop < list.getLength(); loop++) {
Node node = list.item(loop);
@@ -547,7 +497,7 @@
// for each element (attribute) ...
Element element = (Element) node;
- String name = element.getAttribute(NAME);
+ String name = element.getAttribute("name");
String valueStr = element.getAttribute("value");
if (valueStr.length() > 0) {
@@ -556,7 +506,7 @@
p.put(name, valueStr);
}
}
- return p;
+ return p.isEmpty() ? null : p;
}
public static String toString(Element e) {
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParser.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParser.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParser.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -34,6 +34,14 @@
void initialize(InputStream inputStream) throws IOException;
/**
+ * Parses the default template configuration.
+ *
+ * @return a configuration instance representing the "default" block in the configuration file
+ * @throws ConfigurationException if there is a problem parsing the configuration XML
+ */
+ Configuration parseDefaultConfiguration() throws ConfigurationException;
+
+ /**
* Parses and retrieves configuration overrides for named caches.
*
* @return a Map of Configuration overrides keyed on cache name
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserImpl.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -1,18 +1,24 @@
package org.horizon.config.parsing;
+import org.horizon.config.CacheLoaderConfig;
import org.horizon.config.Configuration;
import org.horizon.config.ConfigurationException;
+import org.horizon.config.CustomInterceptorConfig;
import org.horizon.config.GlobalConfiguration;
+import org.horizon.config.parsing.element.CustomInterceptorsElementParser;
+import org.horizon.config.parsing.element.EvictionElementParser;
+import org.horizon.config.parsing.element.LoadersElementParser;
+import org.horizon.lock.IsolationLevel;
import org.horizon.util.FileLookup;
import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
+import java.util.Properties;
/**
* The default XML configuration parser
@@ -21,9 +27,16 @@
* @since 1.0
*/
public class XmlConfigurationParserImpl extends XmlParserBase implements XmlConfigurationParser {
+
+ // this parser will need to be initialized.
boolean initialized = false;
+
+ // the root element, representing the <horizon /> tag
Element rootElement;
+ // root element builder that deals with
+ private RootElementBuilder rootElementBuilder;
+
/**
* Constructs a new parser
*/
@@ -68,31 +81,339 @@
public Configuration parseDefaultConfiguration() throws ConfigurationException {
assertInitialized();
- Element defaultConfiguration = getSingleElementInCoreNS("default", rootElement);
- return new XmlConfigurationParserJBC3().parseElementIgnoringRoot(defaultConfiguration);
+// Element defaultConfiguration = getSingleElementInCoreNS("default", rootElement);
+// rootElementBuilder = new RootElementBuilder();
+// rootElement = defaultConfiguration;
+// return parseElementIgnoringRoot();
+ return null;
}
public Map<String, Configuration> parseNamedConfigurations() throws ConfigurationException {
assertInitialized();
- Set<Element> elements = getAllElementsInCoreNS("namedCache", rootElement);
- if (elements.isEmpty()) return Collections.emptyMap();
- Map<String, Configuration> namedConfigurations = new HashMap<String, Configuration>(elements.size(), 1.0f);
- for (Element e : elements) {
- String configurationName = getAttributeValue(e, "name");
- if (namedConfigurations.containsKey(configurationName))
- throw new ConfigurationException("Named cache " + configurationName + " contains duplicate entries!");
- namedConfigurations.put(configurationName, new XmlConfigurationParserJBC3().parseElementIgnoringRoot(e));
- }
-
- return namedConfigurations;
+// Set<Element> elements = getAllElementsInCoreNS("namedCache", rootElement);
+// if (elements.isEmpty()) return Collections.emptyMap();
+// Map<String, Configuration> namedConfigurations = new HashMap<String, Configuration>(elements.size(), 1.0f);
+// rootElementBuilder = new RootElementBuilder();
+// for (Element e : elements) {
+// String configurationName = getAttributeValue(e, "name");
+// if (namedConfigurations.containsKey(configurationName))
+// throw new ConfigurationException("Named cache " + configurationName + " contains duplicate entries!");
+//
+// namedConfigurations.put(configurationName, parseElementIgnoringRoot());
+// }
+//
+// return namedConfigurations;
+ return null;
}
public GlobalConfiguration parseGlobalConfiguration() {
- throw new RuntimeException("Implement me");
+ assertInitialized();
+ Element globalElement = getSingleElementInCoreNS("global", rootElement);
+ globalElement.normalize();
+
+ return null;
}
private void assertInitialized() {
if (!initialized)
throw new ConfigurationException("Parser not initialized. Please invoke initialize() first, or use a constructor that initializes the parser.");
}
+
+ /**
+ * Parses an XML file and returns a new configuration. For looking up the file, {@link org.horizon.util.FileLookup}
+ * is used.
+ *
+ * @see org.horizon.util.FileLookup
+ */
+// public Configuration parseFile(String filename) {
+// InputStream is = new FileLookup().lookupFile(filename);
+// if (is == null) {
+// throw new ConfigurationException("Unable to find config file " + filename + " either in classpath or on the filesystem!");
+// }
+// return parseStream(is);
+// }
+
+ /**
+ * Similar to {@link #parseFile(String)}, just that it does not create the input stream.
+ */
+// public Configuration parseStream(InputStream configStream) {
+// readRoot(configStream);
+// return processElements(false);
+// }
+//
+// public Configuration parseElement() {
+// rootElement.normalize();
+// return processElements(false);
+// }
+//
+// public Configuration parseElementIgnoringRoot() {
+// rootElement.normalize();
+// return processElements(true);
+// }
+ public boolean isValidating() {
+ return rootElementBuilder.isValidating();
+ }
+
+ void configureClustering(Element e, Configuration config) {
+ if (e == null) return; //we might not have this configured
+ // there are 2 attribs - mode and clusterName
+ boolean repl = true;
+ String mode = getAttributeValue(e, "mode").toUpperCase();
+ if (mode.startsWith("R"))
+ repl = true;
+ else if (mode.startsWith("I"))
+ repl = false;
+
+ Element asyncEl = getSingleElementInCoreNS("async", e);
+ Element syncEl = getSingleElementInCoreNS("sync", e);
+ if (syncEl != null && asyncEl != null)
+ throw new ConfigurationException("Cannot have sync and async elements within the same cluster element!");
+ boolean sync = asyncEl == null; // even if both are null, we default to sync
+ if (sync) {
+ config.setCacheMode(repl ? Configuration.CacheMode.REPL_SYNC : Configuration.CacheMode.INVALIDATION_SYNC);
+ configureSyncMode(syncEl, config);
+ } else {
+ config.setCacheMode(repl ? Configuration.CacheMode.REPL_ASYNC : Configuration.CacheMode.INVALIDATION_ASYNC);
+ configureAsyncMode(asyncEl, config);
+ }
+ String cn = getAttributeValue(e, "clusterName");
+// if (existsAttribute(cn)) config.setClusterName(cn);
+ configureStateRetrieval(getSingleElementInCoreNS("stateRetrieval", e), config);
+// configureTransport(getSingleElementInCoreNS("jgroupsConfig", e), config);
+ }
+
+ void configureStateRetrieval(Element element, Configuration config) {
+ if (element == null) return; //we might not have this configured
+ String fetchInMemoryState = getAttributeValue(element, "fetchInMemoryState");
+ if (existsAttribute(fetchInMemoryState)) config.setFetchInMemoryState(getBoolean(fetchInMemoryState));
+ String stateRetrievalTimeout = getAttributeValue(element, "timeout");
+ if (existsAttribute(stateRetrievalTimeout)) config.setStateRetrievalTimeout(getLong(stateRetrievalTimeout));
+
+ }
+
+ void configureTransaction(Element element, Configuration config) {
+ if (element == null) return;
+ String attrName = "transactionManagerLookupClass";
+ String txMngLookupClass = getAttributeValue(element, attrName);
+ if (existsAttribute(txMngLookupClass)) config.setTransactionManagerLookupClass(txMngLookupClass);
+ String syncRollbackPhase = getAttributeValue(element, "syncRollbackPhase");
+ if (existsAttribute(syncRollbackPhase)) config.setSyncRollbackPhase(getBoolean(syncRollbackPhase));
+ String syncCommitPhase = getAttributeValue(element, "syncCommitPhase");
+ if (existsAttribute(syncCommitPhase)) config.setSyncCommitPhase(getBoolean(syncCommitPhase));
+ }
+
+ void configureSerialization(Element element, Configuration config) {
+ if (element == null) return;
+ String objectInputStreamPoolSize = getAttributeValue(element, "objectInputStreamPoolSize");
+// if (existsAttribute(objectInputStreamPoolSize))
+// config.setObjectInputStreamPoolSize(getInt(objectInputStreamPoolSize));
+ String objectOutputStreamPoolSize = getAttributeValue(element, "objectOutputStreamPoolSize");
+// if (existsAttribute(objectOutputStreamPoolSize))
+// config.setObjectOutputStreamPoolSize(getInt(objectOutputStreamPoolSize));
+ String version = getAttributeValue(element, "version");
+// if (existsAttribute(version)) config.setReplVersionString(version);
+ String marshallerClass = getAttributeValue(element, "marshallerClass");
+// if (existsAttribute(marshallerClass)) config.setMarshallerClass(marshallerClass);
+ String useLazyDeserialization = getAttributeValue(element, "useLazyDeserialization");
+ if (existsAttribute(useLazyDeserialization)) config.setUseLazyDeserialization(getBoolean(useLazyDeserialization));
+ String useRegionBasedMarshalling = getAttributeValue(element, "useRegionBasedMarshalling");
+// if (existsAttribute(useRegionBasedMarshalling))
+// config.setUseRegionBasedMarshalling(getBoolean(useRegionBasedMarshalling));
+ }
+
+ void configureCustomInterceptors(Element element, Configuration config) {
+ if (element == null) return; //this element might be missing
+ CustomInterceptorsElementParser parser = new CustomInterceptorsElementParser();
+ List<CustomInterceptorConfig> interceptorConfigList = parser.parseCustomInterceptors(element);
+ config.setCustomInterceptors(interceptorConfigList);
+ }
+
+ void configureListeners(Element element, Configuration config) {
+ if (element == null) return; //this element is optional
+ String asyncPoolSizeStr = getAttributeValue(element, "asyncPoolSize");
+// if (existsAttribute(asyncPoolSizeStr)) config.setListenerAsyncPoolSize(getInt(asyncPoolSizeStr));
+
+ String asyncQueueSizeStr = getAttributeValue(element, "asyncQueueSize");
+// if (existsAttribute(asyncQueueSizeStr)) config.setListenerAsyncQueueSize(getInt(asyncQueueSizeStr));
+ }
+
+ void configureInvocationBatching(Element element, Configuration config) {
+ if (element == null) return; //this element is optional
+ boolean enabled = getBoolean(getAttributeValue(element, "enabled"));
+ config.setInvocationBatchingEnabled(enabled);
+ }
+
+ void configureCacheLoaders(Element element, Configuration config) {
+ if (element == null) return; //null cache loaders are allowed
+ LoadersElementParser clElementParser = new LoadersElementParser();
+ CacheLoaderConfig cacheLoaderConfig = clElementParser.parseLoadersElement(element);
+ config.setCacheLoaderConfig(cacheLoaderConfig);
+ }
+
+ void configureEviction(Element element, Configuration config) {
+ if (element == null) return; //no eviction might be configured
+ EvictionElementParser evictionElementParser = new EvictionElementParser();
+ //config.setEvictionConfig(evictionElementParser.parseEvictionElement(element));
+ }
+
+ void configureJmxStatistics(Element element, Configuration config) {
+ if (element == null) return; //might not be specified
+ String enabled = getAttributeValue(element, "enabled");
+ config.setExposeManagementStatistics(getBoolean(enabled));
+ }
+
+ void configureInvalidation(Element element, Configuration config) {
+ if (element == null) return; //might be replication
+ Element async = getSingleElement("async");
+ if (async != null) {
+ config.setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC);
+ configureAsyncMode(getSingleElementInCoreNS("async", element), config);
+ }
+ Element sync = getSingleElement("sync");
+ if (sync != null) {
+ config.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
+ configureSyncMode(getSingleElementInCoreNS("sync", element), config);
+ }
+ }
+
+ void configureSyncMode(Element element, Configuration config) {
+ String replTimeout = getAttributeValue(element, "replTimeout");
+ if (existsAttribute(replTimeout)) config.setSyncReplTimeout(getLong(replTimeout));
+ }
+
+ void configureAsyncMode(Element element, Configuration config) {
+ String useReplQueue = getAttributeValue(element, "useReplQueue");
+ if (existsAttribute(useReplQueue)) config.setUseReplQueue(getBoolean(useReplQueue));
+ String replQueueInterval = getAttributeValue(element, "replQueueInterval");
+ if (existsAttribute(replQueueInterval)) config.setReplQueueInterval(getLong(replQueueInterval));
+ String replQueueMaxElements = getAttributeValue(element, "replQueueMaxElements");
+
+ if (existsAttribute(replQueueMaxElements)) config.setReplQueueMaxElements(getInt(replQueueMaxElements));
+ String serializationExecutorPoolSize = getAttributeValue(element, "serializationExecutorPoolSize");
+// if (existsAttribute(serializationExecutorPoolSize))
+// config.setSerializationExecutorPoolSize(getInt(serializationExecutorPoolSize));
+
+ String serializationExecutorQueueSize = getAttributeValue(element, "serializationExecutorQueueSize");
+// if (existsAttribute(serializationExecutorQueueSize))
+// config.setSerializationExecutorQueueSize(getInt(serializationExecutorQueueSize));
+ }
+
+ void configureLocking(Element element, Configuration config) {
+ String isolationLevel = getAttributeValue(element, "isolationLevel");
+ if (existsAttribute(isolationLevel)) config.setIsolationLevel(IsolationLevel.valueOf(isolationLevel));
+ String lockParentForChildInsertRemove = getAttributeValue(element, "lockParentForChildInsertRemove");
+ if (existsAttribute(lockParentForChildInsertRemove))
+ config.setLockParentForChildInsertRemove(getBoolean(lockParentForChildInsertRemove));
+ String lockAcquisitionTimeout = getAttributeValue(element, "lockAcquisitionTimeout");
+ if (existsAttribute(lockAcquisitionTimeout)) config.setLockAcquisitionTimeout(getLong(lockAcquisitionTimeout));
+ String writeSkewCheck = getAttributeValue(element, "writeSkewCheck");
+ if (existsAttribute(writeSkewCheck)) config.setWriteSkewCheck(getBoolean(writeSkewCheck));
+ String concurrencyLevel = getAttributeValue(element, "concurrencyLevel");
+ if (existsAttribute(concurrencyLevel)) config.setConcurrencyLevel(getInt(concurrencyLevel));
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+ // Configure the GlobalConfiguration object
+ // ----------------------------------------------------------------------------------------------------------------
+
+ void configureShutdown(Element element, GlobalConfiguration config) {
+ if (element != null) {
+ String hookBehavior = getAttributeValue(element, "hookBehavior");
+ if (existsAttribute(hookBehavior)) config.setShutdownHookBehavior(hookBehavior);
+ }
+ }
+
+ void configureTransport(Element element, GlobalConfiguration config) {
+// if (element == null) return; //transport might be missing
+//
+// // first see if a configFile is provided
+// String cfgFile = getAttributeValue(element, "configFile");
+// if (existsAttribute(cfgFile)) {
+// // try and load this file
+// URL u = new FileLookup().lookupFileLocation(cfgFile);
+// config.setJgroupsConfigFile(u);
+// } else {
+// String multiplexerStack = getAttributeValue(element, "multiplexerStack");
+// if (existsAttribute(multiplexerStack)) {
+// config.setMultiplexerStack(multiplexerStack);
+// } else {
+// JGroupsStackParser stackParser = new JGroupsStackParser();
+// String clusterConfigStr = stackParser.parseClusterConfigXml(element);
+// if (clusterConfigStr != null && clusterConfigStr.trim().length() > 0)
+// config.setClusterConfig(clusterConfigStr);
+// }
+// }
+ }
+
+ void configureMarshalling(Element e, GlobalConfiguration configuration) {
+ if (e != null) {
+ String tmp = getAttributeValue(e, "marshallerClass");
+ if (existsAttribute(tmp)) configuration.setMarshallerClass(tmp);
+
+ tmp = getAttributeValue(e, "version");
+ if (existsAttribute(tmp)) configuration.setMarshallVersion(tmp);
+
+ tmp = getAttributeValue(e, "objectInputStreamPoolSize");
+ if (existsAttribute(tmp)) configuration.setObjectInputStreamPoolSize(getInt(tmp));
+
+ tmp = getAttributeValue(e, "objectOutputStreamPoolSize");
+ if (existsAttribute(tmp)) configuration.setObjectOutputStreamPoolSize(getInt(tmp));
+ }
+ }
+
+ void configureAsyncListenerExecutor(Element e, GlobalConfiguration gc) {
+ if (e != null) {
+ String tmp = getAttributeValue(e, "factory");
+ if (existsAttribute(tmp)) gc.setAsyncListenerExecutorFactoryClass(tmp);
+ Properties p = XmlConfigHelper.extractProperties(e);
+ if (p != null) gc.setAsyncListenerExecutorProperties(p);
+ }
+ }
+
+ void configureAsyncSerializationExecutor(Element e, GlobalConfiguration gc) {
+ if (e != null) {
+ String tmp = getAttributeValue(e, "factory");
+ if (existsAttribute(tmp)) gc.setAsyncSerializationExecutorFactoryClass(tmp);
+ Properties p = XmlConfigHelper.extractProperties(e);
+ if (p != null) gc.setAsyncSerializationExecutorProperties(p);
+ }
+ }
+
+ void configureEvictionScheduledExecutor(Element e, GlobalConfiguration gc) {
+ if (e != null) {
+ String tmp = getAttributeValue(e, "factory");
+ if (existsAttribute(tmp)) gc.setEvictionScheduledExecutorFactoryClass(tmp);
+ Properties p = XmlConfigHelper.extractProperties(e);
+ if (p != null) gc.setEvictionScheduledExecutorProperties(p);
+ }
+ }
+
+ void configureReplicationQueueScheduledExecutor(Element e, GlobalConfiguration gc) {
+ if (e != null) {
+ String tmp = getAttributeValue(e, "factory");
+ if (existsAttribute(tmp)) gc.setReplicationQueueScheduledExecutorFactoryClass(tmp);
+ Properties p = XmlConfigHelper.extractProperties(e);
+ if (p != null) gc.setReplicationQueueScheduledExecutorProperties(p);
+ }
+ }
+
+ private Element getSingleElement(String elementName) {
+ return getSingleElementInCoreNS(elementName, rootElement);
+ }
+
+ private void readRoot(InputStream config) {
+ rootElement = rootElementBuilder.readRoot(config);
+ }
+
+ /**
+ * Tests whether the element passed in is a modern (3.0) config element rather than a legacy one.
+ *
+ * @param element element to test
+ * @return true of the element is a modern one and can be parsed using the current parser.
+ */
+ public boolean isValidElementRoot(Element element) {
+ // simply test for the "jbosscache" element.
+ NodeList elements = element.getElementsByTagName("jbosscache");
+ return elements != null && elements.getLength() > 0;
+ }
}
Deleted: core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserJBC3.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserJBC3.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/XmlConfigurationParserJBC3.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -1,369 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.horizon.config.parsing;
-
-import org.horizon.config.CacheLoaderConfig;
-import org.horizon.config.Configuration;
-import org.horizon.config.Configuration.CacheMode;
-import org.horizon.config.ConfigurationException;
-import org.horizon.config.CustomInterceptorConfig;
-import org.horizon.config.GlobalConfiguration;
-import org.horizon.config.parsing.element.CustomInterceptorsElementParser;
-import org.horizon.config.parsing.element.EvictionElementParser;
-import org.horizon.config.parsing.element.LoadersElementParser;
-import org.horizon.lock.IsolationLevel;
-import org.horizon.util.FileLookup;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.ErrorHandler;
-
-import java.io.InputStream;
-import java.util.List;
-
-/**
- * Reads in XMLconfiguration files and spits out a {@link Configuration} object. By default this class uses a validating
- * parser (configurable).
- * <p/>
- * Following system properties can be used for customizing parser behavior: <ul> <li>
- * <b>-Djbosscache.config.validate=false</b> will make the parser non-validating </li> <li>
- * <b>-Djbosscache.config.schemaLocation=url</b> allows one to specify a validation schema that would override the one
- * specified in the the xml document </li> </ul> This class is stateful and one instance should be used for parsing a
- * single configuration file.
- *
- * @author Mircea.Markus(a)jboss.com
- * @see RootElementBuilder
- * @since 1.0
- */
-public class XmlConfigurationParserJBC3 extends XmlParserBase {
- private RootElementBuilder rootElementBuilder;
-
- /**
- * the resulting configuration.
- */
- private Configuration config = new Configuration();
- private GlobalConfiguration globalconfig = new GlobalConfiguration();
- private Element root;
-
- /**
- * If validation is on (default) one can specify an error handler for handling validation errors. The default error
- * handler just logs parsing errors received.
- */
- public XmlConfigurationParserJBC3(ErrorHandler errorHandler) {
- rootElementBuilder = new RootElementBuilder(errorHandler);
- }
-
- /**
- * Same as {@link #XmlConfigurationParserJBC3(org.xml.sax.ErrorHandler)}.
- *
- * @param validating should the underlaying parser disable the validation?
- */
- public XmlConfigurationParserJBC3(boolean validating, ErrorHandler errorHandler) {
- rootElementBuilder = new RootElementBuilder(errorHandler, validating);
- }
-
- /**
- * Constructs a parser having validation enabled with a ErrorHandler that only logs the parser errors.
- */
- public XmlConfigurationParserJBC3() {
- rootElementBuilder = new RootElementBuilder();
- }
-
- /**
- * Parses an XML file and returns a new configuration. For looking up the file, {@link org.horizon.util.FileLookup}
- * is used.
- *
- * @see org.horizon.util.FileLookup
- */
- public Configuration parseFile(String filename) {
- InputStream is = new FileLookup().lookupFile(filename);
- if (is == null) {
- throw new ConfigurationException("Unable to find config file " + filename + " either in classpath or on the filesystem!");
- }
- return parseStream(is);
- }
-
- /**
- * Similar to {@link #parseFile(String)}, just that it does not create the input stream.
- */
- public Configuration parseStream(InputStream configStream) {
- readRoot(configStream);
- return processElements(false);
- }
-
- /**
- * Root should be the <b>jbosscache</b> element in the configuration file.
- */
- public Configuration parseElement(Element root) {
- this.root = root;
- this.root.normalize();
- return processElements(false);
- }
-
- public Configuration parseElementIgnoringRoot(Element root) {
- this.root = root;
- this.root.normalize();
- return processElements(true);
- }
-
- public boolean isValidating() {
- return rootElementBuilder.isValidating();
- }
-
- private Configuration processElements(boolean ignoreRoot) {
- if (!ignoreRoot &&
- (!"jbosscache".equals(root.getLocalName()) || !RootElementBuilder.JBOSSCACHE_CORE_NS.equals(root.getNamespaceURI()))) {
- throw new ConfigurationException("Expected root element {" + RootElementBuilder.JBOSSCACHE_CORE_NS + "}" + "jbosscache");
- }
-
- try {
- configureLocking(getSingleElement("locking"));
- configureTransaction(getSingleElement("transaction"));
- configureClustering(getSingleElement("clustering"));
- configureSerialization(getSingleElement("serialization"));
- configureInvalidation(getSingleElement("invalidation"));
- configureStartup(getSingleElement("startup"));
- configureShutdown(getSingleElement("shutdown"));
- configureJmxStatistics(getSingleElement("jmxStatistics"));
- configureEviction(getSingleElement("eviction"));
- configureCacheLoaders(getSingleElement("loaders"));
- configureCustomInterceptors(getSingleElement("customInterceptors"));
- configureListeners(getSingleElement("listeners"));
- configureInvocationBatching(getSingleElement("invocationBatching"));
- }
- catch (Exception e) {
- throw new ConfigurationException("Unexpected exception while parsing the configuration file", e);
- }
- return config;
- }
-
- private void configureClustering(Element e) {
- if (e == null) return; //we might not have this configured
- // there are 2 attribs - mode and clusterName
- boolean repl = true;
- String mode = getAttributeValue(e, "mode").toUpperCase();
- if (mode.startsWith("R"))
- repl = true;
- else if (mode.startsWith("I"))
- repl = false;
-
- Element asyncEl = getSingleElementInCoreNS("async", e);
- Element syncEl = getSingleElementInCoreNS("sync", e);
- if (syncEl != null && asyncEl != null)
- throw new ConfigurationException("Cannot have sync and async elements within the same cluster element!");
- boolean sync = asyncEl == null; // even if both are null, we default to sync
- if (sync) {
- config.setCacheMode(repl ? CacheMode.REPL_SYNC : CacheMode.INVALIDATION_SYNC);
- configureSyncMode(syncEl);
- } else {
- config.setCacheMode(repl ? CacheMode.REPL_ASYNC : CacheMode.INVALIDATION_ASYNC);
- configureAsyncMode(asyncEl);
- }
- String cn = getAttributeValue(e, "clusterName");
-// if (existsAttribute(cn)) config.setClusterName(cn);
- configureStateRetrieval(getSingleElementInCoreNS("stateRetrieval", e));
- configureTransport(getSingleElementInCoreNS("jgroupsConfig", e));
- }
-
- private void configureStateRetrieval(Element element) {
- if (element == null) return; //we might not have this configured
- String fetchInMemoryState = getAttributeValue(element, "fetchInMemoryState");
- if (existsAttribute(fetchInMemoryState)) config.setFetchInMemoryState(getBoolean(fetchInMemoryState));
- String stateRetrievalTimeout = getAttributeValue(element, "timeout");
- if (existsAttribute(stateRetrievalTimeout)) config.setStateRetrievalTimeout(getLong(stateRetrievalTimeout));
-
- }
-
- private void configureTransaction(Element element) {
- if (element == null) return;
- String attrName = "transactionManagerLookupClass";
- String txMngLookupClass = getAttributeValue(element, attrName);
- if (existsAttribute(txMngLookupClass)) config.setTransactionManagerLookupClass(txMngLookupClass);
- String syncRollbackPhase = getAttributeValue(element, "syncRollbackPhase");
- if (existsAttribute(syncRollbackPhase)) config.setSyncRollbackPhase(getBoolean(syncRollbackPhase));
- String syncCommitPhase = getAttributeValue(element, "syncCommitPhase");
- if (existsAttribute(syncCommitPhase)) config.setSyncCommitPhase(getBoolean(syncCommitPhase));
- }
-
- private void configureSerialization(Element element) {
- if (element == null) return;
- String objectInputStreamPoolSize = getAttributeValue(element, "objectInputStreamPoolSize");
-// if (existsAttribute(objectInputStreamPoolSize))
-// config.setObjectInputStreamPoolSize(getInt(objectInputStreamPoolSize));
- String objectOutputStreamPoolSize = getAttributeValue(element, "objectOutputStreamPoolSize");
-// if (existsAttribute(objectOutputStreamPoolSize))
-// config.setObjectOutputStreamPoolSize(getInt(objectOutputStreamPoolSize));
- String version = getAttributeValue(element, "version");
-// if (existsAttribute(version)) config.setReplVersionString(version);
- String marshallerClass = getAttributeValue(element, "marshallerClass");
-// if (existsAttribute(marshallerClass)) config.setMarshallerClass(marshallerClass);
- String useLazyDeserialization = getAttributeValue(element, "useLazyDeserialization");
- if (existsAttribute(useLazyDeserialization)) config.setUseLazyDeserialization(getBoolean(useLazyDeserialization));
- String useRegionBasedMarshalling = getAttributeValue(element, "useRegionBasedMarshalling");
-// if (existsAttribute(useRegionBasedMarshalling))
-// config.setUseRegionBasedMarshalling(getBoolean(useRegionBasedMarshalling));
- }
-
- private void configureCustomInterceptors(Element element) {
- if (element == null) return; //this element might be missing
- CustomInterceptorsElementParser parser = new CustomInterceptorsElementParser();
- List<CustomInterceptorConfig> interceptorConfigList = parser.parseCustomInterceptors(element);
- config.setCustomInterceptors(interceptorConfigList);
- }
-
- private void configureListeners(Element element) {
- if (element == null) return; //this element is optional
- String asyncPoolSizeStr = getAttributeValue(element, "asyncPoolSize");
-// if (existsAttribute(asyncPoolSizeStr)) config.setListenerAsyncPoolSize(getInt(asyncPoolSizeStr));
-
- String asyncQueueSizeStr = getAttributeValue(element, "asyncQueueSize");
-// if (existsAttribute(asyncQueueSizeStr)) config.setListenerAsyncQueueSize(getInt(asyncQueueSizeStr));
- }
-
- private void configureInvocationBatching(Element element) {
- if (element == null) return; //this element is optional
- boolean enabled = getBoolean(getAttributeValue(element, "enabled"));
- config.setInvocationBatchingEnabled(enabled);
- }
-
- private void configureCacheLoaders(Element element) {
- if (element == null) return; //null cache loaders are allowed
- LoadersElementParser clElementParser = new LoadersElementParser();
- CacheLoaderConfig cacheLoaderConfig = clElementParser.parseLoadersElement(element);
- config.setCacheLoaderConfig(cacheLoaderConfig);
- }
-
- private void configureEviction(Element element) {
- if (element == null) return; //no eviction might be configured
- EvictionElementParser evictionElementParser = new EvictionElementParser();
- //config.setEvictionConfig(evictionElementParser.parseEvictionElement(element));
- }
-
- private void configureJmxStatistics(Element element) {
- if (element == null) return; //might not be specified
- String enabled = getAttributeValue(element, "enabled");
- config.setExposeManagementStatistics(getBoolean(enabled));
- }
-
- private void configureShutdown(Element element) {
- if (element == null) return;
- String hookBehavior = getAttributeValue(element, "hookBehavior");
-// if (existsAttribute(hookBehavior)) config.setShutdownHookBehavior(hookBehavior);
- }
-
- private void configureTransport(Element element) {
-// if (element == null) return; //transport might be missing
-//
-// // first see if a configFile is provided
-// String cfgFile = getAttributeValue(element, "configFile");
-// if (existsAttribute(cfgFile)) {
-// // try and load this file
-// URL u = new FileLookup().lookupFileLocation(cfgFile);
-// config.setJgroupsConfigFile(u);
-// } else {
-// String multiplexerStack = getAttributeValue(element, "multiplexerStack");
-// if (existsAttribute(multiplexerStack)) {
-// config.setMultiplexerStack(multiplexerStack);
-// } else {
-// JGroupsStackParser stackParser = new JGroupsStackParser();
-// String clusterConfigStr = stackParser.parseClusterConfigXml(element);
-// if (clusterConfigStr != null && clusterConfigStr.trim().length() > 0)
-// config.setClusterConfig(clusterConfigStr);
-// }
-// }
- }
-
- private void configureStartup(Element element) {
- if (element == null) return; //we might not have this configured
- String inactiveOnStartup = getAttributeValue(element, "regionsInactiveOnStartup");
- if (existsAttribute(inactiveOnStartup)) config.setInactiveOnStartup(getBoolean(inactiveOnStartup));
- }
-
- private void configureInvalidation(Element element) {
- if (element == null) return; //might be replication
- Element async = getSingleElement("async");
- if (async != null) {
- config.setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC);
- configureAsyncMode(getSingleElementInCoreNS("async", element));
- }
- Element sync = getSingleElement("sync");
- if (sync != null) {
- config.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
- configureSyncMode(getSingleElementInCoreNS("sync", element));
- }
- }
-
- private void configureSyncMode(Element element) {
- String replTimeout = getAttributeValue(element, "replTimeout");
- if (existsAttribute(replTimeout)) config.setSyncReplTimeout(getLong(replTimeout));
- }
-
- private void configureAsyncMode(Element element) {
- String useReplQueue = getAttributeValue(element, "useReplQueue");
- if (existsAttribute(useReplQueue)) config.setUseReplQueue(getBoolean(useReplQueue));
- String replQueueInterval = getAttributeValue(element, "replQueueInterval");
- if (existsAttribute(replQueueInterval)) config.setReplQueueInterval(getLong(replQueueInterval));
- String replQueueMaxElements = getAttributeValue(element, "replQueueMaxElements");
-
- if (existsAttribute(replQueueMaxElements)) config.setReplQueueMaxElements(getInt(replQueueMaxElements));
- String serializationExecutorPoolSize = getAttributeValue(element, "serializationExecutorPoolSize");
-// if (existsAttribute(serializationExecutorPoolSize))
-// config.setSerializationExecutorPoolSize(getInt(serializationExecutorPoolSize));
-
- String serializationExecutorQueueSize = getAttributeValue(element, "serializationExecutorQueueSize");
-// if (existsAttribute(serializationExecutorQueueSize))
-// config.setSerializationExecutorQueueSize(getInt(serializationExecutorQueueSize));
- }
-
- private void configureLocking(Element element) {
- String isolationLevel = getAttributeValue(element, "isolationLevel");
- if (existsAttribute(isolationLevel)) config.setIsolationLevel(IsolationLevel.valueOf(isolationLevel));
- String lockParentForChildInsertRemove = getAttributeValue(element, "lockParentForChildInsertRemove");
- if (existsAttribute(lockParentForChildInsertRemove))
- config.setLockParentForChildInsertRemove(getBoolean(lockParentForChildInsertRemove));
- String lockAcquisitionTimeout = getAttributeValue(element, "lockAcquisitionTimeout");
- if (existsAttribute(lockAcquisitionTimeout)) config.setLockAcquisitionTimeout(getLong(lockAcquisitionTimeout));
- String writeSkewCheck = getAttributeValue(element, "writeSkewCheck");
- if (existsAttribute(writeSkewCheck)) config.setWriteSkewCheck(getBoolean(writeSkewCheck));
- String concurrencyLevel = getAttributeValue(element, "concurrencyLevel");
- if (existsAttribute(concurrencyLevel)) config.setConcurrencyLevel(getInt(concurrencyLevel));
- }
-
- private Element getSingleElement(String elementName) {
- return getSingleElementInCoreNS(elementName, root);
- }
-
- private void readRoot(InputStream config) {
- root = rootElementBuilder.readRoot(config);
- }
-
- /**
- * Tests whether the element passed in is a modern (3.0) config element rather than a legacy one.
- *
- * @param element element to test
- * @return true of the element is a modern one and can be parsed using the current parser.
- */
- public boolean isValidElementRoot(Element element) {
- // simply test for the "jbosscache" element.
- NodeList elements = element.getElementsByTagName("jbosscache");
- return elements != null && elements.getLength() > 0;
- }
-}
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/XmlParserBase.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -93,14 +93,14 @@
* Convenient method for retrieving a single element with the give name, in the core namespace
*/
protected Element getSingleElementInCoreNS(String elementName, Element parent) {
- return getSingleElement(RootElementBuilder.JBOSSCACHE_CORE_NS, elementName, parent);
+ return getSingleElement(RootElementBuilder.HORIZON_NS, elementName, parent);
}
/**
* Convenience method for retrieving all child elements bearing the same element name, in the core namespace
*/
protected Set<Element> getAllElementsInCoreNS(String elementName, Element parent) {
- return getAllElements(RootElementBuilder.JBOSSCACHE_CORE_NS, elementName, parent);
+ return getAllElements(RootElementBuilder.HORIZON_NS, elementName, parent);
}
/**
Modified: core/branches/flat/src/main/java/org/horizon/manager/CacheManager.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/manager/CacheManager.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/manager/CacheManager.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -2,6 +2,7 @@
import org.horizon.Cache;
import org.horizon.config.Configuration;
+import org.horizon.config.DuplicateCacheNameException;
import org.horizon.factories.scopes.Scope;
import org.horizon.factories.scopes.Scopes;
import org.horizon.lifecycle.Lifecycle;
@@ -59,9 +60,9 @@
*
* @param cacheName name of cache to define
* @param configurationOverride configuration overrides to use
- * @throws CacheNameExistsException if the name is already in use.
+ * @throws DuplicateCacheNameException if the name is already in use.
*/
- void defineCache(String cacheName, Configuration configurationOverride) throws CacheNameExistsException;
+ void defineCache(String cacheName, Configuration configurationOverride) throws DuplicateCacheNameException;
/**
* Retrieves the default cache associated with this cache manager.
Deleted: core/branches/flat/src/main/java/org/horizon/manager/CacheNameExistsException.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/manager/CacheNameExistsException.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/manager/CacheNameExistsException.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -1,24 +0,0 @@
-package org.horizon.manager;
-
-/**
- * Thrown if a cache creation is attempted but the name already exists
- *
- * @author (various)
- * @since 1.0
- */
-public class CacheNameExistsException extends Exception {
- public CacheNameExistsException() {
- }
-
- public CacheNameExistsException(String message) {
- super(message);
- }
-
- public CacheNameExistsException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public CacheNameExistsException(Throwable cause) {
- super(cause);
- }
-}
Modified: core/branches/flat/src/main/java/org/horizon/manager/DefaultCacheManager.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/manager/DefaultCacheManager.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/manager/DefaultCacheManager.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -25,6 +25,7 @@
import org.horizon.CacheSPI;
import org.horizon.config.Configuration;
import org.horizon.config.ConfigurationException;
+import org.horizon.config.DuplicateCacheNameException;
import org.horizon.config.GlobalConfiguration;
import org.horizon.config.parsing.XmlConfigurationParser;
import org.horizon.config.parsing.XmlConfigurationParserImpl;
@@ -37,6 +38,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -249,15 +251,15 @@
*
* @param cacheName name of cache to define
* @param configurationOverride configuration overrides to use
- * @throws CacheNameExistsException if the name is already in use.
+ * @throws DuplicateCacheNameException if the name is already in use.
*/
- public void defineCache(String cacheName, Configuration configurationOverride) throws CacheNameExistsException {
+ public void defineCache(String cacheName, Configuration configurationOverride) throws DuplicateCacheNameException {
if (cacheName == null || configurationOverrides == null)
throw new NullPointerException("Null arguments not allowed");
if (cacheName.equals(DEFAULT_CACHE_NAME))
throw new IllegalArgumentException("Cache name cannot be used as it is a reserved, internal name");
if (configurationOverrides.putIfAbsent(cacheName, configurationOverride) != null)
- throw new CacheNameExistsException("Cache name [" + cacheName + "] already in use!");
+ throw new DuplicateCacheNameException("Cache name [" + cacheName + "] already in use!");
}
@@ -298,12 +300,16 @@
return globalConfiguration.getClusterName();
}
+ @SuppressWarnings("unchecked")
public List<Address> getMembers() {
- return globalComponentRegistry.getComponent(RPCManager.class).getMembers();
+ RPCManager rpcManager = globalComponentRegistry.getComponent(RPCManager.class);
+ List l = rpcManager == null ? Collections.emptyList() : rpcManager.getMembers();
+ return l;
}
public Address getAddress() {
- return globalComponentRegistry.getComponent(RPCManager.class).getAddress();
+ RPCManager rpcManager = globalComponentRegistry.getComponent(RPCManager.class);
+ return rpcManager == null ? null : rpcManager.getAddress();
}
private Cache createCache(String cacheName) {
Deleted: core/branches/flat/src/main/java/org/horizon/marshall/CacheMarshallerStarobrno.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/marshall/CacheMarshallerStarobrno.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/marshall/CacheMarshallerStarobrno.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -1,794 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.horizon.marshall;
-
-import org.horizon.CacheException;
-import org.horizon.atomic.DeltaAware;
-import org.horizon.commands.RemoteCommandFactory;
-import org.horizon.commands.ReplicableCommand;
-import org.horizon.io.ByteBuffer;
-import org.horizon.io.ExposedByteArrayOutputStream;
-import org.horizon.logging.Log;
-import org.horizon.logging.LogFactory;
-import org.horizon.remoting.transport.Address;
-import org.horizon.remoting.transport.jgroups.JGroupsAddress;
-import org.horizon.transaction.GlobalTransaction;
-import org.horizon.util.FastCopyHashMap;
-import org.horizon.util.Immutables;
-import org.jboss.util.NotImplementedException;
-import org.jboss.util.stream.MarshalledValueInputStream;
-
-import java.io.ByteArrayInputStream;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.util.*;
-
-/**
- * Abstract AbstractMarshaller for JBoss Cache.
- *
- * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
- * @since 1.0
- */
-public class CacheMarshallerStarobrno implements Marshaller {
- // magic numbers
- protected static final int MAGICNUMBER_METHODCALL = 1;
- protected static final int MAGICNUMBER_FQN = 2;
- protected static final int MAGICNUMBER_GTX = 3;
- protected static final int MAGICNUMBER_JG_ADDRESS = 4;
- protected static final int MAGICNUMBER_ARRAY_LIST = 5;
- protected static final int MAGICNUMBER_INTEGER = 6;
- protected static final int MAGICNUMBER_LONG = 7;
- protected static final int MAGICNUMBER_BOOLEAN = 8;
- protected static final int MAGICNUMBER_STRING = 9;
- protected static final int MAGICNUMBER_DEFAULT_DATA_VERSION = 10;
- protected static final int MAGICNUMBER_LINKED_LIST = 11;
- protected static final int MAGICNUMBER_HASH_MAP = 12;
- protected static final int MAGICNUMBER_TREE_MAP = 13;
- protected static final int MAGICNUMBER_HASH_SET = 14;
- protected static final int MAGICNUMBER_TREE_SET = 15;
- protected static final int MAGICNUMBER_NODEDATA_MARKER = 16;
- protected static final int MAGICNUMBER_NODEDATA_EXCEPTION_MARKER = 17;
- protected static final int MAGICNUMBER_NODEDATA = 18;
- protected static final int MAGICNUMBER_GRAVITATERESULT = 19;
- protected static final int MAGICNUMBER_SHORT = 20;
- protected static final int MAGICNUMBER_IMMUTABLE_MAPCOPY = 21;
- protected static final int MAGICNUMBER_MARSHALLEDVALUE = 22;
- protected static final int MAGICNUMBER_FASTCOPY_HASHMAP = 23;
- protected static final int MAGICNUMBER_ARRAY = 24;
- protected static final int MAGICNUMBER_BYTE = 25;
- protected static final int MAGICNUMBER_CHAR = 26;
- protected static final int MAGICNUMBER_FLOAT = 27;
- protected static final int MAGICNUMBER_DOUBLE = 28;
- protected static final int MAGICNUMBER_OBJECT = 29;
- protected static final int MAGICNUMBER_NULL = 99;
- protected static final int MAGICNUMBER_SERIALIZABLE = 100;
-
- protected static final int MAGICNUMBER_REF = 101;
-
- public CacheMarshallerStarobrno() {
- initLogger();
- // enabled, since this is always enabled in JBC 2.0.0.
- useRefs = false;
- }
-
- protected Log log;
- protected boolean trace;
- private RemoteCommandFactory remoteCommandFactory;
- protected ClassLoader defaultClassLoader;
- protected boolean useRefs = false;
-
- public void init(ClassLoader defaultClassLoader) {
- this.defaultClassLoader = defaultClassLoader;
- }
-
- protected void initLogger() {
- log = LogFactory.getLog(getClass());
- trace = log.isTraceEnabled();
- }
-
- // implement the basic contract set in RPCDispatcher.AbstractMarshaller
- public byte[] objectToByteBuffer(Object obj) throws Exception {
- ByteBuffer b = objectToBuffer(obj);
- byte[] bytes = new byte[b.getLength()];
- System.arraycopy(b.getBuf(), b.getOffset(), bytes, 0, b.getLength());
- return bytes;
- }
-
- protected void marshallObject(Object o, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
- if (o != null && o.getClass().isArray() && isKnownType(o.getClass().getComponentType())) {
- marshallArray(o, out, refMap);
- } else {
- if (o == null) {
- out.writeByte(MAGICNUMBER_NULL);
- } else if (useRefs && refMap.containsKey(o))// see if this object has been marshalled before.
- {
- out.writeByte(MAGICNUMBER_REF);
- writeReference(out, refMap.get(o));
- } else if (o instanceof ReplicableCommand) {
- ReplicableCommand command = (ReplicableCommand) o;
-
- if (command.getCommandId() > -1) {
- out.writeByte(MAGICNUMBER_METHODCALL);
- marshallCommand(command, out, refMap);
- } else {
- throw new IllegalArgumentException("MethodCall does not have a valid method id. Was this method call created with MethodCallFactory?");
- }
- } else if (o instanceof MarshalledValue) {
- out.writeByte(MAGICNUMBER_MARSHALLEDVALUE);
- ((MarshalledValue) o).writeExternal(out);
- } else if (o instanceof DeltaAware) {
- // reading in should be nothing special.
- out.writeByte(MAGICNUMBER_SERIALIZABLE);
- // only write the delta for these maps.
- out.writeObject(((DeltaAware) o).delta());
- } else if (o instanceof GlobalTransaction) {
- out.writeByte(MAGICNUMBER_GTX);
- if (useRefs) writeReference(out, createReference(o, refMap));
- marshallGlobalTransaction((GlobalTransaction) o, out, refMap);
- } else if (o instanceof JGroupsAddress) {
- out.writeByte(MAGICNUMBER_JG_ADDRESS);
- marshallJGroupsAddress((JGroupsAddress) o, out);
- } else if (o.getClass().equals(ArrayList.class)) {
- out.writeByte(MAGICNUMBER_ARRAY_LIST);
- marshallCollection((Collection) o, out, refMap);
- } else if (o instanceof LinkedList) {
- out.writeByte(MAGICNUMBER_LINKED_LIST);
- marshallCollection((Collection) o, out, refMap);
- } else if (o.getClass().equals(HashMap.class)) {
- out.writeByte(MAGICNUMBER_HASH_MAP);
- marshallMap((Map) o, out, refMap);
- } else if (o.getClass().equals(TreeMap.class)) {
- out.writeByte(MAGICNUMBER_TREE_MAP);
- marshallMap((Map) o, out, refMap);
- } else if (o.getClass().equals(FastCopyHashMap.class)) {
- out.writeByte(MAGICNUMBER_FASTCOPY_HASHMAP);
- marshallMap((Map) o, out, refMap);
- } else if (o instanceof Map && Immutables.isImmutable(o)) {
- out.writeByte(MAGICNUMBER_IMMUTABLE_MAPCOPY);
- marshallMap((Map) o, out, refMap);
- } else if (o.getClass().equals(HashSet.class)) {
- out.writeByte(MAGICNUMBER_HASH_SET);
- marshallCollection((Collection) o, out, refMap);
- } else if (o.getClass().equals(TreeSet.class)) {
- out.writeByte(MAGICNUMBER_TREE_SET);
- marshallCollection((Collection) o, out, refMap);
- } else if (o instanceof Boolean) {
- out.writeByte(MAGICNUMBER_BOOLEAN);
- out.writeBoolean(((Boolean) o).booleanValue());
- } else if (o instanceof Integer) {
- out.writeByte(MAGICNUMBER_INTEGER);
- out.writeInt(((Integer) o).intValue());
- } else if (o instanceof Long) {
- out.writeByte(MAGICNUMBER_LONG);
- out.writeLong(((Long) o).longValue());
- } else if (o instanceof Short) {
- out.writeByte(MAGICNUMBER_SHORT);
- out.writeShort(((Short) o).shortValue());
- } else if (o instanceof String) {
- out.writeByte(MAGICNUMBER_STRING);
- if (useRefs) writeReference(out, createReference(o, refMap));
- marshallString((String) o, out);
- } else if (o instanceof NodeDataMarker) {
- out.writeByte(MAGICNUMBER_NODEDATA_MARKER);
- ((Externalizable) o).writeExternal(out);
- } else if (o instanceof NodeDataExceptionMarker) {
- out.writeByte(MAGICNUMBER_NODEDATA_EXCEPTION_MARKER);
- ((Externalizable) o).writeExternal(out);
- } else if (o instanceof NodeData) {
- out.writeByte(MAGICNUMBER_NODEDATA);
- ((Externalizable) o).writeExternal(out);
- } else if (o instanceof Serializable) {
- if (trace) {
- log.trace("Warning: using object serialization for " + o.getClass());
- }
- out.writeByte(MAGICNUMBER_SERIALIZABLE);
- if (useRefs) writeReference(out, createReference(o, refMap));
- out.writeObject(o);
- } else {
- throw new Exception("Don't know how to marshall object of type " + o.getClass());
- }
- }
- }
-
-
- protected void marshallString(String s, ObjectOutputStream out) throws Exception {
- //StringUtil.saveString(out, s);
- out.writeObject(s);
- }
-
- private void marshallCommand(ReplicableCommand command, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
- out.writeShort(command.getCommandId());
- Object[] args = command.getParameters();
- byte numArgs = (byte) (args == null ? 0 : args.length);
- out.writeByte(numArgs);
-
- for (int i = 0; i < numArgs; i++) {
- marshallObject(args[i], out, refMap);
- }
- }
-
- private int createReference(Object o, Map<Object, Integer> refMap) {
- int reference = refMap.size();
- refMap.put(o, reference);
- return reference;
- }
-
- private void marshallGlobalTransaction(GlobalTransaction globalTransaction, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
- out.writeLong(globalTransaction.getId());
- marshallObject(globalTransaction.getAddress(), out, refMap);
- }
-
- private void marshallJGroupsAddress(JGroupsAddress address, ObjectOutputStream out) throws Exception {
- address.writeExternal(out);
- }
-
- @SuppressWarnings("unchecked")
- private void marshallCollection(Collection c, ObjectOutputStream out, Map refMap) throws Exception {
- writeUnsignedInt(out, c.size());
- for (Object o : c) {
- marshallObject(o, out, refMap);
- }
- }
-
- @SuppressWarnings("unchecked")
- private void marshallMap(Map map, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
- int mapSize = map.size();
- writeUnsignedInt(out, mapSize);
- if (mapSize == 0) return;
-
- for (Map.Entry me : (Set<Map.Entry>) map.entrySet()) {
- marshallObject(me.getKey(), out, refMap);
- marshallObject(me.getValue(), out, refMap);
- }
- }
-
- // --------- Unmarshalling methods
-
- protected Object unmarshallObject(ObjectInputStream in, ClassLoader loader, UnmarshalledReferences refMap, boolean overrideContextClassloaderOnThread) throws Exception {
- if (loader == null) {
- return unmarshallObject(in, refMap);
- } else {
- Thread currentThread = Thread.currentThread();
- ClassLoader old = currentThread.getContextClassLoader();
- try {
- // only do this if we haven't already set a context class loader elsewhere.
- if (overrideContextClassloaderOnThread || old == null) currentThread.setContextClassLoader(loader);
- return unmarshallObject(in, refMap);
- }
- finally {
- if (overrideContextClassloaderOnThread || old == null) currentThread.setContextClassLoader(old);
- }
- }
- }
-
- protected Object unmarshallObject(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- byte magicNumber = in.readByte();
- int reference = 0;
- Object retVal;
- switch (magicNumber) {
- case MAGICNUMBER_NULL:
- return null;
- case MAGICNUMBER_REF:
- if (useRefs) {
- reference = readReference(in);
- return refMap.getReferencedObject(reference);
- } else break;
- case MAGICNUMBER_SERIALIZABLE:
- if (useRefs) reference = readReference(in);
- retVal = in.readObject();
- if (useRefs) refMap.putReferencedObject(reference, retVal);
- return retVal;
- case MAGICNUMBER_MARSHALLEDVALUE:
- MarshalledValue mv = new MarshalledValue();
- mv.readExternal(in);
- return mv;
- case MAGICNUMBER_METHODCALL:
- retVal = unmarshallCommand(in, refMap);
- return retVal;
- case MAGICNUMBER_GTX:
- if (useRefs) reference = readReference(in);
- retVal = unmarshallGlobalTransaction(in, refMap);
- if (useRefs) refMap.putReferencedObject(reference, retVal);
- return retVal;
- case MAGICNUMBER_JG_ADDRESS:
- retVal = unmarshallJGroupsAddress(in);
- return retVal;
- case MAGICNUMBER_ARRAY:
- return unmarshallArray(in, refMap);
- case MAGICNUMBER_ARRAY_LIST:
- return unmarshallArrayList(in, refMap);
- case MAGICNUMBER_LINKED_LIST:
- return unmarshallLinkedList(in, refMap);
- case MAGICNUMBER_HASH_MAP:
- return unmarshallHashMap(in, refMap);
- case MAGICNUMBER_TREE_MAP:
- return unmarshallTreeMap(in, refMap);
- case MAGICNUMBER_HASH_SET:
- return unmarshallHashSet(in, refMap);
- case MAGICNUMBER_TREE_SET:
- return unmarshallTreeSet(in, refMap);
- case MAGICNUMBER_IMMUTABLE_MAPCOPY:
- return unmarshallMapCopy(in, refMap);
- case MAGICNUMBER_FASTCOPY_HASHMAP:
- return unmarshallFastCopyHashMap(in, refMap);
- case MAGICNUMBER_BOOLEAN:
- return in.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
- case MAGICNUMBER_INTEGER:
- return in.readInt();
- case MAGICNUMBER_LONG:
- return in.readLong();
- case MAGICNUMBER_SHORT:
- return in.readShort();
- case MAGICNUMBER_STRING:
- if (useRefs) reference = readReference(in);
- retVal = unmarshallString(in);
- if (useRefs) refMap.putReferencedObject(reference, retVal);
- return retVal;
- case MAGICNUMBER_NODEDATA_MARKER:
- retVal = new NodeDataMarker();
- ((NodeDataMarker) retVal).readExternal(in);
- return retVal;
- case MAGICNUMBER_NODEDATA_EXCEPTION_MARKER:
- retVal = new NodeDataExceptionMarker();
- ((NodeDataExceptionMarker) retVal).readExternal(in);
- return retVal;
- case MAGICNUMBER_NODEDATA:
- retVal = new NodeData();
- ((NodeData) retVal).readExternal(in);
- return retVal;
- default:
- if (log.isErrorEnabled()) {
- log.error("Unknown Magic Number " + magicNumber);
- }
- throw new Exception("Unknown magic number " + magicNumber);
- }
- throw new Exception("Unknown magic number " + magicNumber);
- }
-
- private FastCopyHashMap unmarshallFastCopyHashMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- FastCopyHashMap map = new FastCopyHashMap();
- populateFromStream(in, refMap, map);
- return map;
- }
-
- protected String unmarshallString(ObjectInputStream in) throws Exception {
- return (String) in.readObject();
- }
-
- private ReplicableCommand unmarshallCommand(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- short methodId = in.readShort();
- byte numArgs = in.readByte();
- Object[] args = null;
-
- if (numArgs > 0) {
- args = new Object[numArgs];
- for (int i = 0; i < numArgs; i++) args[i] = unmarshallObject(in, refMap);
- }
-
- return remoteCommandFactory.fromStream((byte) methodId, args);
- }
-
-
- private GlobalTransaction unmarshallGlobalTransaction(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- GlobalTransaction gtx = new GlobalTransaction();
- long id = in.readLong();
- Object address = unmarshallObject(in, refMap);
- gtx.setId(id);
- gtx.setAddress((Address) address);
- return gtx;
- }
-
- private JGroupsAddress unmarshallJGroupsAddress(ObjectInputStream in) throws Exception {
- JGroupsAddress address = new JGroupsAddress();
- address.readExternal(in);
- return address;
- }
-
- private List unmarshallArrayList(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- int listSize = readUnsignedInt(in);
- List list = new ArrayList(listSize);
- populateFromStream(in, refMap, list, listSize);
- return list;
- }
-
- private List unmarshallLinkedList(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- List list = new LinkedList();
- populateFromStream(in, refMap, list, readUnsignedInt(in));
- return list;
- }
-
- private Map unmarshallHashMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- Map map = new HashMap();
- populateFromStream(in, refMap, map);
- return map;
- }
-
- @SuppressWarnings("unchecked")
- private Map unmarshallMapCopy(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- // read in as a HashMap first
- Map m = unmarshallHashMap(in, refMap);
- return Immutables.immutableMapWrap(m);
- }
-
- private Map unmarshallTreeMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- Map map = new TreeMap();
- populateFromStream(in, refMap, map);
- return map;
- }
-
- private Set unmarshallHashSet(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- Set set = new HashSet();
- populateFromStream(in, refMap, set);
- return set;
- }
-
- private Set unmarshallTreeSet(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
- Set set = new TreeSet();
- populateFromStream(in, refMap, set);
- return set;
- }
-
- @SuppressWarnings("unchecked")
- private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Map mapToPopulate) throws Exception {
- int size = readUnsignedInt(in);
- for (int i = 0; i < size; i++) mapToPopulate.put(unmarshallObject(in, refMap), unmarshallObject(in, refMap));
- }
-
- @SuppressWarnings("unchecked")
- private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Set setToPopulate) throws Exception {
- int size = readUnsignedInt(in);
- for (int i = 0; i < size; i++) setToPopulate.add(unmarshallObject(in, refMap));
- }
-
- @SuppressWarnings("unchecked")
- private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, List listToPopulate, int listSize) throws Exception {
- for (int i = 0; i < listSize; i++) listToPopulate.add(unmarshallObject(in, refMap));
- }
-
- /**
- * This version of writeReference is written to solve JBCACHE-1211, where references are encoded as ints rather than
- * shorts.
- *
- * @param out stream to write to
- * @param reference reference to write
- * @throws java.io.IOException propagated from OOS
- * @see <a href="http://jira.jboss.org/jira/browse/JBCACHE-1211">JBCACHE-1211</a>
- */
- protected void writeReference(ObjectOutputStream out, int reference) throws IOException {
- writeUnsignedInt(out, reference);
- }
-
- /**
- * This version of readReference is written to solve JBCACHE-1211, where references are encoded as ints rather than
- * shorts.
- *
- * @param in stream to read from
- * @return reference
- * @throws java.io.IOException propagated from OUS
- * @see <a href="http://jira.jboss.org/jira/browse/JBCACHE-1211">JBCACHE-1211</a>
- */
- protected int readReference(ObjectInputStream in) throws IOException {
- return readUnsignedInt(in);
- }
-
- /**
- * Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer
- * bytes. Negative numbers are not supported.
- */
- protected int readUnsignedInt(ObjectInputStream in) throws IOException {
- byte b = in.readByte();
- int i = b & 0x7F;
- for (int shift = 7; (b & 0x80) != 0; shift += 7) {
- b = in.readByte();
- i |= (b & 0x7FL) << shift;
- }
- return i;
- }
-
- /**
- * Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes.
- * Negative numbers are not supported.
- *
- * @param i int to write
- */
- protected void writeUnsignedInt(ObjectOutputStream out, int i) throws IOException {
- while ((i & ~0x7F) != 0) {
- out.writeByte((byte) ((i & 0x7f) | 0x80));
- i >>>= 7;
- }
- out.writeByte((byte) i);
- }
-
-
- /**
- * Reads an int stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer
- * bytes. Negative numbers are not supported.
- */
- protected long readUnsignedLong(ObjectInputStream in) throws IOException {
- byte b = in.readByte();
- long i = b & 0x7F;
- for (int shift = 7; (b & 0x80) != 0; shift += 7) {
- b = in.readByte();
- i |= (b & 0x7FL) << shift;
- }
- return i;
- }
-
- /**
- * Writes an int in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes.
- * Negative numbers are not supported.
- *
- * @param i int to write
- */
- protected void writeUnsignedLong(ObjectOutputStream out, long i) throws IOException {
- while ((i & ~0x7F) != 0) {
- out.writeByte((byte) ((i & 0x7f) | 0x80));
- i >>>= 7;
- }
- out.writeByte((byte) i);
- }
-
- protected Object unmarshallArray(ObjectInputStream in, UnmarshalledReferences refs) throws Exception {
- int sz = readUnsignedInt(in);
- byte type = in.readByte();
- switch (type) {
- case MAGICNUMBER_BOOLEAN: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- boolean[] a = new boolean[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readBoolean();
- return a;
- } else {
- Boolean[] a = new Boolean[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readBoolean();
- return a;
- }
- }
- case MAGICNUMBER_INTEGER: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- int[] a = new int[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readInt();
- return a;
- } else {
- Integer[] a = new Integer[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readInt();
- return a;
- }
- }
- case MAGICNUMBER_LONG: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- long[] a = new long[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readLong();
- return a;
- } else {
- Long[] a = new Long[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readLong();
- return a;
- }
- }
- case MAGICNUMBER_CHAR: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- char[] a = new char[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readChar();
- return a;
- } else {
- Character[] a = new Character[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readChar();
- return a;
- }
- }
- case MAGICNUMBER_BYTE: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- byte[] a = new byte[sz];
- int bsize = 10240;
- int offset = 0;
- int bytesLeft = sz;
- while (bytesLeft > 0) {
- int read = in.read(a, offset, Math.min(bsize, bytesLeft));
- offset += read;
- bytesLeft -= read;
- }
- return a;
- } else {
- Byte[] a = new Byte[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readByte();
- return a;
- }
- }
- case MAGICNUMBER_SHORT: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- short[] a = new short[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readShort();
- return a;
- } else {
- Short[] a = new Short[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readShort();
- return a;
- }
- }
- case MAGICNUMBER_FLOAT: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- float[] a = new float[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readFloat();
- return a;
- } else {
- Float[] a = new Float[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readFloat();
- return a;
- }
- }
- case MAGICNUMBER_DOUBLE: {
- boolean isPrim = in.readBoolean();
- if (isPrim) {
- double[] a = new double[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readDouble();
- return a;
- } else {
- Double[] a = new Double[sz];
- for (int i = 0; i < sz; i++) a[i] = in.readDouble();
- return a;
- }
- }
- case MAGICNUMBER_OBJECT: {
- Object[] a = new Object[sz];
- for (int i = 0; i < sz; i++) a[i] = unmarshallObject(in, refs);
- return a;
- }
- default:
- throw new CacheException("Unknown array type");
- }
- }
-
- protected void marshallArray(Object o, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
- out.writeByte(MAGICNUMBER_ARRAY);
- Class arrayTypeClass = o.getClass().getComponentType();
- int sz = Array.getLength(o);
- writeUnsignedInt(out, sz);
- boolean isPrim = arrayTypeClass.isPrimitive();
-
- if (!isPrim && arrayTypeClass.equals(Object.class)) {
- out.writeByte(MAGICNUMBER_OBJECT);
- for (int i = 0; i < sz; i++) marshallObject(Array.get(o, i), out, refMap);
- } else if (arrayTypeClass.equals(byte.class) || arrayTypeClass.equals(Byte.class)) {
- out.writeByte(MAGICNUMBER_BYTE);
- out.writeBoolean(isPrim);
- if (isPrim)
- out.write((byte[]) o);
- else
- for (int i = 0; i < sz; i++) out.writeByte((Byte) Array.get(o, i));
- } else if (arrayTypeClass.equals(int.class) || arrayTypeClass.equals(Integer.class)) {
- out.writeByte(MAGICNUMBER_INTEGER);
- out.writeBoolean(isPrim);
- if (isPrim)
- for (int i = 0; i < sz; i++) out.writeInt(Array.getInt(o, i));
- else
- for (int i = 0; i < sz; i++) out.writeInt((Integer) Array.get(o, i));
- } else if (arrayTypeClass.equals(long.class) || arrayTypeClass.equals(Long.class)) {
- out.writeByte(MAGICNUMBER_LONG);
- out.writeBoolean(isPrim);
- if (isPrim)
- for (int i = 0; i < sz; i++) out.writeLong(Array.getLong(o, i));
- else
- for (int i = 0; i < sz; i++) out.writeLong((Long) Array.get(o, i));
- } else if (arrayTypeClass.equals(boolean.class) || arrayTypeClass.equals(Boolean.class)) {
- out.writeByte(MAGICNUMBER_BOOLEAN);
- out.writeBoolean(isPrim);
- if (isPrim)
- for (int i = 0; i < sz; i++) out.writeBoolean(Array.getBoolean(o, i));
- else
- for (int i = 0; i < sz; i++) out.writeBoolean((Boolean) Array.get(o, i));
- } else if (arrayTypeClass.equals(char.class) || arrayTypeClass.equals(Character.class)) {
- out.writeByte(MAGICNUMBER_CHAR);
- out.writeBoolean(isPrim);
- if (isPrim)
- for (int i = 0; i < sz; i++) out.writeChar(Array.getChar(o, i));
- else
- for (int i = 0; i < sz; i++) out.writeChar((Character) Array.get(o, i));
- } else if (arrayTypeClass.equals(short.class) || arrayTypeClass.equals(Short.class)) {
- out.writeByte(MAGICNUMBER_SHORT);
- out.writeBoolean(isPrim);
- if (isPrim)
- for (int i = 0; i < sz; i++) out.writeShort(Array.getShort(o, i));
- else
- for (int i = 0; i < sz; i++) out.writeShort((Short) Array.get(o, i));
- } else if (arrayTypeClass.equals(float.class) || arrayTypeClass.equals(Float.class)) {
- out.writeByte(MAGICNUMBER_FLOAT);
- out.writeBoolean(isPrim);
- if (isPrim)
- for (int i = 0; i < sz; i++) out.writeFloat(Array.getFloat(o, i));
- else
- for (int i = 0; i < sz; i++) out.writeFloat((Float) Array.get(o, i));
- } else if (arrayTypeClass.equals(double.class) || arrayTypeClass.equals(Double.class)) {
- out.writeByte(MAGICNUMBER_DOUBLE);
- out.writeBoolean(isPrim);
- if (isPrim)
- for (int i = 0; i < sz; i++) out.writeDouble(Array.getDouble(o, i));
- else
- for (int i = 0; i < sz; i++) out.writeDouble((Double) Array.get(o, i));
- } else throw new CacheException("Unknown array type!");
- }
-
- protected boolean isKnownType(Class c) {
- return (c.equals(Object.class) ||
- c.isPrimitive() || c.equals(Character.class) || c.equals(Integer.class) || c.equals(Long.class) ||
- c.equals(Byte.class) || c.equals(Boolean.class) || c.equals(Short.class) || c.equals(Float.class) ||
- c.equals(Double.class));
- }
-
- public void objectToObjectStream(Object o, ObjectOutputStream out) throws Exception {
- Map<Object, Integer> refMap = useRefs ? new IdentityHashMap<Object, Integer>() : null;
- ClassLoader toUse = defaultClassLoader;
- Thread current = Thread.currentThread();
- ClassLoader old = current.getContextClassLoader();
- if (old != null) toUse = old;
-
- try {
- current.setContextClassLoader(toUse);
- marshallObject(o, out, refMap);
- }
- finally {
- current.setContextClassLoader(old);
- }
- }
-
- public Object objectFromObjectStream(ObjectInputStream in) throws Exception {
- UnmarshalledReferences refMap = useRefs ? new UnmarshalledReferences() : null;
- Object retValue = unmarshallObject(in, defaultClassLoader, refMap, false);
- if (trace) log.trace("Unmarshalled object " + retValue);
- return retValue;
- }
-
- public Object objectFromStream(InputStream is) throws Exception {
- throw new NotImplementedException("not implemented");
- }
-
- public ByteBuffer objectToBuffer(Object o) throws Exception {
- ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(128);
- ObjectOutputStream out = new ObjectOutputStream(baos);
-
- //now marshall the contents of the object
- objectToObjectStream(o, out);
- out.close();
- // and return bytes.
- return new ByteBuffer(baos.getRawBuffer(), 0, baos.size());
- }
-
- public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws Exception {
- ObjectInputStream in = new MarshalledValueInputStream(new ByteArrayInputStream(buf, offset, length));
- return objectFromObjectStream(in);
- }
-
- public Object objectFromByteBuffer(byte[] bytes) throws Exception {
- return objectFromByteBuffer(bytes, 0, bytes.length);
- }
-}
\ No newline at end of file
Copied: core/branches/flat/src/main/java/org/horizon/marshall/HorizonMarshaller.java (from rev 7593, core/branches/flat/src/main/java/org/horizon/marshall/CacheMarshallerStarobrno.java)
===================================================================
--- core/branches/flat/src/main/java/org/horizon/marshall/HorizonMarshaller.java (rev 0)
+++ core/branches/flat/src/main/java/org/horizon/marshall/HorizonMarshaller.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -0,0 +1,794 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.horizon.marshall;
+
+import org.horizon.CacheException;
+import org.horizon.atomic.DeltaAware;
+import org.horizon.commands.RemoteCommandFactory;
+import org.horizon.commands.ReplicableCommand;
+import org.horizon.io.ByteBuffer;
+import org.horizon.io.ExposedByteArrayOutputStream;
+import org.horizon.logging.Log;
+import org.horizon.logging.LogFactory;
+import org.horizon.remoting.transport.Address;
+import org.horizon.remoting.transport.jgroups.JGroupsAddress;
+import org.horizon.transaction.GlobalTransaction;
+import org.horizon.util.FastCopyHashMap;
+import org.horizon.util.Immutables;
+import org.jboss.util.NotImplementedException;
+import org.jboss.util.stream.MarshalledValueInputStream;
+
+import java.io.ByteArrayInputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.*;
+
+/**
+ * Abstract AbstractMarshaller for JBoss Cache.
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
+ * @since 1.0
+ */
+public class HorizonMarshaller implements Marshaller {
+ // magic numbers
+ protected static final int MAGICNUMBER_METHODCALL = 1;
+ protected static final int MAGICNUMBER_FQN = 2;
+ protected static final int MAGICNUMBER_GTX = 3;
+ protected static final int MAGICNUMBER_JG_ADDRESS = 4;
+ protected static final int MAGICNUMBER_ARRAY_LIST = 5;
+ protected static final int MAGICNUMBER_INTEGER = 6;
+ protected static final int MAGICNUMBER_LONG = 7;
+ protected static final int MAGICNUMBER_BOOLEAN = 8;
+ protected static final int MAGICNUMBER_STRING = 9;
+ protected static final int MAGICNUMBER_DEFAULT_DATA_VERSION = 10;
+ protected static final int MAGICNUMBER_LINKED_LIST = 11;
+ protected static final int MAGICNUMBER_HASH_MAP = 12;
+ protected static final int MAGICNUMBER_TREE_MAP = 13;
+ protected static final int MAGICNUMBER_HASH_SET = 14;
+ protected static final int MAGICNUMBER_TREE_SET = 15;
+ protected static final int MAGICNUMBER_NODEDATA_MARKER = 16;
+ protected static final int MAGICNUMBER_NODEDATA_EXCEPTION_MARKER = 17;
+ protected static final int MAGICNUMBER_NODEDATA = 18;
+ protected static final int MAGICNUMBER_GRAVITATERESULT = 19;
+ protected static final int MAGICNUMBER_SHORT = 20;
+ protected static final int MAGICNUMBER_IMMUTABLE_MAPCOPY = 21;
+ protected static final int MAGICNUMBER_MARSHALLEDVALUE = 22;
+ protected static final int MAGICNUMBER_FASTCOPY_HASHMAP = 23;
+ protected static final int MAGICNUMBER_ARRAY = 24;
+ protected static final int MAGICNUMBER_BYTE = 25;
+ protected static final int MAGICNUMBER_CHAR = 26;
+ protected static final int MAGICNUMBER_FLOAT = 27;
+ protected static final int MAGICNUMBER_DOUBLE = 28;
+ protected static final int MAGICNUMBER_OBJECT = 29;
+ protected static final int MAGICNUMBER_NULL = 99;
+ protected static final int MAGICNUMBER_SERIALIZABLE = 100;
+
+ protected static final int MAGICNUMBER_REF = 101;
+
+ public HorizonMarshaller() {
+ initLogger();
+ // enabled, since this is always enabled in JBC 2.0.0.
+ useRefs = false;
+ }
+
+ protected Log log;
+ protected boolean trace;
+ private RemoteCommandFactory remoteCommandFactory;
+ protected ClassLoader defaultClassLoader;
+ protected boolean useRefs = false;
+
+ public void init(ClassLoader defaultClassLoader) {
+ this.defaultClassLoader = defaultClassLoader;
+ }
+
+ protected void initLogger() {
+ log = LogFactory.getLog(getClass());
+ trace = log.isTraceEnabled();
+ }
+
+ // implement the basic contract set in RPCDispatcher.AbstractMarshaller
+ public byte[] objectToByteBuffer(Object obj) throws Exception {
+ ByteBuffer b = objectToBuffer(obj);
+ byte[] bytes = new byte[b.getLength()];
+ System.arraycopy(b.getBuf(), b.getOffset(), bytes, 0, b.getLength());
+ return bytes;
+ }
+
+ protected void marshallObject(Object o, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
+ if (o != null && o.getClass().isArray() && isKnownType(o.getClass().getComponentType())) {
+ marshallArray(o, out, refMap);
+ } else {
+ if (o == null) {
+ out.writeByte(MAGICNUMBER_NULL);
+ } else if (useRefs && refMap.containsKey(o))// see if this object has been marshalled before.
+ {
+ out.writeByte(MAGICNUMBER_REF);
+ writeReference(out, refMap.get(o));
+ } else if (o instanceof ReplicableCommand) {
+ ReplicableCommand command = (ReplicableCommand) o;
+
+ if (command.getCommandId() > -1) {
+ out.writeByte(MAGICNUMBER_METHODCALL);
+ marshallCommand(command, out, refMap);
+ } else {
+ throw new IllegalArgumentException("MethodCall does not have a valid method id. Was this method call created with MethodCallFactory?");
+ }
+ } else if (o instanceof MarshalledValue) {
+ out.writeByte(MAGICNUMBER_MARSHALLEDVALUE);
+ ((MarshalledValue) o).writeExternal(out);
+ } else if (o instanceof DeltaAware) {
+ // reading in should be nothing special.
+ out.writeByte(MAGICNUMBER_SERIALIZABLE);
+ // only write the delta for these maps.
+ out.writeObject(((DeltaAware) o).delta());
+ } else if (o instanceof GlobalTransaction) {
+ out.writeByte(MAGICNUMBER_GTX);
+ if (useRefs) writeReference(out, createReference(o, refMap));
+ marshallGlobalTransaction((GlobalTransaction) o, out, refMap);
+ } else if (o instanceof JGroupsAddress) {
+ out.writeByte(MAGICNUMBER_JG_ADDRESS);
+ marshallJGroupsAddress((JGroupsAddress) o, out);
+ } else if (o.getClass().equals(ArrayList.class)) {
+ out.writeByte(MAGICNUMBER_ARRAY_LIST);
+ marshallCollection((Collection) o, out, refMap);
+ } else if (o instanceof LinkedList) {
+ out.writeByte(MAGICNUMBER_LINKED_LIST);
+ marshallCollection((Collection) o, out, refMap);
+ } else if (o.getClass().equals(HashMap.class)) {
+ out.writeByte(MAGICNUMBER_HASH_MAP);
+ marshallMap((Map) o, out, refMap);
+ } else if (o.getClass().equals(TreeMap.class)) {
+ out.writeByte(MAGICNUMBER_TREE_MAP);
+ marshallMap((Map) o, out, refMap);
+ } else if (o.getClass().equals(FastCopyHashMap.class)) {
+ out.writeByte(MAGICNUMBER_FASTCOPY_HASHMAP);
+ marshallMap((Map) o, out, refMap);
+ } else if (o instanceof Map && Immutables.isImmutable(o)) {
+ out.writeByte(MAGICNUMBER_IMMUTABLE_MAPCOPY);
+ marshallMap((Map) o, out, refMap);
+ } else if (o.getClass().equals(HashSet.class)) {
+ out.writeByte(MAGICNUMBER_HASH_SET);
+ marshallCollection((Collection) o, out, refMap);
+ } else if (o.getClass().equals(TreeSet.class)) {
+ out.writeByte(MAGICNUMBER_TREE_SET);
+ marshallCollection((Collection) o, out, refMap);
+ } else if (o instanceof Boolean) {
+ out.writeByte(MAGICNUMBER_BOOLEAN);
+ out.writeBoolean(((Boolean) o).booleanValue());
+ } else if (o instanceof Integer) {
+ out.writeByte(MAGICNUMBER_INTEGER);
+ out.writeInt(((Integer) o).intValue());
+ } else if (o instanceof Long) {
+ out.writeByte(MAGICNUMBER_LONG);
+ out.writeLong(((Long) o).longValue());
+ } else if (o instanceof Short) {
+ out.writeByte(MAGICNUMBER_SHORT);
+ out.writeShort(((Short) o).shortValue());
+ } else if (o instanceof String) {
+ out.writeByte(MAGICNUMBER_STRING);
+ if (useRefs) writeReference(out, createReference(o, refMap));
+ marshallString((String) o, out);
+ } else if (o instanceof NodeDataMarker) {
+ out.writeByte(MAGICNUMBER_NODEDATA_MARKER);
+ ((Externalizable) o).writeExternal(out);
+ } else if (o instanceof NodeDataExceptionMarker) {
+ out.writeByte(MAGICNUMBER_NODEDATA_EXCEPTION_MARKER);
+ ((Externalizable) o).writeExternal(out);
+ } else if (o instanceof NodeData) {
+ out.writeByte(MAGICNUMBER_NODEDATA);
+ ((Externalizable) o).writeExternal(out);
+ } else if (o instanceof Serializable) {
+ if (trace) {
+ log.trace("Warning: using object serialization for " + o.getClass());
+ }
+ out.writeByte(MAGICNUMBER_SERIALIZABLE);
+ if (useRefs) writeReference(out, createReference(o, refMap));
+ out.writeObject(o);
+ } else {
+ throw new Exception("Don't know how to marshall object of type " + o.getClass());
+ }
+ }
+ }
+
+
+ protected void marshallString(String s, ObjectOutputStream out) throws Exception {
+ //StringUtil.saveString(out, s);
+ out.writeObject(s);
+ }
+
+ private void marshallCommand(ReplicableCommand command, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
+ out.writeShort(command.getCommandId());
+ Object[] args = command.getParameters();
+ byte numArgs = (byte) (args == null ? 0 : args.length);
+ out.writeByte(numArgs);
+
+ for (int i = 0; i < numArgs; i++) {
+ marshallObject(args[i], out, refMap);
+ }
+ }
+
+ private int createReference(Object o, Map<Object, Integer> refMap) {
+ int reference = refMap.size();
+ refMap.put(o, reference);
+ return reference;
+ }
+
+ private void marshallGlobalTransaction(GlobalTransaction globalTransaction, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
+ out.writeLong(globalTransaction.getId());
+ marshallObject(globalTransaction.getAddress(), out, refMap);
+ }
+
+ private void marshallJGroupsAddress(JGroupsAddress address, ObjectOutputStream out) throws Exception {
+ address.writeExternal(out);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void marshallCollection(Collection c, ObjectOutputStream out, Map refMap) throws Exception {
+ writeUnsignedInt(out, c.size());
+ for (Object o : c) {
+ marshallObject(o, out, refMap);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void marshallMap(Map map, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
+ int mapSize = map.size();
+ writeUnsignedInt(out, mapSize);
+ if (mapSize == 0) return;
+
+ for (Map.Entry me : (Set<Map.Entry>) map.entrySet()) {
+ marshallObject(me.getKey(), out, refMap);
+ marshallObject(me.getValue(), out, refMap);
+ }
+ }
+
+ // --------- Unmarshalling methods
+
+ protected Object unmarshallObject(ObjectInputStream in, ClassLoader loader, UnmarshalledReferences refMap, boolean overrideContextClassloaderOnThread) throws Exception {
+ if (loader == null) {
+ return unmarshallObject(in, refMap);
+ } else {
+ Thread currentThread = Thread.currentThread();
+ ClassLoader old = currentThread.getContextClassLoader();
+ try {
+ // only do this if we haven't already set a context class loader elsewhere.
+ if (overrideContextClassloaderOnThread || old == null) currentThread.setContextClassLoader(loader);
+ return unmarshallObject(in, refMap);
+ }
+ finally {
+ if (overrideContextClassloaderOnThread || old == null) currentThread.setContextClassLoader(old);
+ }
+ }
+ }
+
+ protected Object unmarshallObject(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ byte magicNumber = in.readByte();
+ int reference = 0;
+ Object retVal;
+ switch (magicNumber) {
+ case MAGICNUMBER_NULL:
+ return null;
+ case MAGICNUMBER_REF:
+ if (useRefs) {
+ reference = readReference(in);
+ return refMap.getReferencedObject(reference);
+ } else break;
+ case MAGICNUMBER_SERIALIZABLE:
+ if (useRefs) reference = readReference(in);
+ retVal = in.readObject();
+ if (useRefs) refMap.putReferencedObject(reference, retVal);
+ return retVal;
+ case MAGICNUMBER_MARSHALLEDVALUE:
+ MarshalledValue mv = new MarshalledValue();
+ mv.readExternal(in);
+ return mv;
+ case MAGICNUMBER_METHODCALL:
+ retVal = unmarshallCommand(in, refMap);
+ return retVal;
+ case MAGICNUMBER_GTX:
+ if (useRefs) reference = readReference(in);
+ retVal = unmarshallGlobalTransaction(in, refMap);
+ if (useRefs) refMap.putReferencedObject(reference, retVal);
+ return retVal;
+ case MAGICNUMBER_JG_ADDRESS:
+ retVal = unmarshallJGroupsAddress(in);
+ return retVal;
+ case MAGICNUMBER_ARRAY:
+ return unmarshallArray(in, refMap);
+ case MAGICNUMBER_ARRAY_LIST:
+ return unmarshallArrayList(in, refMap);
+ case MAGICNUMBER_LINKED_LIST:
+ return unmarshallLinkedList(in, refMap);
+ case MAGICNUMBER_HASH_MAP:
+ return unmarshallHashMap(in, refMap);
+ case MAGICNUMBER_TREE_MAP:
+ return unmarshallTreeMap(in, refMap);
+ case MAGICNUMBER_HASH_SET:
+ return unmarshallHashSet(in, refMap);
+ case MAGICNUMBER_TREE_SET:
+ return unmarshallTreeSet(in, refMap);
+ case MAGICNUMBER_IMMUTABLE_MAPCOPY:
+ return unmarshallMapCopy(in, refMap);
+ case MAGICNUMBER_FASTCOPY_HASHMAP:
+ return unmarshallFastCopyHashMap(in, refMap);
+ case MAGICNUMBER_BOOLEAN:
+ return in.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
+ case MAGICNUMBER_INTEGER:
+ return in.readInt();
+ case MAGICNUMBER_LONG:
+ return in.readLong();
+ case MAGICNUMBER_SHORT:
+ return in.readShort();
+ case MAGICNUMBER_STRING:
+ if (useRefs) reference = readReference(in);
+ retVal = unmarshallString(in);
+ if (useRefs) refMap.putReferencedObject(reference, retVal);
+ return retVal;
+ case MAGICNUMBER_NODEDATA_MARKER:
+ retVal = new NodeDataMarker();
+ ((NodeDataMarker) retVal).readExternal(in);
+ return retVal;
+ case MAGICNUMBER_NODEDATA_EXCEPTION_MARKER:
+ retVal = new NodeDataExceptionMarker();
+ ((NodeDataExceptionMarker) retVal).readExternal(in);
+ return retVal;
+ case MAGICNUMBER_NODEDATA:
+ retVal = new NodeData();
+ ((NodeData) retVal).readExternal(in);
+ return retVal;
+ default:
+ if (log.isErrorEnabled()) {
+ log.error("Unknown Magic Number " + magicNumber);
+ }
+ throw new Exception("Unknown magic number " + magicNumber);
+ }
+ throw new Exception("Unknown magic number " + magicNumber);
+ }
+
+ private FastCopyHashMap unmarshallFastCopyHashMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ FastCopyHashMap map = new FastCopyHashMap();
+ populateFromStream(in, refMap, map);
+ return map;
+ }
+
+ protected String unmarshallString(ObjectInputStream in) throws Exception {
+ return (String) in.readObject();
+ }
+
+ private ReplicableCommand unmarshallCommand(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ short methodId = in.readShort();
+ byte numArgs = in.readByte();
+ Object[] args = null;
+
+ if (numArgs > 0) {
+ args = new Object[numArgs];
+ for (int i = 0; i < numArgs; i++) args[i] = unmarshallObject(in, refMap);
+ }
+
+ return remoteCommandFactory.fromStream((byte) methodId, args);
+ }
+
+
+ private GlobalTransaction unmarshallGlobalTransaction(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ GlobalTransaction gtx = new GlobalTransaction();
+ long id = in.readLong();
+ Object address = unmarshallObject(in, refMap);
+ gtx.setId(id);
+ gtx.setAddress((Address) address);
+ return gtx;
+ }
+
+ private JGroupsAddress unmarshallJGroupsAddress(ObjectInputStream in) throws Exception {
+ JGroupsAddress address = new JGroupsAddress();
+ address.readExternal(in);
+ return address;
+ }
+
+ private List unmarshallArrayList(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ int listSize = readUnsignedInt(in);
+ List list = new ArrayList(listSize);
+ populateFromStream(in, refMap, list, listSize);
+ return list;
+ }
+
+ private List unmarshallLinkedList(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ List list = new LinkedList();
+ populateFromStream(in, refMap, list, readUnsignedInt(in));
+ return list;
+ }
+
+ private Map unmarshallHashMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ Map map = new HashMap();
+ populateFromStream(in, refMap, map);
+ return map;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map unmarshallMapCopy(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ // read in as a HashMap first
+ Map m = unmarshallHashMap(in, refMap);
+ return Immutables.immutableMapWrap(m);
+ }
+
+ private Map unmarshallTreeMap(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ Map map = new TreeMap();
+ populateFromStream(in, refMap, map);
+ return map;
+ }
+
+ private Set unmarshallHashSet(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ Set set = new HashSet();
+ populateFromStream(in, refMap, set);
+ return set;
+ }
+
+ private Set unmarshallTreeSet(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception {
+ Set set = new TreeSet();
+ populateFromStream(in, refMap, set);
+ return set;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Map mapToPopulate) throws Exception {
+ int size = readUnsignedInt(in);
+ for (int i = 0; i < size; i++) mapToPopulate.put(unmarshallObject(in, refMap), unmarshallObject(in, refMap));
+ }
+
+ @SuppressWarnings("unchecked")
+ private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, Set setToPopulate) throws Exception {
+ int size = readUnsignedInt(in);
+ for (int i = 0; i < size; i++) setToPopulate.add(unmarshallObject(in, refMap));
+ }
+
+ @SuppressWarnings("unchecked")
+ private void populateFromStream(ObjectInputStream in, UnmarshalledReferences refMap, List listToPopulate, int listSize) throws Exception {
+ for (int i = 0; i < listSize; i++) listToPopulate.add(unmarshallObject(in, refMap));
+ }
+
+ /**
+ * This version of writeReference is written to solve JBCACHE-1211, where references are encoded as ints rather than
+ * shorts.
+ *
+ * @param out stream to write to
+ * @param reference reference to write
+ * @throws java.io.IOException propagated from OOS
+ * @see <a href="http://jira.jboss.org/jira/browse/JBCACHE-1211">JBCACHE-1211</a>
+ */
+ protected void writeReference(ObjectOutputStream out, int reference) throws IOException {
+ writeUnsignedInt(out, reference);
+ }
+
+ /**
+ * This version of readReference is written to solve JBCACHE-1211, where references are encoded as ints rather than
+ * shorts.
+ *
+ * @param in stream to read from
+ * @return reference
+ * @throws java.io.IOException propagated from OUS
+ * @see <a href="http://jira.jboss.org/jira/browse/JBCACHE-1211">JBCACHE-1211</a>
+ */
+ protected int readReference(ObjectInputStream in) throws IOException {
+ return readUnsignedInt(in);
+ }
+
+ /**
+ * Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer
+ * bytes. Negative numbers are not supported.
+ */
+ protected int readUnsignedInt(ObjectInputStream in) throws IOException {
+ byte b = in.readByte();
+ int i = b & 0x7F;
+ for (int shift = 7; (b & 0x80) != 0; shift += 7) {
+ b = in.readByte();
+ i |= (b & 0x7FL) << shift;
+ }
+ return i;
+ }
+
+ /**
+ * Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes.
+ * Negative numbers are not supported.
+ *
+ * @param i int to write
+ */
+ protected void writeUnsignedInt(ObjectOutputStream out, int i) throws IOException {
+ while ((i & ~0x7F) != 0) {
+ out.writeByte((byte) ((i & 0x7f) | 0x80));
+ i >>>= 7;
+ }
+ out.writeByte((byte) i);
+ }
+
+
+ /**
+ * Reads an int stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer
+ * bytes. Negative numbers are not supported.
+ */
+ protected long readUnsignedLong(ObjectInputStream in) throws IOException {
+ byte b = in.readByte();
+ long i = b & 0x7F;
+ for (int shift = 7; (b & 0x80) != 0; shift += 7) {
+ b = in.readByte();
+ i |= (b & 0x7FL) << shift;
+ }
+ return i;
+ }
+
+ /**
+ * Writes an int in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes.
+ * Negative numbers are not supported.
+ *
+ * @param i int to write
+ */
+ protected void writeUnsignedLong(ObjectOutputStream out, long i) throws IOException {
+ while ((i & ~0x7F) != 0) {
+ out.writeByte((byte) ((i & 0x7f) | 0x80));
+ i >>>= 7;
+ }
+ out.writeByte((byte) i);
+ }
+
+ protected Object unmarshallArray(ObjectInputStream in, UnmarshalledReferences refs) throws Exception {
+ int sz = readUnsignedInt(in);
+ byte type = in.readByte();
+ switch (type) {
+ case MAGICNUMBER_BOOLEAN: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ boolean[] a = new boolean[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readBoolean();
+ return a;
+ } else {
+ Boolean[] a = new Boolean[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readBoolean();
+ return a;
+ }
+ }
+ case MAGICNUMBER_INTEGER: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ int[] a = new int[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readInt();
+ return a;
+ } else {
+ Integer[] a = new Integer[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readInt();
+ return a;
+ }
+ }
+ case MAGICNUMBER_LONG: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ long[] a = new long[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readLong();
+ return a;
+ } else {
+ Long[] a = new Long[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readLong();
+ return a;
+ }
+ }
+ case MAGICNUMBER_CHAR: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ char[] a = new char[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readChar();
+ return a;
+ } else {
+ Character[] a = new Character[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readChar();
+ return a;
+ }
+ }
+ case MAGICNUMBER_BYTE: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ byte[] a = new byte[sz];
+ int bsize = 10240;
+ int offset = 0;
+ int bytesLeft = sz;
+ while (bytesLeft > 0) {
+ int read = in.read(a, offset, Math.min(bsize, bytesLeft));
+ offset += read;
+ bytesLeft -= read;
+ }
+ return a;
+ } else {
+ Byte[] a = new Byte[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readByte();
+ return a;
+ }
+ }
+ case MAGICNUMBER_SHORT: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ short[] a = new short[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readShort();
+ return a;
+ } else {
+ Short[] a = new Short[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readShort();
+ return a;
+ }
+ }
+ case MAGICNUMBER_FLOAT: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ float[] a = new float[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readFloat();
+ return a;
+ } else {
+ Float[] a = new Float[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readFloat();
+ return a;
+ }
+ }
+ case MAGICNUMBER_DOUBLE: {
+ boolean isPrim = in.readBoolean();
+ if (isPrim) {
+ double[] a = new double[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readDouble();
+ return a;
+ } else {
+ Double[] a = new Double[sz];
+ for (int i = 0; i < sz; i++) a[i] = in.readDouble();
+ return a;
+ }
+ }
+ case MAGICNUMBER_OBJECT: {
+ Object[] a = new Object[sz];
+ for (int i = 0; i < sz; i++) a[i] = unmarshallObject(in, refs);
+ return a;
+ }
+ default:
+ throw new CacheException("Unknown array type");
+ }
+ }
+
+ protected void marshallArray(Object o, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception {
+ out.writeByte(MAGICNUMBER_ARRAY);
+ Class arrayTypeClass = o.getClass().getComponentType();
+ int sz = Array.getLength(o);
+ writeUnsignedInt(out, sz);
+ boolean isPrim = arrayTypeClass.isPrimitive();
+
+ if (!isPrim && arrayTypeClass.equals(Object.class)) {
+ out.writeByte(MAGICNUMBER_OBJECT);
+ for (int i = 0; i < sz; i++) marshallObject(Array.get(o, i), out, refMap);
+ } else if (arrayTypeClass.equals(byte.class) || arrayTypeClass.equals(Byte.class)) {
+ out.writeByte(MAGICNUMBER_BYTE);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ out.write((byte[]) o);
+ else
+ for (int i = 0; i < sz; i++) out.writeByte((Byte) Array.get(o, i));
+ } else if (arrayTypeClass.equals(int.class) || arrayTypeClass.equals(Integer.class)) {
+ out.writeByte(MAGICNUMBER_INTEGER);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ for (int i = 0; i < sz; i++) out.writeInt(Array.getInt(o, i));
+ else
+ for (int i = 0; i < sz; i++) out.writeInt((Integer) Array.get(o, i));
+ } else if (arrayTypeClass.equals(long.class) || arrayTypeClass.equals(Long.class)) {
+ out.writeByte(MAGICNUMBER_LONG);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ for (int i = 0; i < sz; i++) out.writeLong(Array.getLong(o, i));
+ else
+ for (int i = 0; i < sz; i++) out.writeLong((Long) Array.get(o, i));
+ } else if (arrayTypeClass.equals(boolean.class) || arrayTypeClass.equals(Boolean.class)) {
+ out.writeByte(MAGICNUMBER_BOOLEAN);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ for (int i = 0; i < sz; i++) out.writeBoolean(Array.getBoolean(o, i));
+ else
+ for (int i = 0; i < sz; i++) out.writeBoolean((Boolean) Array.get(o, i));
+ } else if (arrayTypeClass.equals(char.class) || arrayTypeClass.equals(Character.class)) {
+ out.writeByte(MAGICNUMBER_CHAR);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ for (int i = 0; i < sz; i++) out.writeChar(Array.getChar(o, i));
+ else
+ for (int i = 0; i < sz; i++) out.writeChar((Character) Array.get(o, i));
+ } else if (arrayTypeClass.equals(short.class) || arrayTypeClass.equals(Short.class)) {
+ out.writeByte(MAGICNUMBER_SHORT);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ for (int i = 0; i < sz; i++) out.writeShort(Array.getShort(o, i));
+ else
+ for (int i = 0; i < sz; i++) out.writeShort((Short) Array.get(o, i));
+ } else if (arrayTypeClass.equals(float.class) || arrayTypeClass.equals(Float.class)) {
+ out.writeByte(MAGICNUMBER_FLOAT);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ for (int i = 0; i < sz; i++) out.writeFloat(Array.getFloat(o, i));
+ else
+ for (int i = 0; i < sz; i++) out.writeFloat((Float) Array.get(o, i));
+ } else if (arrayTypeClass.equals(double.class) || arrayTypeClass.equals(Double.class)) {
+ out.writeByte(MAGICNUMBER_DOUBLE);
+ out.writeBoolean(isPrim);
+ if (isPrim)
+ for (int i = 0; i < sz; i++) out.writeDouble(Array.getDouble(o, i));
+ else
+ for (int i = 0; i < sz; i++) out.writeDouble((Double) Array.get(o, i));
+ } else throw new CacheException("Unknown array type!");
+ }
+
+ protected boolean isKnownType(Class c) {
+ return (c.equals(Object.class) ||
+ c.isPrimitive() || c.equals(Character.class) || c.equals(Integer.class) || c.equals(Long.class) ||
+ c.equals(Byte.class) || c.equals(Boolean.class) || c.equals(Short.class) || c.equals(Float.class) ||
+ c.equals(Double.class));
+ }
+
+ public void objectToObjectStream(Object o, ObjectOutputStream out) throws Exception {
+ Map<Object, Integer> refMap = useRefs ? new IdentityHashMap<Object, Integer>() : null;
+ ClassLoader toUse = defaultClassLoader;
+ Thread current = Thread.currentThread();
+ ClassLoader old = current.getContextClassLoader();
+ if (old != null) toUse = old;
+
+ try {
+ current.setContextClassLoader(toUse);
+ marshallObject(o, out, refMap);
+ }
+ finally {
+ current.setContextClassLoader(old);
+ }
+ }
+
+ public Object objectFromObjectStream(ObjectInputStream in) throws Exception {
+ UnmarshalledReferences refMap = useRefs ? new UnmarshalledReferences() : null;
+ Object retValue = unmarshallObject(in, defaultClassLoader, refMap, false);
+ if (trace) log.trace("Unmarshalled object " + retValue);
+ return retValue;
+ }
+
+ public Object objectFromStream(InputStream is) throws Exception {
+ throw new NotImplementedException("not implemented");
+ }
+
+ public ByteBuffer objectToBuffer(Object o) throws Exception {
+ ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(128);
+ ObjectOutputStream out = new ObjectOutputStream(baos);
+
+ //now marshall the contents of the object
+ objectToObjectStream(o, out);
+ out.close();
+ // and return bytes.
+ return new ByteBuffer(baos.getRawBuffer(), 0, baos.size());
+ }
+
+ public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws Exception {
+ ObjectInputStream in = new MarshalledValueInputStream(new ByteArrayInputStream(buf, offset, length));
+ return objectFromObjectStream(in);
+ }
+
+ public Object objectFromByteBuffer(byte[] bytes) throws Exception {
+ return objectFromByteBuffer(bytes, 0, bytes.length);
+ }
+}
\ No newline at end of file
Property changes on: core/branches/flat/src/main/java/org/horizon/marshall/HorizonMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: core/branches/flat/src/main/java/org/horizon/marshall/VersionAwareMarshaller.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/marshall/VersionAwareMarshaller.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/java/org/horizon/marshall/VersionAwareMarshaller.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -34,9 +34,9 @@
import java.io.ObjectOutputStream;
/**
- * A delegate to various other marshallers like {@link CacheMarshallerStarobrno}. This delegating marshaller adds
- * versioning information to the stream when marshalling objects and is able to pick the appropriate marshaller to
- * delegate to based on the versioning information when unmarshalling objects.
+ * A delegate to various other marshallers like {@link HorizonMarshaller}. This delegating marshaller adds versioning
+ * information to the stream when marshalling objects and is able to pick the appropriate marshaller to delegate to
+ * based on the versioning information when unmarshalling objects.
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder Zamarreno</a>
@@ -49,13 +49,13 @@
private static final int VERSION_400 = 40;
private static final int CUSTOM_MARSHALLER = 999;
- private CacheMarshallerStarobrno defaultMarshaller;
+ private HorizonMarshaller defaultMarshaller;
ClassLoader defaultClassLoader;
@Inject
public void init(ClassLoader loader) {
- defaultMarshaller = new CacheMarshallerStarobrno();
+ defaultMarshaller = new HorizonMarshaller();
defaultMarshaller.init(loader);
}
Modified: core/branches/flat/src/main/resources/config-samples/all.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/all.xml 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/main/resources/config-samples/all.xml 2009-01-26 16:56:02 UTC (rev 7597)
@@ -40,7 +40,7 @@
</transport>
<!-- Again, sensible defaults are used here if this is omitted. -->
- <serialization marshallerClass="org.horizon.marshall.CacheMarshallerStarobrno" version="1.0"
+ <serialization marshallerClass="org.horizon.marshall.HorizonMarshaller" version="1.0"
objectInputStreamPoolSize="100" objectOutputStreamPoolSize="100"/>
<!--
Modified: core/branches/flat/src/test/java/org/horizon/UnitTestCacheFactory.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/UnitTestCacheFactory.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/test/java/org/horizon/UnitTestCacheFactory.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -8,13 +8,15 @@
import org.horizon.config.Configuration;
import org.horizon.config.ConfigurationException;
-import org.horizon.config.parsing.XmlConfigurationParserJBC3;
+import org.horizon.config.parsing.XmlConfigurationParser;
+import org.horizon.config.parsing.XmlConfigurationParserImpl;
import org.horizon.logging.Log;
import org.horizon.logging.LogFactory;
import org.horizon.manager.DefaultCacheManager;
import org.horizon.util.TestingUtil;
import org.jgroups.conf.XmlConfigurator;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
@@ -84,29 +86,34 @@
return createCache(new Configuration(), start);
}
- public Cache<K, V> createCache(String configFileName) throws ConfigurationException {
+ public Cache<K, V> createCache(String configFileName) throws ConfigurationException, IOException {
return createCache(configFileName, true);
}
- public Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException {
- XmlConfigurationParserJBC3 parser = new XmlConfigurationParserJBC3();
+ public Cache<K, V> createCache(String configFileName, boolean start) throws ConfigurationException, IOException {
+ XmlConfigurationParser parser = new XmlConfigurationParserImpl(configFileName);
Configuration c;
- c = parser.parseFile(configFileName);
- return createCache(c, start);
+
+ // TODO: gotta build a proper cache manager here
+ return null;
+
+ //return createCache(c, start);
}
public Cache<K, V> createCache(Configuration configuration) throws ConfigurationException {
return createCache(configuration, true);
}
- public Cache<K, V> createCache(InputStream is) throws ConfigurationException {
+ public Cache<K, V> createCache(InputStream is) throws ConfigurationException, IOException {
return createCache(is, true);
}
- public Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException {
- XmlConfigurationParserJBC3 parser = new XmlConfigurationParserJBC3();
- Configuration c = parser.parseStream(is);
- return createCache(c, start);
+ public Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException, IOException {
+ XmlConfigurationParser parser = new XmlConfigurationParserImpl(is);
+ //Configuration c = parser.parseStream(is);
+ //return createCache(c, start);
+ // TODO: gotta build a proper cache manager here
+ return null;
}
public Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException {
Modified: core/branches/flat/src/test/java/org/horizon/manager/CacheManagerComponentRegistryTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/manager/CacheManagerComponentRegistryTest.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/test/java/org/horizon/manager/CacheManagerComponentRegistryTest.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -30,7 +30,7 @@
if (cm != null) cm.stop();
}
- public void testForceSharedComponents() throws CacheNameExistsException, NamedCacheNotFoundException {
+ public void testForceSharedComponents() throws NamedCacheNotFoundException {
Configuration defaultCfg = new Configuration();
defaultCfg.setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -56,7 +56,7 @@
assert TestingUtil.extractComponent(c, RPCManager.class) == TestingUtil.extractComponent(transactional, RPCManager.class);
}
- public void testForceUnsharedComponents() throws CacheNameExistsException, NamedCacheNotFoundException {
+ public void testForceUnsharedComponents() throws NamedCacheNotFoundException {
CacheLoaderConfig clc = new CacheLoaderConfig();
// TODO change this to use a dummy in memory cache loader instead!!
FileCacheLoaderConfig fc = new FileCacheLoaderConfig();
@@ -83,7 +83,7 @@
assert TestingUtil.extractComponent(c, CacheLoaderManager.class) != TestingUtil.extractComponent(transactional, CacheLoaderManager.class);
}
- public void testOverridingComponents() throws CacheNameExistsException, NamedCacheNotFoundException {
+ public void testOverridingComponents() throws NamedCacheNotFoundException {
Configuration defaultCfg = new Configuration();
cm = new DefaultCacheManager(defaultCfg);
Modified: core/branches/flat/src/test/java/org/horizon/manager/CacheManagerTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/manager/CacheManagerTest.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/test/java/org/horizon/manager/CacheManagerTest.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -3,6 +3,7 @@
import org.horizon.Cache;
import org.horizon.ComponentStatus;
import org.horizon.config.Configuration;
+import org.horizon.config.DuplicateCacheNameException;
import org.horizon.util.TestingUtil;
import org.testng.annotations.Test;
@@ -12,7 +13,7 @@
*/
@Test(groups = "functional")
public class CacheManagerTest {
- public void testDefaultCache() throws CacheNameExistsException {
+ public void testDefaultCache() {
CacheManager cm = new DefaultCacheManager();
try {
@@ -32,7 +33,7 @@
}
}
- public void testClashingNames() throws CacheNameExistsException {
+ public void testClashingNames() {
CacheManager cm = new DefaultCacheManager();
try {
Configuration c = new Configuration();
@@ -42,7 +43,7 @@
cm.defineCache("aCache", c);
assert false : "Should fail";
}
- catch (CacheNameExistsException cnee) {
+ catch (DuplicateCacheNameException cnee) {
// expected
assert true : "Expected";
}
Modified: core/branches/flat/src/test/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/test/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -2,7 +2,7 @@
import org.horizon.Cache;
import org.horizon.config.Configuration;
-import org.horizon.config.ConfigurationException;
+import org.horizon.config.DuplicateCacheNameException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -23,39 +23,8 @@
}
public void testNamedCacheXML() throws IOException {
- String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<jbosscache xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:jboss:starobrno-core:config:1.0\">\n" +
- "\n" +
- " <default>\n" +
- " <locking concurrencyLevel=\"100\" lockAcquisitionTimeout=\"1000\" />\n" +
- " </default>\n" +
- "\n" +
- " <namedCache name=\"transactional\">\n" +
- " <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
- " </namedCache>\n" +
- "\n" +
- " <namedCache name=\"syncRepl\">\n" +
- " <clustering>\n" +
- " <stateRetrieval fetchInMemoryState=\"true\" timeout=\"15000\"/>\n" +
- " <jgroupsConfig configFile=\"udp.xml\"/>\n" +
- " <sync replTimeout=\"15000\"/>\n" +
- " </clustering>\n" +
- " </namedCache>\n" +
- "\n" +
- " <namedCache name=\"txSyncRepl\">\n" +
- " <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
- " <clustering>\n" +
- " <stateRetrieval fetchInMemoryState=\"true\" timeout=\"15000\"/>\n" +
- " <jgroupsConfig configFile=\"udp.xml\"/>\n" +
- " <sync replTimeout=\"15000\"/>\n" +
- " </clustering>\n" +
- " </namedCache>\n" +
- " \n" +
- "</jbosscache>";
+ cm = new DefaultCacheManager("configs/named-cache-test.xml");
- ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
- cm = new DefaultCacheManager(bais);
-
// test default cache
Cache c = cm.getCache();
assert c.getConfiguration().getConcurrencyLevel() == 100;
@@ -87,49 +56,47 @@
public void testNamedCacheXMLClashingNames() throws IOException {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<jbosscache xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:jboss:starobrno-core:config:1.0\">\n" +
+ "<horizon xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:horizon:config:1.0\">\n" +
"\n" +
" <default>\n" +
" <locking concurrencyLevel=\"100\" lockAcquisitionTimeout=\"1000\" />\n" +
" </default>\n" +
"\n" +
" <namedCache name=\"c1\">\n" +
- " <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
+ " <transaction transactionManagerLookupClass=\"org.horizon.transaction.GenericTransactionManagerLookup\"/>\n" +
" </namedCache>\n" +
"\n" +
" <namedCache name=\"c1\">\n" +
" <clustering>\n" +
- " <stateRetrieval fetchInMemoryState=\"true\" timeout=\"15000\"/>\n" +
- " <jgroupsConfig configFile=\"udp.xml\"/>\n" +
" <sync replTimeout=\"15000\"/>\n" +
" </clustering>\n" +
" </namedCache>\n" +
" \n" +
- "</jbosscache>";
+ "</horizon>";
ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
try {
cm = new DefaultCacheManager(bais);
assert false : "Should fail";
}
- catch (ConfigurationException expected) {
+ catch (DuplicateCacheNameException expected) {
}
}
public void testNamedCacheXMLClashingNamesProgrammatic() throws IOException {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<jbosscache xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:jboss:starobrno-core:config:1.0\">\n" +
+ "<horizon xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:horizon:config:1.0\">\n" +
"\n" +
" <default>\n" +
" <locking concurrencyLevel=\"100\" lockAcquisitionTimeout=\"1000\" />\n" +
" </default>\n" +
"\n" +
" <namedCache name=\"c1\">\n" +
- " <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
+ " <transaction transactionManagerLookupClass=\"org.horizon.transaction.GenericTransactionManagerLookup\"/>\n" +
" </namedCache>\n" +
"\n" +
- "</jbosscache>";
+ "</horizon>";
ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
cm = new DefaultCacheManager(bais);
@@ -140,7 +107,7 @@
cm.defineCache("c1", new Configuration());
assert false : "Should fail";
}
- catch (CacheNameExistsException expected) {
+ catch (DuplicateCacheNameException expected) {
}
}
Modified: core/branches/flat/src/test/java/org/horizon/util/internals/ReplicationListener.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/util/internals/ReplicationListener.java 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/test/java/org/horizon/util/internals/ReplicationListener.java 2009-01-26 16:56:02 UTC (rev 7597)
@@ -11,7 +11,7 @@
import org.horizon.io.ByteBuffer;
import org.horizon.logging.Log;
import org.horizon.logging.LogFactory;
-import org.horizon.marshall.CacheMarshallerStarobrno;
+import org.horizon.marshall.HorizonMarshaller;
import org.horizon.marshall.Marshaller;
import org.horizon.remoting.RPCManager;
import org.horizon.remoting.transport.jgroups.CommandAwareRpcDispatcher;
@@ -146,7 +146,7 @@
/**
* Needed for region based marshalling.
*/
- private class RegionMarshallerDelegate extends CacheMarshallerStarobrno {
+ private class RegionMarshallerDelegate extends HorizonMarshaller {
private Marshaller realOne;
private RegionMarshallerDelegate(Marshaller realOne) {
Modified: core/branches/flat/src/test/resources/configs/named-cache-test.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-01-26 11:58:54 UTC (rev 7596)
+++ core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-01-26 16:56:02 UTC (rev 7597)
@@ -23,7 +23,7 @@
<transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport"/>
- <serialization marshallerClass="org.horizon.marshall.CacheMarshallerStarobrno" version="1.0"
+ <serialization marshallerClass="org.horizon.marshall.HorizonMarshaller" version="1.0"
objectInputStreamPoolSize="100" objectOutputStreamPoolSize="100"/>
</global>
15 years, 11 months
JBoss Cache SVN: r7596 - in core/branches/flat/src: main/resources/config-samples and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-26 06:58:54 -0500 (Mon, 26 Jan 2009)
New Revision: 7596
Added:
core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd
Removed:
core/branches/flat/src/main/resources/schema/starobrno-config-1.0.xsd
core/branches/flat/src/main/resources/schema/starobrno-registry-1.0.xsd
core/branches/flat/src/test/resources/configs/parser-test-async.xml
core/branches/flat/src/test/resources/configs/parser-test.xml
Modified:
core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java
core/branches/flat/src/main/resources/config-samples/all.xml
core/branches/flat/src/test/resources/configs/named-cache-test.xml
core/branches/flat/src/test/resources/configs/string-property-replaced.xml
Log:
Updated schema and sample XML
Modified: core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/main/java/org/horizon/config/parsing/RootElementBuilder.java 2009-01-26 11:58:54 UTC (rev 7596)
@@ -51,7 +51,7 @@
static {
// Globally register this namespace
- JBossEntityResolver.registerEntity(JBOSSCACHE_CORE_NS, "starobrno-config-1.0.xsd");
+ JBossEntityResolver.registerEntity(JBOSSCACHE_CORE_NS, "horizon-config-1.0.xsd");
JBossEntityResolver.registerEntity(JBOSSCACHE_REPO_NS, "starobrno-registry-1.0.xsd");
}
Modified: core/branches/flat/src/main/resources/config-samples/all.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/all.xml 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/main/resources/config-samples/all.xml 2009-01-26 11:58:54 UTC (rev 7596)
@@ -1,226 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
+<horizon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:horizon:config:1.0">
+ <!-- *************************** -->
+ <!-- System-wide global settings -->
+ <!-- *************************** -->
- <!--
- isolation levels supported: READ_COMMITTED and REPEATABLE_READ
- nodeLockingSchemes: mvcc, pessimistic (deprecated), optimistic (deprecated)
- -->
- <locking
+ <global>
+
+ <!-- Note that if these are left blank, defaults are used. See the user guide for what these defaults are -->
+ <asyncListenerExecutor factory="org.horizon.executors.DefaultExecutorFactory">
+ <property name="maxThreads">5</property>
+ <property name="threadNamePrefix">AsyncListenerThread</property>
+ </asyncListenerExecutor>
+
+ <asyncSerializationExecutor factory="org.horizon.executors.DefaultExecutorFactory">
+ <property name="maxThreads">25</property>
+ <property name="threadNamePrefix">AsyncSerializationThread</property>
+ </asyncSerializationExecutor>
+
+ <evictionScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
+ <property name="threadNamePrefix">EvictionThread</property>
+ </evictionScheduledExecutor>
+
+ <replicationQueueScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
+ <property name="threadNamePrefix">ReplicationQueueThread</property>
+ </replicationQueueScheduledExecutor>
+
+
+ <!--
+ If the transport is omitted, there is no way to create distributed or clustered caches.
+ There is no added cost to defining a transport but not creating a cache that uses one, since the transport
+ is created and initialized lazily.
+ -->
+ <transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport">
+ <!-- Note that the JGroups transport uses sensible defaults if no configuration property is defined. -->
+ <property name="configurationFile">udp.xml</property>
+ <!-- See the JGroupsTransport javadocs for more options -->
+ </transport>
+
+ <!-- Again, sensible defaults are used here if this is omitted. -->
+ <serialization marshallerClass="org.horizon.marshall.CacheMarshallerStarobrno" version="1.0"
+ objectInputStreamPoolSize="100" objectOutputStreamPoolSize="100"/>
+
+ <!--
+ Used to register JVM shutdown hooks.
+ hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
+ -->
+ <shutdown hookBehavior="DEFAULT"/>
+ </global>
+
+ <!-- *************************** -->
+ <!-- Default "template" settings -->
+ <!-- *************************** -->
+ <!-- this is used as a "template" configuration for all caches in the system. -->
+ <default>
+ <!--
+ isolation levels supported: READ_COMMITTED and REPEATABLE_READ
+ -->
+ <locking
isolationLevel="REPEATABLE_READ"
- lockParentForChildInsertRemove="false"
lockAcquisitionTimeout="20000"
writeSkewCheck="false"
concurrencyLevel="500"/>
- <!--
- Used to register a transaction manager and participate in ongoing transactions.
- -->
- <transaction
+ <!--
+ Used to register a transaction manager and participate in ongoing transactions.
+ -->
+ <transaction
transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"
syncRollbackPhase="false"
syncCommitPhase="false"/>
- <!--
- Used to register JMX statistics in any available MBean server
- -->
- <jmxStatistics
- enabled="false"/>
+ <!--
+ Used to register JMX statistics in any available MBean server
+ -->
+ <jmxStatistics enabled="false"/>
- <!--
- If region based marshalling is used, defines whether new regions are inactive on startup.
- -->
- <startup
- regionsInactiveOnStartup="true"/>
+ <!--
+ Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
+ -->
+ <invocationBatching enabled="false"/>
- <!--
- Used to register JVM shutdown hooks.
- hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
- -->
- <shutdown
- hookBehavior="DEFAULT"/>
+ <!--
+ This element specifies that the cache is clustered.
+ modes supported: replication (r) or invalidation (i).
+ -->
+ <clustering mode="replication" clusterName="JBossCache-cluster">
- <!--
- Used to define async listener notification thread pool size
- -->
- <listeners
- asyncPoolSize="1"
- asyncQueueSize="1000000"/>
+ <!--
+ Defines whether to retrieve state on startup
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
- <!--
- Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
- -->
- <invocationBatching
- enabled="false"/>
+ <!--
+ Network calls are synchronous.
+ -->
+ <sync replTimeout="20000"/>
+ <!--
+ Uncomment this for async replication.
+ -->
+ <!--<async useReplQueue="true" replQueueInterval="10000" replQueueMaxElements="500" serializationExecutorPoolSize="20" serializationExecutorQueueSize="5000000"/>-->
+ </clustering>
+ </default>
- <!--
- serialization related configuration, used for replication and cache loading
- -->
- <serialization
- objectInputStreamPoolSize="12"
- objectOutputStreamPoolSize="14"
- version="3.0.0"
- marshallerClass="org.jboss.cache.marshall.VersionAwareMarshaller"
- useLazyDeserialization="false"
- useRegionBasedMarshalling="false"/>
+ <!-- ************************************** -->
+ <!-- Individually configured "named" caches -->
+ <!-- ************************************** -->
- <!--
- This element specifies that the cache is clustered.
- modes supported: replication (r) or invalidation (i).
- -->
- <clustering mode="replication" clusterName="JBossCache-cluster">
+ <!-- Note that any of the elements appearing in a namedCache section can also appear in the default section as a template. -->
+ <namedCache name="evictionCache">
- <!--
- Defines whether to retrieve state on startup
- -->
- <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
+ <!--
+ Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds. 0 means
+ the eviction thread will never run. A separate executor is used for eviction in each cache.
+ -->
+ <eviction wakeUpInterval="500" algorithmClass="org.horizon.eviction.LRUAlgorithm" eventQueueSize="200000">
+ <property name="maxNodes" value="5000"/>
+ <property name="timeToLive" value="1000"/>
+ </eviction>
- <!--
- Network calls are synchronous.
- -->
- <sync replTimeout="20000"/>
- <!--
- Uncomment this for async replication.
- -->
- <!--<async useReplQueue="true" replQueueInterval="10000" replQueueMaxElements="500" serializationExecutorPoolSize="20" serializationExecutorQueueSize="5000000"/>-->
+ </namedCache>
- <!-- Uncomment to use Buddy Replication -->
- <!--
- <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
- <dataGravitation auto="true" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- numBuddies = 1
- ignoreColocatedBuddies = true
- </properties>
- </locator>
- </buddy>
- -->
- <!--
- Configures the JGroups channel. Looks up a JGroups config file on the classpath or filesystem. udp.xml
- ships with jgroups.jar and will be picked up by the class loader.
- -->
- <jgroupsConfig>
+ <namedCache name="jdbcBackedCache">
+ <!--
+ Cache loaders.
- <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
- loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
- mcast_port="45588" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
- oob_thread_pool.min_threads="1" oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
- thread_pool.keep_alive_time="30000" thread_pool.max_threads="25" thread_pool.min_threads="1"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
- tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
- use_incoming_packet_handler="true"/>
- <PING num_initial_members="3" timeout="2000"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD max_tries="5" shun="true" timeout="10000"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- use_mcast_xmit="false"/>
- <UNICAST timeout="300,600,1200,2400,3600"/>
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
- <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
- view_bundling="true"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <pbcast.FLUSH timeout="0"/>
+ If passivation is enabled, state is offloaded to the cache loaders ONLY when evicted. Similarly, when the state
+ is accessed again, it is removed from the cache loader and loaded into memory.
- </jgroupsConfig>
- </clustering>
+ Otherwise, state is always maintained in the cache loader as well as in memory.
- <!--
- Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds. 0 means
- the eviction thread will never run.
- -->
- <eviction wakeUpInterval="500">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000"/>
- </default>
- <region name="/org/jboss/data1">
- <property name="timeToLive" value="2000"/>
- </region>
- <region name="/org/jboss/data2" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="100000">
- <property name="maxNodes" value="3000"/>
- <property name="minTimeToLive" value="4000"/>
- </region>
- </eviction>
+ Set 'shared' to true if all instances in the cluster use the same cache loader instance, e.g., are talking to the
+ same database.
- <!--
- Cache loaders.
+ If "preload" is true, all keys are loaded from the cache loader into memory upon starting the cache.
+ -->
+ <loaders passivation="false" shared="false" preload="true">
- If passivation is enabled, state is offloaded to the cache loaders ONLY when evicted. Similarly, when the state
- is accessed again, it is removed from the cache loader and loaded into memory.
+ <!--
+ We can have multiple cache loaders, which get chained
+ -->
+ <loader class="org.horizon.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
+ ignoreModifications="true" purgeOnStartup="true">
- Otherwise, state is always maintained in the cache loader as well as in memory.
-
- Set 'shared' to true if all instances in the cluster use the same cache loader instance, e.g., are talking to the
- same database.
- -->
- <loaders passivation="false" shared="false">
- <preload>
- <node fqn="/org/jboss"/>
- <node fqn="/org/tempdata"/>
- </preload>
-
- <!--
- we can have multiple cache loaders, which get chained
- -->
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
- ignoreModifications="true" purgeOnStartup="true">
-
+ <!-- See the documentation for more configuration examples and options. -->
<properties>
- cache.jdbc.table.name=jbosscache
- cache.jdbc.table.create=true
- cache.jdbc.table.drop=true
- cache.jdbc.table.primarykey=jbosscache_pk
- cache.jdbc.fqn.column=fqn
- cache.jdbc.fqn.type=varchar(255)
- cache.jdbc.node.column=node
- cache.jdbc.node.type=blob
- cache.jdbc.parent.column=parent
- cache.jdbc.sql-concat=1 || 2
- cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
- cache.jdbc.url=jdbc:derby:jbossdb;create=true
- cache.jdbc.user=user1
- cache.jdbc.password=user1
+ horizon.jdbc.datasource=HorizonDS
+ horizon.jdbc.table.name=horizon
+ horizon.jdbc.table.create=true
+ horizon.jdbc.table.drop=false
</properties>
- <!-- alternatively use a connection from a datasorce, as per the code sample below-->
- <!--<properties>-->
- <!--cache.jdbc.datasource=AllSampleDS-->
- <!--cache.jdbc.table.name=jbosscache-->
- <!--cache.jdbc.table.create=true-->
- <!--cache.jdbc.table.drop=true-->
- <!--</properties>-->
+
<singletonStore enabled="true" class="org.horizon.loader.SingletonStoreCacheLoader">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=20000
- </properties>
+ <properties>
+ horizon.singletonStore.pushStateWhenCoordinator=true
+ horizon.singletonStore.pushStateWhenCoordinatorTimeout=20000
+ </properties>
</singletonStore>
- </loader>
- </loaders>
+ </loader>
+ </loaders>
- <!--
- Define custom interceptors. All custom interceptors need to extend org.jboss.cache.interceptors.base.CommandInterceptor
- -->
- <!--
- <customInterceptors>
- <interceptor position="first" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor">
- <property name="attrOne" value="value1" />
- <property name="attrTwo" value="value2" />
- </interceptor>
- <interceptor position="last" class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
- <interceptor index="3" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
- <interceptor before="org.jboss.cache.interceptors.CallInterceptor"
- class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
- <interceptor after="org.jboss.cache.interceptors.CallInterceptor"
- class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
- </customInterceptors>
- -->
-</jbosscache>
+ </namedCache>
+
+
+ <namedCache name="cacheWithCustomInterceptors">
+ <!--
+ Define custom interceptors. All custom interceptors need to extend org.jboss.cache.interceptors.base.CommandInterceptor
+ -->
+ <!--
+ <customInterceptors>
+ <interceptor position="first" class="com.mycompany.CustomInterceptor1">
+ <property name="com.mycompany.attributeOne" value="value1" />
+ <property name="com.mycompany.attributeTwo" value="value2" />
+ </interceptor>
+ <interceptor position="last" class="com.mycompany.CustomInterceptor2"/>
+ <interceptor index="3" class="com.mycompany.CustomInterceptor1"/>
+ <interceptor before="org.horizon.interceptors.CallInterceptor" class="com.mycompany.CustomInterceptor2"/>
+ <interceptor after="org.horizon.interceptors.CallInterceptor" class="com.mycompany.CustomInterceptor1"/>
+ </customInterceptors>
+ -->
+ </namedCache>
+</horizon>
Copied: core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd (from rev 7593, core/branches/flat/src/main/resources/schema/starobrno-config-1.0.xsd)
===================================================================
--- core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd (rev 0)
+++ core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd 2009-01-26 11:58:54 UTC (rev 7596)
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
+ xmlns:tns="urn:horizon:config:1.0" targetNamespace="urn:horizon:config:1.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
+
+ <xs:element name="horizon" type="tns:cacheManagerConfigurationType"/>
+
+ <xs:complexType name="cacheManagerConfigurationType">
+ <xs:sequence>
+ <xs:element name="global" type="tns:globalCacheConfigurationType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="default" type="tns:cacheConfigurationType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="namedCache" type="tns:cacheConfigurationType" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="globalCacheConfigurationType">
+ <xs:all>
+ <xs:element name="serialization" type="tns:sharedSerializationType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="transport" type="tns:transportConfigType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="asyncListenerExecutor" type="tns:executorConfigurationType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="asyncSerializationExecutor" type="tns:executorConfigurationType" minOccurs="0"
+ maxOccurs="1"/>
+ <xs:element name="evictionScheduledExecutor" type="tns:executorConfigurationType" minOccurs="0"
+ maxOccurs="1"/>
+ <xs:element name="replicationQueueScheduledExecutor" type="tns:executorConfigurationType" minOccurs="0"
+ maxOccurs="1"/>
+ <xs:element name="shutdown" type="tns:shutdownType" minOccurs="0" maxOccurs="1"/>
+ </xs:all>
+ </xs:complexType>
+
+ <xs:complexType name="sharedSerializationType">
+ <xs:attribute name="objectInputStreamPoolSize" type="tns:positiveInteger"/>
+ <xs:attribute name="objectOutputStreamPoolSize" type="tns:positiveInteger"/>
+ <xs:attribute name="version" type="xs:string"/>
+ <xs:attribute name="marshallerClass" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:complexType name="executorConfigurationType">
+ <xs:sequence>
+ <xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="tns:propertyType"/>
+ </xs:sequence>
+ <xs:attribute name="factory" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:complexType name="cacheConfigurationType">
+ <xs:all>
+ <xs:element name="locking" type="tns:lockingType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="transaction" type="tns:transactionType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="jmxStatistics" type="tns:jmxStatisticsType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="invocationBatching" type="tns:invocationBatchingType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="eviction" type="tns:evictionType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="loaders" type="tns:loadersType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="customInterceptors" type="tns:customInterceptorsType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="clustering" type="tns:clusteringType" minOccurs="0" maxOccurs="1"/>
+ </xs:all>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:complexType name="clusteringType">
+ <xs:all>
+ <xs:element name="sync" type="tns:syncType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="async" type="tns:asyncType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="stateRetrieval" type="tns:stateRetrievalType" minOccurs="0" maxOccurs="1"/>
+ </xs:all>
+ <xs:attribute name="mode">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[Rr][Ee][Pp][Ll][Ii][Cc][Aa][Tt][Ii][Oo][Nn]|[Ii][Nn][Vv][Aa][Ll][Ii][Dd][Aa][Tt][Ii][Oo][Nn]|[Rr]|[Ii]|\$\{.*\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="clusterName" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:complexType name="lockingType">
+ <xs:attribute name="isolationLevel">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[Ss][Ee][Rr][Ii][Aa][Ll][Ii][Zz][Aa][Bb][Ll][Ee]|[Rr][Ee][Pp][Ee][Aa][Tt][Aa][Bb][Ll][Ee]_[Rr][Ee][Aa][Dd]|[Rr][Ee][Aa][Dd]_[Cc][Oo][Mm][Mm][Ii][Tt][Tt][Ee][Dd]|[Nn][Oo][Nn][Ee]|\$\{.*\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="lockAcquisitionTimeout" type="tns:positiveInteger"/>
+ <xs:attribute name="writeSkewCheck" type="tns:booleanType"/>
+ <xs:attribute name="concurrencyLevel" type="xs:integer"/>
+ </xs:complexType>
+
+ <xs:complexType name="transactionType">
+ <xs:attribute name="transactionManagerLookupClass" type="xs:string"/>
+ <xs:attribute name="syncRollbackPhase" type="tns:booleanType"/>
+ <xs:attribute name="syncCommitPhase" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="stateRetrievalType">
+ <xs:attribute name="fetchInMemoryState" type="tns:booleanType"/>
+ <xs:attribute name="timeout" type="tns:positiveInteger"/>
+ </xs:complexType>
+
+ <xs:complexType name="shutdownType">
+ <xs:attribute name="hookBehavior">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[Dd][Ee][Ff][Aa][Uu][Ll][Tt]|[Rr][Ee][Gg][Ii][Ss][Tt][Ee][Rr]|[Dd][Oo][Nn][Tt]_[Rr][Ee][Gg][Ii][Ss][Tt][Ee][Rr]|\$\{.*\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:complexType name="serializationType">
+ <xs:attribute name="useLazyDeserialization" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:simpleType name="booleanType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="\$\{.*\}|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="positiveInteger">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="\$\{.*\}|\+?[0-9]*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="jmxStatisticsType">
+ <xs:attribute name="enabled" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="invocationBatchingType">
+ <xs:attribute name="enabled" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="transportConfigType">
+ <xs:sequence>
+ <xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="tns:propertyType"/>
+ </xs:sequence>
+ <xs:attribute name="transportClass" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:complexType name="syncType">
+ <xs:attribute name="replTimeout" type="tns:positiveInteger"/>
+ </xs:complexType>
+
+ <xs:complexType name="asyncType">
+ <xs:attribute name="useReplQueue" type="tns:booleanType"/>
+ <xs:attribute name="replQueueInterval" type="tns:positiveInteger"/>
+ <xs:attribute name="replQueueMaxElements" type="tns:positiveInteger"/>
+ <xs:attribute name="useAsyncSerialization" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="evictionType">
+ <xs:sequence>
+ <xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="tns:propertyType"/>
+ </xs:sequence>
+ <xs:attribute name="wakeUpInterval" type="tns:positiveInteger" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="algorithmClass" type="xs:string"/>
+ <xs:attribute name="actionPolicyClass" type="xs:string"/>
+ <xs:attribute name="eventQueueSize" type="tns:positiveInteger"/>
+
+ </xs:complexType>
+
+ <xs:complexType name="loadersType">
+ <xs:sequence>
+ <xs:element name="loader" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="properties"/>
+ <xs:element name="singletonStore" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="properties" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:all>
+ <xs:attribute name="enabled" type="tns:booleanType"/>
+ <xs:attribute name="class" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="async" type="tns:booleanType"/>
+ <xs:attribute name="fetchPersistentState" type="tns:booleanType"/>
+ <xs:attribute name="ignoreModifications" type="tns:booleanType"/>
+ <xs:attribute name="purgeOnStartup" type="tns:booleanType"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="preload" type="tns:booleanType"/>
+ <xs:attribute name="passivation" type="tns:booleanType"/>
+ <xs:attribute name="shared" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="customInterceptorsType">
+ <xs:sequence>
+ <xs:element name="interceptor" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="property" maxOccurs="unbounded" type="tns:propertyType" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="position">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[Ff][Ii][Rr][Ss][Tt]|[Ll][Aa][Ss][Tt]"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="before" type="xs:string"/>
+ <xs:attribute name="after" type="xs:string"/>
+ <xs:attribute name="index" type="tns:positiveInteger"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="propertyType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="value" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+</xs:schema>
+
Property changes on: core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: core/branches/flat/src/main/resources/schema/starobrno-config-1.0.xsd
===================================================================
--- core/branches/flat/src/main/resources/schema/starobrno-config-1.0.xsd 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/main/resources/schema/starobrno-config-1.0.xsd 2009-01-26 11:58:54 UTC (rev 7596)
@@ -1,301 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
- xmlns:tns="urn:jboss:starobrno-core:config:1.0" targetNamespace="urn:jboss:starobrno-core:config:1.0"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
-
- <xs:element name="jbosscache" type="tns:cacheManagerConfigurationType"/>
-
- <xs:complexType name="cacheManagerConfigurationType">
- <xs:sequence>
- <xs:element name="global" type="tns:globalCacheConfigurationType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="default" type="tns:defaultCacheConfigurationType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="namedCache" type="tns:namedCacheConfigurationType" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="globalCacheConfigurationType">
- <xs:all>
- <xs:element name="serialization" type="tns:sharedSerializationType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="jgroupsConfig" type="tns:jgroupsConfigType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="asyncListenerExecutor" type="tns:executorConfigurationType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="asyncSerializationExecutor" type="tns:executorConfigurationType" minOccurs="0"
- maxOccurs="1"/>
- <xs:element name="evictionScheduledExecutor" type="tns:executorConfigurationType" minOccurs="0"
- maxOccurs="1"/>
- <xs:element name="replicationQueueScheduledExecutor" type="tns:executorConfigurationType" minOccurs="0"
- maxOccurs="1"/>
- </xs:all>
- </xs:complexType>
-
- <xs:complexType name="sharedSerializationType">
- <xs:attribute name="objectInputStreamPoolSize" type="tns:positiveInteger"/>
- <xs:attribute name="objectOutputStreamPoolSize" type="tns:positiveInteger"/>
- <xs:attribute name="version" type="xs:string"/>
- <xs:attribute name="marshallerClass" type="xs:string"/>
- </xs:complexType>
-
- <xs:complexType name="executorConfigurationType">
- <xs:sequence>
- <xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="tns:propertyType"/>
- </xs:sequence>
- <xs:attribute name="factory" type="xs:string"/>
- </xs:complexType>
-
- <xs:complexType name="defaultCacheConfigurationType">
- <xs:all>
- <xs:element name="locking" type="tns:lockingType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="transaction" type="tns:transactionType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="startup" type="tns:startupType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="shutdown" type="tns:shutdownType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="serialization" type="tns:serializationType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="jmxStatistics" type="tns:jmxStatisticsType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="listeners" type="tns:listenersType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="invocationBatching" type="tns:invocationBatchingType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="eviction" type="tns:evictionType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="loaders" type="tns:loadersType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="customInterceptors" type="tns:customInterceptorsType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="clustering" type="tns:clusteringType" minOccurs="0" maxOccurs="1"/>
- </xs:all>
- </xs:complexType>
-
- <xs:complexType name="namedCacheConfigurationType">
- <xs:all>
- <xs:element name="locking" type="tns:lockingType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="transaction" type="tns:transactionType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="startup" type="tns:startupType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="shutdown" type="tns:shutdownType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="serialization" type="tns:serializationType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="jmxStatistics" type="tns:jmxStatisticsType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="listeners" type="tns:listenersType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="invocationBatching" type="tns:invocationBatchingType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="eviction" type="tns:evictionType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="loaders" type="tns:loadersType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="customInterceptors" type="tns:customInterceptorsType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="clustering" type="tns:clusteringType" minOccurs="0" maxOccurs="1"/>
- </xs:all>
- <xs:attribute name="name" type="xs:string"/>
- </xs:complexType>
-
- <xs:complexType name="clusteringType">
- <xs:all>
- <xs:element name="sync" type="tns:syncType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="async" type="tns:asyncType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="stateRetrieval" type="tns:stateRetrievalType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="buddy" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:all minOccurs="0">
- <xs:element name="dataGravitation" maxOccurs="1">
- <xs:complexType>
- <xs:attribute name="auto" type="tns:booleanType"/>
- <xs:attribute name="removeOnFind" type="tns:booleanType"/>
- <xs:attribute name="searchBackupTrees" type="tns:booleanType"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="locator" maxOccurs="1">
- <xs:complexType>
- <xs:all>
- <xs:element name="properties" type="xs:string" maxOccurs="1"/>
- </xs:all>
- <xs:attribute name="class" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- </xs:all>
- <xs:attribute name="enabled" type="tns:booleanType"/>
- <xs:attribute name="poolName" type="xs:string"/>
- <xs:attribute name="communicationTimeout" type="xs:integer"/>
- </xs:complexType>
- </xs:element>
- </xs:all>
- <xs:attribute name="mode">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:pattern
- value="[Rr][Ee][Pp][Ll][Ii][Cc][Aa][Tt][Ii][Oo][Nn]|[Ii][Nn][Vv][Aa][Ll][Ii][Dd][Aa][Tt][Ii][Oo][Nn]|[Rr]|[Ii]|\$\{.*\}"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="clusterName" type="xs:string"/>
-
-
- </xs:complexType>
-
- <xs:complexType name="lockingType">
- <xs:attribute name="isolationLevel">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:pattern
- value="[Ss][Ee][Rr][Ii][Aa][Ll][Ii][Zz][Aa][Bb][Ll][Ee]|[Rr][Ee][Pp][Ee][Aa][Tt][Aa][Bb][Ll][Ee]_[Rr][Ee][Aa][Dd]|[Rr][Ee][Aa][Dd]_[Cc][Oo][Mm][Mm][Ii][Tt][Tt][Ee][Dd]|[Nn][Oo][Nn][Ee]|\$\{.*\}"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="lockParentForChildInsertRemove" type="tns:booleanType"/>
- <xs:attribute name="lockAcquisitionTimeout" type="tns:positiveInteger"/>
- <xs:attribute name="writeSkewCheck" type="tns:booleanType"/>
- <xs:attribute name="concurrencyLevel" type="xs:integer"/>
- </xs:complexType>
-
- <xs:complexType name="transactionType">
- <xs:attribute name="transactionManagerLookupClass" type="xs:string"/>
- <xs:attribute name="syncRollbackPhase" type="tns:booleanType"/>
- <xs:attribute name="syncCommitPhase" type="tns:booleanType"/>
- </xs:complexType>
-
- <xs:complexType name="startupType">
- <xs:attribute name="regionsInactiveOnStartup" type="tns:booleanType"/>
- </xs:complexType>
-
- <xs:complexType name="stateRetrievalType">
- <xs:attribute name="fetchInMemoryState" type="tns:booleanType"/>
- <xs:attribute name="timeout" type="tns:positiveInteger"/>
- </xs:complexType>
-
- <xs:complexType name="shutdownType">
- <xs:attribute name="hookBehavior">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:pattern
- value="[Dd][Ee][Ff][Aa][Uu][Ll][Tt]|[Rr][Ee][Gg][Ii][Ss][Tt][Ee][Rr]|[Dd][Oo][Nn][Tt]_[Rr][Ee][Gg][Ii][Ss][Tt][Ee][Rr]|\$\{.*\}"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
-
- <xs:complexType name="serializationType">
- <xs:attribute name="useLazyDeserialization" type="tns:booleanType"/>
- </xs:complexType>
-
- <xs:simpleType name="booleanType">
- <xs:restriction base="xs:string">
- <xs:pattern value="\$\{.*\}|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="positiveInteger">
- <xs:restriction base="xs:string">
- <xs:pattern value="\$\{.*\}|\+?[0-9]*"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="jmxStatisticsType">
- <xs:attribute name="enabled" type="tns:booleanType"/>
- </xs:complexType>
-
- <xs:complexType name="listenersType">
- <xs:attribute name="asyncPoolSize" type="tns:positiveInteger"/>
- <xs:attribute name="asyncQueueSize" type="tns:positiveInteger"/>
- </xs:complexType>
-
- <xs:complexType name="invocationBatchingType">
- <xs:attribute name="enabled" type="tns:booleanType"/>
- </xs:complexType>
-
- <xs:complexType name="jgroupsConfigType">
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="configFile" type="xs:string"/>
- <xs:attribute name="multiplexerStack" type="xs:string"/>
- </xs:complexType>
-
- <xs:complexType name="syncType">
- <xs:attribute name="replTimeout" type="tns:positiveInteger"/>
- </xs:complexType>
-
- <xs:complexType name="asyncType">
- <xs:attribute name="useReplQueue" type="tns:booleanType"/>
- <xs:attribute name="replQueueInterval" type="tns:positiveInteger"/>
- <xs:attribute name="replQueueMaxElements" type="tns:positiveInteger"/>
- <xs:attribute name="serializationExecutorPoolSize" type="tns:positiveInteger"/>
- <xs:attribute name="serializationExecutorQueueSize" type="tns:positiveInteger"/>
- </xs:complexType>
-
- <xs:complexType name="evictionType">
- <xs:sequence>
- <xs:element name="default" type="tns:evictionRegionType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="region" minOccurs="0" maxOccurs="unbounded" type="tns:evictionRegionType"/>
- </xs:sequence>
- <xs:attribute name="wakeUpInterval" type="tns:positiveInteger" use="required"/>
- </xs:complexType>
-
- <xs:complexType name="evictionRegionType">
- <xs:sequence>
- <xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="tns:propertyType"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="algorithmClass" type="xs:string"/>
- <xs:attribute name="actionPolicyClass" type="xs:string"/>
- <xs:attribute name="eventQueueSize" type="tns:positiveInteger"/>
- </xs:complexType>
-
- <xs:complexType name="loadersType">
- <xs:sequence>
- <xs:element name="preload" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="node" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="fqn" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="loader" maxOccurs="unbounded">
- <xs:complexType>
- <xs:all>
- <xs:element name="properties"/>
- <xs:element name="singletonStore" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:all>
- <xs:element name="properties" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:all>
- <xs:attribute name="enabled" type="tns:booleanType"/>
- <xs:attribute name="class" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- </xs:all>
- <xs:attribute name="class" type="xs:string"/>
- <xs:attribute name="async" type="tns:booleanType"/>
- <xs:attribute name="fetchPersistentState" type="tns:booleanType"/>
- <xs:attribute name="ignoreModifications" type="tns:booleanType"/>
- <xs:attribute name="purgeOnStartup" type="tns:booleanType"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="passivation" type="tns:booleanType"/>
- <xs:attribute name="shared" type="tns:booleanType"/>
- </xs:complexType>
-
- <xs:complexType name="customInterceptorsType">
- <xs:sequence>
- <xs:element name="interceptor" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="property" maxOccurs="unbounded" type="tns:propertyType" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="class" type="xs:string"/>
- <xs:attribute name="position">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:pattern value="[Ff][Ii][Rr][Ss][Tt]|[Ll][Aa][Ss][Tt]"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="before" type="xs:string"/>
- <xs:attribute name="after" type="xs:string"/>
- <xs:attribute name="index" type="tns:positiveInteger"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="propertyType">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="value" type="xs:string"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-</xs:schema>
-
Deleted: core/branches/flat/src/main/resources/schema/starobrno-registry-1.0.xsd
===================================================================
--- core/branches/flat/src/main/resources/schema/starobrno-registry-1.0.xsd 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/main/resources/schema/starobrno-registry-1.0.xsd 2009-01-26 11:58:54 UTC (rev 7596)
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
- xmlns:tns="urn:jboss:starobrno-core:config:1.0"
- xmlns:repo="urn:jboss:starobrno-core:cache-repo:1.0"
- targetNamespace="urn:jboss:starobrno-core:cache-repo:1.0"
- xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
- <xs:import schemaLocation="starobrno-config-1.0.xsd" namespace="urn:jboss:starobrno-core:config:1.0"/>
-
- <xs:element name="cache-configs">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="cache-config" type="repo:cacheConfig" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:complexType name="cacheConfig">
- <xs:complexContent>
- <xs:extension base="tns:cacheConfigurationType" xml:space="default">
- <xs:attribute name="name" type="xs:string"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-</xs:schema>
Modified: core/branches/flat/src/test/resources/configs/named-cache-test.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-01-26 11:58:54 UTC (rev 7596)
@@ -1,55 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
+<horizon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:horizon:config:1.0">
- <global>
+ <global>
- <asyncListenerExecutor factory="org.horizon.executors.DefaultExecutorFactory">
- <property name="maxThreads">5</property>
- <property name="threadNamePrefix">AsyncListenerThread</property>
- </asyncListenerExecutor>
+ <asyncListenerExecutor factory="org.horizon.executors.DefaultExecutorFactory">
+ <property name="maxThreads">5</property>
+ <property name="threadNamePrefix">AsyncListenerThread</property>
+ </asyncListenerExecutor>
- <asyncSerializationExecutor factory="org.horizon.executors.DefaultExecutorFactory">
- <property name="maxThreads">25</property>
- <property name="threadNamePrefix">AsyncSerializationThread</property>
- </asyncSerializationExecutor>
+ <asyncSerializationExecutor factory="org.horizon.executors.DefaultExecutorFactory">
+ <property name="maxThreads">25</property>
+ <property name="threadNamePrefix">AsyncSerializationThread</property>
+ </asyncSerializationExecutor>
- <evictionScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix">EvictionThread</property>
- </evictionScheduledExecutor>
+ <evictionScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
+ <property name="threadNamePrefix">EvictionThread</property>
+ </evictionScheduledExecutor>
- <replicationQueueScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
- <property name="threadNamePrefix">ReplicationQueueThread</property>
- </replicationQueueScheduledExecutor>
+ <replicationQueueScheduledExecutor factory="org.horizon.executors.DefaultScheduledExecutorFactory">
+ <property name="threadNamePrefix">ReplicationQueueThread</property>
+ </replicationQueueScheduledExecutor>
- <jgroupsConfig configFile="udp.xml"/>
+ <transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport"/>
- <serialization marshallerClass="org.horizon.marshall.CacheMarshallerStarobrno" version="1.0"
- objectInputStreamPoolSize="100" objectOutputStreamPoolSize="100"/>
+ <serialization marshallerClass="org.horizon.marshall.CacheMarshallerStarobrno" version="1.0"
+ objectInputStreamPoolSize="100" objectOutputStreamPoolSize="100"/>
- </global>
+ </global>
- <default>
- <locking concurrencyLevel="100" lockAcquisitionTimeout="1000"/>
- </default>
+ <default>
+ <locking concurrencyLevel="100" lockAcquisitionTimeout="1000"/>
+ </default>
- <namedCache name="transactional">
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- </namedCache>
+ <namedCache name="transactional">
+ <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
+ </namedCache>
- <namedCache name="syncRepl">
+ <namedCache name="syncRepl">
+ <clustering>
+ <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
+ <sync replTimeout="15000"/>
+ </clustering>
+ </namedCache>
- <clustering>
- <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
- <sync replTimeout="15000"/>
- </clustering>
- </namedCache>
+ <namedCache name="asyncRepl">
+ <clustering>
+ <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
+ <async useAsyncSerialization="false"/>
+ </clustering>
+ </namedCache>
- <namedCache name="txSyncRepl">
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering>
- <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
- <sync replTimeout="15000"/>
- </clustering>
- </namedCache>
+ <namedCache name="asyncReplQueue">
+ <clustering>
+ <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
+ <async useReplQueue="true"/>
+ </clustering>
+ </namedCache>
-</jbosscache>
+ <namedCache name="txSyncRepl">
+ <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
+ <clustering>
+ <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
+ <sync replTimeout="15000"/>
+ </clustering>
+ </namedCache>
+
+</horizon>
Deleted: core/branches/flat/src/test/resources/configs/parser-test-async.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/parser-test-async.xml 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/test/resources/configs/parser-test-async.xml 2009-01-26 11:58:54 UTC (rev 7596)
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- file used for functional test of the xml parser -->
-
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
-
-
- <locking isolationLevel="REPEATABLE_READ" lockParentForChildInsertRemove="true" lockAcquisitionTimeout="10234"
- writeSkewCheck="false" concurrencyLevel="21"/>
-
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"
- syncRollbackPhase="true" syncCommitPhase="true"/>
-
- <jmxStatistics enabled="false"/>
-
- <startup regionsInactiveOnStartup="true"/>
- <shutdown hookBehavior="REGISTER"/>
- <listeners asyncPoolSize="5" asyncQueueSize="100000"/>
- <invocationBatching enabled="true"/>
-
- <!-- serialization related configuration, used for replication and cache loading -->
- <serialization objectInputStreamPoolSize="12" objectOutputStreamPoolSize="14" version="1.2.4"
- marshallerClass="some.Clazz" useLazyDeserialization="true" useRegionBasedMarshalling="true"/>
-
- <clustering mode="replication" clusterName="JBossCache-cluster">
- <async useReplQueue="false" serializationExecutorPoolSize="250" serializationExecutorQueueSize="5000000"/>
- <stateRetrieval timeout="15124" fetchInMemoryState="true"/>
- <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
- <dataGravitation auto="true" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- numBuddies = 1
- ignoreColocatedBuddies = true
- </properties>
- </locator>
- </buddy>
- <jgroupsConfig>
- <PING timeout="2000" num_initial_members="3"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD timeout="10000" max_tries="5" shun="true"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800"
- discard_delivered_msgs="true"/>
- <UNICAST timeout="300,600,1200,2400,3600"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
- max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
- view_bundling="true" view_ack_collection_timeout="5000"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
- <!-- <pbcast.STATE_TRANSFER/> -->
- <pbcast.FLUSH timeout="0"/>
- </jgroupsConfig>
- </clustering>
-
- <eviction wakeUpInterval="5">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000"/>
- </default>
- <region name="/org/jboss/data">
- <property name="timeToLive" value="1002"/>
- </region>
- <region name="/org/jboss/xyz" algorithmClass="org.jboss.cache.eviction.MRUAlgorithm" eventQueueSize="21">
- <property name="maxNodes" value="2103"/>
- <property name="minTimeToLive" value="22"/>
- </region>
- </eviction>
-
- <!-- this should be deprecated in 3.0 and should be replaced with CacheLoaderConfig-->
- <loaders passivation="true" shared="true">
- <preload>
- <node fqn="/a/b/c"/>
- <node fqn="/f/r/s"/>
- </preload>
-
- <!-- we can now have multiple cache loaders, which get chained -->
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
- ignoreModifications="true" purgeOnStartup="true">
- <properties>
- cache.jdbc.table.name=jbosscache
- cache.jdbc.table.create=true
- cache.jdbc.table.drop=true
- </properties>
- <singletonStore enabled="true" class="org.horizon.loader.SingletonStoreCacheLoader">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=20000
- </properties>
- </singletonStore>
- </loader>
- </loaders>
-
- <!-- this is new behavior added within 3.x only. it support configuring custom interceptors through configurations -->
- <customInterceptors>
- <interceptor position="first" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor">
- <property name="attrOne" value="value1"/>
- <property name="attrTwo" value="value2"/>
- </interceptor>
- <interceptor position="last" class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
- <interceptor index="3" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
- <interceptor before="org.jboss.cache.interceptors.CallInterceptor"
- class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
- <interceptor after="org.jboss.cache.interceptors.CallInterceptor"
- class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
- </customInterceptors>
-
- <!-- the number of threads to use for asynchronous cache listeners - defaults to 1 -->
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/parser-test.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/parser-test.xml 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/test/resources/configs/parser-test.xml 2009-01-26 11:58:54 UTC (rev 7596)
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- file used for functional test of the xml parser -->
-
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- perCache -> differrent EntryFactory-->
- <locking isolationLevel="REPEATABLE_READ" lockParentForChildInsertRemove="true" lockAcquisitionTimeout="10234"
- writeSkewCheck="false" concurrencyLevel="21"/>
-
- <!-- perCM -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"
- syncRollbackPhase="true" syncCommitPhase="true"/>
-
- <jmxStatistics enabled="false"/>
-
- <startup regionsInactiveOnStartup="true"/>
- <shutdown hookBehavior="REGISTER"/>
- <listeners asyncPoolSize="5"/>
- <!-- perCache -->
- <invocationBatching enabled="true"/>
-
- <!-- per CM-->
- <!-- serialization related configuration, used for replication and cache loading -->
- <serialization objectInputStreamPoolSize="12" objectOutputStreamPoolSize="14" version="1.2.4"
- marshallerClass="some.Clazz" useLazyDeserialization="true" useRegionBasedMarshalling="true"/>
-
- <!-- per Cache -->
- <clustering mode="replication" clusterName="JBossCache-cluster">
- <stateRetrieval timeout="15124" fetchInMemoryState="true"/>
- <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
- <dataGravitation auto="true" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- numBuddies = 1
- ignoreColocatedBuddies = true
- </properties>
- </locator>
- </buddy>
- <sync replTimeout="15421"/>
- <jgroupsConfig multiplexerStack="file_name"/>
- </clustering>
-
- <!-- per cache, 1) algo/cache 2) what/cache 3) collecting data 4) timer thread / per CM -->
- <eviction wakeUpInterval="5">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000"/>
- </default>
- <region name="/org/jboss/data">
- <property name="timeToLive" value="1002"/>
- </region>
- <region name="/org/jboss/xyz" algorithmClass="org.jboss.cache.eviction.MRUAlgorithm" eventQueueSize="21">
- <property name="maxNodes" value="2103"/>
- <property name="minTimeToLive" value="22"/>
- </region>
- </eviction>
-
- <!-- cacheLoaders/Cache; optimization - reusing CL through caches -->
- <!-- this should be deprecated in 3.0 and should be replaced with CacheLoaderConfig-->
- <loaders passivation="true" shared="true">
- <preload>
- <node fqn="/a/b/c"/>
- <node fqn="/f/r/s"/>
- </preload>
-
- <!-- we can now have multiple cache loaders, which get chained -->
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
- ignoreModifications="true" purgeOnStartup="true">
- <properties>
- cache.jdbc.table.name=jbosscache
- cache.jdbc.table.create=true
- cache.jdbc.table.drop=true
- </properties>
- <singletonStore enabled="true" class="org.horizon.loader.SingletonStoreCacheLoader">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=20000
- </properties>
- </singletonStore>
- </loader>
- </loaders>
-
- <!-- per CacheInstance -->
- <!-- this is new behavior added within 3.x only. it support configuring custom interceptors through configurations -->
- <customInterceptors>
- <interceptor position="first" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor">
- <property name="attrOne" value="value1"/>
- <property name="attrTwo" value="value2"/>
- </interceptor>
- <interceptor position="last" class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
- <interceptor index="3" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
- <interceptor before="org.jboss.cache.interceptors.CallInterceptor"
- class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
- <interceptor after="org.jboss.cache.interceptors.CallInterceptor"
- class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
- </customInterceptors>
-
- <!-- the number of threads to use for asynchronous cache listeners - defaults to 1 -->
-</jbosscache>
Modified: core/branches/flat/src/test/resources/configs/string-property-replaced.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/string-property-replaced.xml 2009-01-26 10:49:29 UTC (rev 7595)
+++ core/branches/flat/src/test/resources/configs/string-property-replaced.xml 2009-01-26 11:58:54 UTC (rev 7596)
@@ -1,44 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
- <locking lockAcquisitionTimeout="${test.property.LockAcquisitionTimeout:15000}"/>
+<horizon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:horizon:config:1.0">
- <transaction syncCommitPhase="${test.property.SyncCommitPhase:true}" syncRollbackPhase="true"/>
+ <!-- *************************** -->
+ <!-- System-wide global settings -->
+ <!-- *************************** -->
- <serialization useRegionBasedMarshalling="true"/>
- <clustering>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <jgroupsConfig multiplexerStack="udp-sync"/>
- <sync replTimeout="20000"/>
- <buddy enabled="${test.property.BuddyReplicationConfig.enabled:true}"
- poolName="${test.property.BuddyReplicationConfig.buddyPoolName:default}" communicationTimeout="2000">
- <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- ignoreColocatedBuddies = true
- numBuddies = ${test.property.BuddyReplicationConfig.numBuddies:1}
- </properties>
- </locator>
- </buddy>
- </clustering>
+ <global>
- <startup regionsInactiveOnStartup="true"/>
- <eviction wakeUpInterval="5000">
- <default
- algorithmClass="${test.property.EvictionPolicyConfig.policyClass:org.jboss.cache.eviction.LRUAlgorithm}">
- <property name="maxNodes" value="${test.property.EvictionPolicyConfig.maxNodes:5000}"/>
- <property name="timeToLive" value="1000000"/>
- </default>
- </eviction>
- <loaders passivation="true" shared="false">
- <preload>
- <node fqn="/"/>
- </preload>
- <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
- ignoreModifications="false">
- <properties>
- location=${test.property.CacheLoaderConfiguration.location,java.io.tmpdir:/tmp}
- </properties>
- </loader>
- </loaders>
-</jbosscache>
+ <asyncListenerExecutor factory="org.horizon.executors.DefaultExecutorFactory">
+ <property name="maxThreads">${test.property.asyncListenerMaxThreads:5}</property>
+ <property name="threadNamePrefix">AsyncListenerThread</property>
+ </asyncListenerExecutor>
+
+ <transport transportClass="org.horizon.remoting.transport.jgroups.JGroupsTransport">
+ <property name="configurationFile">${test.property.jgroupsConfigFile:udp.xml}</property>
+ </transport>
+
+ </global>
+
+ <!-- *************************** -->
+ <!-- Default "template" settings -->
+ <!-- *************************** -->
+ <default>
+ <locking
+ isolationLevel="REPEATABLE_READ"
+ lockAcquisitionTimeout="${test.property.LockAcquisitionTimeout:15000}"
+ writeSkewCheck="false"
+ concurrencyLevel="500"/>
+
+ <transaction
+ transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"
+ syncRollbackPhase="false"
+ syncCommitPhase="${test.property.SyncCommitPhase:true}"/>
+
+ <clustering clusterName="BlahBlah">
+ <sync/>
+ </clustering>
+ </default>
+</horizon>
15 years, 11 months
JBoss Cache SVN: r7595 - core/branches/flat/src/test/resources.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-26 05:49:29 -0500 (Mon, 26 Jan 2009)
New Revision: 7595
Modified:
core/branches/flat/src/test/resources/cache-jdbc.properties
Log:
Default testing JDBC settings
Modified: core/branches/flat/src/test/resources/cache-jdbc.properties
===================================================================
--- core/branches/flat/src/test/resources/cache-jdbc.properties 2009-01-26 10:24:58 UTC (rev 7594)
+++ core/branches/flat/src/test/resources/cache-jdbc.properties 2009-01-26 10:49:29 UTC (rev 7595)
@@ -3,19 +3,15 @@
# The table name can also be prepended with schema name for the given table.
# Even though there is an Sql92 standard syntax for this: <schema_name>.<table name>
#schema has different meanings accross various DBMS: Oracle - user name; PointBase - database name
-# Microsoft SQL Server & DB2 - schema name corresponds to the catalog owner
-cache.jdbc.table.name=jbosscache
-cache.jdbc.table.create=true
-cache.jdbc.table.drop=false
-cache.jdbc.table.primarykey=jbosscache_pk
-cache.jdbc.fqn.column=fqn
-cache.jdbc.fqn.type=varchar(255)
-cache.jdbc.node.column=node
-cache.jdbc.node.type=blob
-cache.jdbc.parent.column=parent
+# Microsoft SQL Server & DB2 - schema name corresponds to the catalog owner
-# JBoss Cache Table properties for Hypersonic, just overrides
-#cache.jdbc.node.type=OBJECT
+horizon.jdbc.table.name=horizon
+horizon.jdbc.table.create=true
+horizon.jdbc.table.drop=false
+horizon.jdbc.table.primarykey=CACHE_KEY
+horizon.jdbc.key.column=CACHE_KEY
+horizon.jdbc.key.type=VARCHAR(255)
+horizon.jdbc.node.column=CACHE_VALUE
##
# DataSource
@@ -25,41 +21,46 @@
# JDBC driver specific properties
# Hypersonic
-#cache.jdbc.node.type=OBJECT
+cache.jdbc.node.type=BINARY
+cache.jdbc.driver = org.hsqldb.jdbcDriver
+cache.jdbc.url=jdbc:hsqldb:mem:horizondb
+cache.jdbc.user=sa
+cache.jdbc.password=
+
## MySql
#cache.jdbc.driver=com.mysql.jdbc.Driver
-#cache.jdbc.url=jdbc:mysql://localhost:3306/jbossdb
+#cache.jdbc.url=jdbc:mysql://localhost:3306/horizondb
#cache.jdbc.user=root
#cache.jdbc.password=admin
## Oracle
#cache.jdbc.driver=oracle.jdbc.OracleDriver
-#cache.jdbc.url=jdbc:oracle:thin:@192.168.0.100:1521:JBOSSDB
-#cache.jdbc.user=jboss
-#cache.jdbc.password=sa
+#cache.jdbc.url=jdbc:oracle:thin:@192.168.0.100:1521:HORIZONDB
+#cache.jdbc.user=scott
+#cache.jdbc.password=tiger
## MS Sql Server
#cache.jdbc.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
-#cache.jdbc.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jbossdb;SelectMethod=cursor
+#cache.jdbc.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=horizondb;SelectMethod=cursor
#cache.jdbc.user=sa
#cache.jdbc.password=
#cache.jdbc.node.type=image
## Pointbase
#cache.jdbc.driver=com.pointbase.jdbc.jdbcUniversalDriver
-#cache.jdbc.url=jdbc:pointbase:server://localhost:9092/jboss,new
+#cache.jdbc.url=jdbc:pointbase:server://localhost:9092/horizon,new
#cache.jdbc.user=PBPUBLIC
#cache.jdbc.password=PBPUBLIC
## PostgreSQL
#cache.jdbc.driver = org.postgresql.Driver
-#cache.jdbc.url=jdbc:postgresql://192.168.0.100:5432/jbossdb
+#cache.jdbc.url=jdbc:postgresql://192.168.0.100:5432/horizondb
#cache.jdbc.user=postgres
#cache.jdbc.password=admin
## Derby
-cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
-cache.jdbc.url=jdbc:derby:jbossdb;create=true
-cache.jdbc.user=user1
-cache.jdbc.password=user1
\ No newline at end of file
+#cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+#cache.jdbc.url=jdbc:derby:horizondb;create=true
+#cache.jdbc.user=user1
+#cache.jdbc.password=user1
\ No newline at end of file
15 years, 11 months
JBoss Cache SVN: r7594 - in core/branches/flat/src: test/resources and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-26 05:24:58 -0500 (Mon, 26 Jan 2009)
New Revision: 7594
Removed:
core/branches/flat/src/main/resources/config-samples/buddy-replication.xml
core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml
core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml
core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml
core/branches/flat/src/main/resources/config-samples/invalidation-async.xml
core/branches/flat/src/main/resources/config-samples/local.xml
core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml
core/branches/flat/src/main/resources/config-samples/string-property-replaced.xml
core/branches/flat/src/main/resources/config-samples/total-replication.xml
core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml
core/branches/flat/src/test/resources/configs/clonable-config.xml
core/branches/flat/src/test/resources/configs/local-lru-eviction.xml
core/branches/flat/src/test/resources/configs/local-passivation.xml
core/branches/flat/src/test/resources/configs/local-tx.xml
core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml
core/branches/flat/src/test/resources/configs/mux.xml
core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml
core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml
core/branches/flat/src/test/resources/configs/replSync.xml
core/branches/flat/src/test/resources/jbc3-registry-configs.xml
core/branches/flat/src/test/resources/unit-test-cache-service.xml
Modified:
core/branches/flat/src/test/resources/cache-jdbc.properties
Log:
Removed unnecessary cfg files
Deleted: core/branches/flat/src/main/resources/config-samples/buddy-replication.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/buddy-replication.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/buddy-replication.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-
- <clustering mode="replication">
- <!--
- timeout: The max amount of time (in milliseconds) we wait until the state (i.e. the contents of the cache) is
- retrieved from existing members in a clustered environment
- -->
- <stateRetrieval timeout="20000"/>
-
-
- <!-- JGroups protocol stack properties. -->
- <jgroupsConfig>
- <TCP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="true"
- enable_unicast_bundling="false" loopback="false" max_bundle_size="64000" max_bundle_timeout="30"
- oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="8"
- oob_thread_pool.min_threads="2" oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" recv_buf_size="20000000" thread_naming_pattern="pl"
- thread_pool.enabled="true" thread_pool.keep_alive_time="30000" thread_pool.max_threads="4"
- thread_pool.min_threads="1" thread_pool.queue_enabled="true" thread_pool.queue_max_size="10000"
- thread_pool.rejection_policy="discard" use_concurrent_stack="true"
- use_send_queues="false"/>
- <MPING mcast_addr="232.1.2.3" num_initial_members="3" timeout="2000"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD max_tries="5" shun="true" timeout="10000"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- use_mcast_xmit="false"/>
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
- <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false"
- view_ack_collection_timeout="5000" view_bundling="true"/>
- <FC max_credits="1000000" min_threshold="0.20"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <pbcast.FLUSH timeout="0"/>
- </jgroupsConfig>
-
-
- <!-- Number of milliseconds to wait until all responses for a synchronous call have been received -->
- <sync replTimeout="15000"/>
-
- <!--
-poolName: A way to specify a preferred replication group. If specified, we try and pick a buddy why shares
- the same pool name (falling back to other buddies if not available). This allows the sysdmin
- to hint at backup buddies are picked, so for example, nodes may be hinted to pick buddies
- on a different physical rack or power supply for added fault tolerance.
-communicationTimeout : communication timeout for inter-buddy group organisation messages (such as assigning
- to and removing from groups
- -->
- <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
-
- <!--
-auto : Should data gravitation be attempted whenever there is a cache miss on finding a node?
-If false, data will only be gravitated if an Option is set enabling it
-removeOnFind: removes data on remote caches' trees and backup subtrees when gravitated to a
- new data owner
-searchBackupTrees: search backup subtrees as well for data when gravitating. Results in backup nodes
- being able to answer data gravitation requests.-->
- <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
-
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <!-- numBuddies is the number of backup nodes each node maintains. ignoreColocatedBuddies means that
- each node will *try* to select a buddy on a different physical host. If not able to do so though,
- it will fall back to colocated nodes. -->
- <properties>
- numBuddies = 1
- ignoreColocatedBuddies = true
- </properties>
- </locator>
- </buddy>
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/cacheloader-enabled.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-
- <!-- Specific eviction policy configurations -->
- <eviction wakeUpInterval="5000">
- <!-- Cache wide default -->
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="3000"/>
- </default>
- <region name="/org/jboss/test/data">
- <property name="maxNodes" value="100"/>
- <property name="timeToLive" value="3000"/>
- </region>
- </eviction>
-
- <!-- Cache Passivation for Tree Cache
-On passivation, The objects are written to the backend store on eviction if passivation
-is true, otherwise the objects are persisted. On activation, the objects are restored in
-the memory cache and removed from the cache loader if 'passivation' attribute is true,
-otherwise the objects are only loaded from the cache loader -->
- <loaders passivation="false" shared="false">
- <preload>
- <node fqn="/"/>
- </preload>
- <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
- <loader
- class="org.jboss.cache.loader.JDBCCacheLoader"
- async="false"
- fetchPersistentState="true"
- ignoreModifications="false"
- purgeOnStartup="false">
- <properties>
- cache.jdbc.table.name=jbosscache
- cache.jdbc.table.create=true
- cache.jdbc.table.drop=true
- cache.jdbc.table.primarykey=jbosscache_pk
- cache.jdbc.fqn.column=fqn
- cache.jdbc.fqn.type=varchar(255)
- cache.jdbc.node.column=node
- cache.jdbc.node.type=blob
- cache.jdbc.parent.column=parent
- cache.jdbc.sql-concat=1 || 2
- cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
- cache.jdbc.url=jdbc:derby:jbossdb;create=true
- cache.jdbc.user=user1
- cache.jdbc.password=user1
- </properties>
- </loader>
- </loaders>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/eviction-enabled.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-
- <!--
- wakeUpInterval: time interval (millis) when the eviction thread kicks in.
- -->
- <eviction wakeUpInterval="5000">
- <!--
- Cache wide defaults
- default algorithmClass: if an algorithm class is not specified for a region, this one is used by default.
- default eventQueueSize if an event queue size is not specified for a region, this one is used by default.
- -->
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </default>
-
- <!-- configurations for various regions-->
- <region name="/org/jboss/data1">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </region>
- <region name="/org/jboss/data2" actionPolicyClass="org.jboss.cache.eviction.RemoveOnEvictActionPolicy">
- <property name="maxNodes" value="5"/>
- <property name="timeToLive" value="4000"/>
- </region>
- <region name="/org/jboss/data3" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm">
- <property name="maxNodes" value="10000"/>
- <property name="minTimeToLive" value="4000"/>
- </region>
- <region name="/org/jboss/data1/otherstuff" eventQueueSize="100000">
- <property name="maxNodes" value="10000"/>
- <property name="timeToLive" value="8000"/>
- <property name="maxAge" value="10000"/>
- </region>
- <region name="/org/jboss/data1/inherit"/>
- </eviction>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/external-jgroups-file.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-
- <clustering>
- <async/>
- <!--
- Here we specify a path to an external JGroups configuration file. First the classpath is scanned, and then
- the filesystem for the file. In this case, "udp.xml" ships with jgroups.jar and will be picked up by the
- classloader.
- -->
- <jgroupsConfig configFile="udp.xml"/>
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/invalidation-async.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/invalidation-async.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/invalidation-async.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-
- <clustering mode="invalidation">
- <!--
- timeout: The max amount of time (in milliseconds) we wait until the
- state (i.e. the contents of the cache) are retrieved from
- existing members in a clustered environment
- -->
- <stateRetrieval timeout="20000"/>
-
- <!-- JGroups protocol stack properties. -->
- <jgroupsConfig>
- <UDP discard_incompatible_packets="true" enable_bundling="true" enable_diagnostics="false" ip_ttl="2"
- loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
- mcast_port="45588" mcast_recv_buf_size="100000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="20"
- oob_thread_pool.min_threads="8" oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
- thread_pool.keep_alive_time="10000" thread_pool.max_threads="15" thread_pool.min_threads="8"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="100000"
- thread_pool.rejection_policy="Discard"
- tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
- use_incoming_packet_handler="true"/>
- <PING num_initial_members="3" timeout="2000"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD max_tries="5" shun="true" timeout="10000"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- use_mcast_xmit="true"/>
- <UNICAST timeout="300,600,1200,2400,3600"/>
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
- <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
- view_bundling="true"/>
- <FC max_credits="500000" min_threshold="0.2"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <pbcast.FLUSH timeout="0"/>
- </jgroupsConfig>
-
- <async/>
- <!-- Alternatively, to use sync replication, comment out the element above and uncomment the element below. -->
- <!-- <sync /> -->
-
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/local.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/local.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/local.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- By not specifying the 'clustering' element, the cache runs in LOCAL mode. -->
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/multiplexer-enabled.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-
- <clustering>
- <sync/>
- <!-- Here is where we specify the multiplexer stack to use. -->
- <jgroupsConfig multiplexerStack="fc-fast-minimalthreads"/>
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/string-property-replaced.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/string-property-replaced.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/string-property-replaced.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <locking lockAcquisitionTimeout="${test.property.LockAcquisitionTimeout:15000}"/>
-
- <transaction syncCommitPhase="${test.property.SyncCommitPhase:true}" syncRollbackPhase="true"/>
-
- <serialization useRegionBasedMarshalling="true"/>
- <clustering>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <jgroupsConfig multiplexerStack="udp-sync"/>
- <sync replTimeout="20000"/>
- <buddy enabled="${test.property.BuddyReplicationConfig.enabled:true}"
- poolName="${test.property.BuddyReplicationConfig.buddyPoolName:default}" communicationTimeout="2000">
- <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- ignoreColocatedBuddies = true
- numBuddies = ${test.property.BuddyReplicationConfig.numBuddies:1}
- </properties>
- </locator>
- </buddy>
- </clustering>
-
- <startup regionsInactiveOnStartup="true"/>
- <eviction wakeUpInterval="5000">
- <default
- algorithmClass="${test.property.EvictionPolicyConfig.policyClass:org.jboss.cache.eviction.LRUAlgorithm}">
- <property name="maxNodes" value="${test.property.EvictionPolicyConfig.maxNodes:5000}"/>
- <property name="timeToLive" value="1000000"/>
- </default>
- </eviction>
- <loaders passivation="true" shared="false">
- <preload>
- <node fqn="/"/>
- </preload>
- <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
- ignoreModifications="false">
- <properties>
- location=${test.property.CacheLoaderConfiguration.location,java.io.tmpdir:/tmp}
- </properties>
- </loader>
- </loaders>
-</jbosscache>
Deleted: core/branches/flat/src/main/resources/config-samples/total-replication.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/total-replication.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/main/resources/config-samples/total-replication.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
-
- <clustering mode="replication">
- <!-- JGroups protocol stack properties. -->
- <jgroupsConfig>
- <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
- loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
- mcast_port="45588" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
- oob_thread_pool.min_threads="1" oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
- thread_pool.keep_alive_time="30000" thread_pool.max_threads="25" thread_pool.min_threads="1"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
- tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
- use_incoming_packet_handler="true"/>
- <PING num_initial_members="3" timeout="2000"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD max_tries="5" shun="true" timeout="10000"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- use_mcast_xmit="false"/>
- <UNICAST timeout="300,600,1200,2400,3600"/>
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
- <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
- view_bundling="true"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <pbcast.FLUSH timeout="0"/>
-
- </jgroupsConfig>
-
- <sync/>
- <!-- Alternatively, to use async replication, comment out the element above and uncomment the element below. -->
- <!-- <async /> -->
-
- </clustering>
-</jbosscache>
Modified: core/branches/flat/src/test/resources/cache-jdbc.properties
===================================================================
--- core/branches/flat/src/test/resources/cache-jdbc.properties 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/cache-jdbc.properties 2009-01-26 10:24:58 UTC (rev 7594)
@@ -13,10 +13,6 @@
cache.jdbc.node.column=node
cache.jdbc.node.type=blob
cache.jdbc.parent.column=parent
-# Specify your DBMS's string concatenation function syntax in the following manner: concat(1 , 2) -> '12'.
-# This syntax should work an most popular DBMS like oracle, db2, mssql, mysql, PostgreSQL. Derby - on which
-#the tests are run does not support 'concat', but '1 || 2' . If no value is sepcified then concat(1 , 2) is used by default.
-cache.jdbc.sql-concat=1 || 2
# JBoss Cache Table properties for Hypersonic, just overrides
#cache.jdbc.node.type=OBJECT
Deleted: core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/buddy-replication-cache.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering clusterName="JBossCache-Cluster">
- <sync replTimeout="15000"/>
-
- <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
- <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- numBuddies = 1
- ignoreColocatedBuddies = true
- </properties>
- </locator>
- </buddy>
- <stateRetrieval timeout="20000"/>
- <jgroupsConfig>
- <TCP recv_buf_size="20000000" use_send_queues="false" loopback="false" discard_incompatible_packets="true"
- max_bundle_size="64000" max_bundle_timeout="30" use_incoming_packet_handler="true"
- enable_bundling="true"
- enable_unicast_bundling="true" enable_diagnostics="true" use_concurrent_stack="true"
- thread_naming_pattern="pl" thread_pool.enabled="true" thread_pool.min_threads="1"
- thread_pool.max_threads="4" thread_pool.keep_alive_time="30000" thread_pool.queue_enabled="true"
- thread_pool.queue_max_size="50000" thread_pool.rejection_policy="discard"
- oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="2" oob_thread_pool.max_threads="4" oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run"/>
- <MPING mcast_addr="232.1.2.3" timeout="2000" num_initial_members="3"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD timeout="10000" max_tries="5" shun="true"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- discard_delivered_msgs="true"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000" join_retry_timeout="2000" shun="false"
- view_bundling="true" view_ack_collection_timeout="5000"/>
- <FC max_credits="5000000" min_threshold="0.20"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
- <pbcast.FLUSH timeout="0"/>
- </jgroupsConfig>
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/clonable-config.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/clonable-config.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/clonable-config.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,144 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
- <locking isolationLevel="SERIALIZABLE" lockAcquisitionTimeout="1"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering clusterName="CloneCluster">
- <stateRetrieval fetchInMemoryState="false" timeout="3"/>
- <jgroupsConfig multiplexerStack="udp">
- <UDP mcast_addr="228.10.10.10" mcast_port="45588" tos="8" ucast_recv_buf_size="20000000"
- ucast_send_buf_size="640000" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
- loopback="false"
- discard_incompatible_packets="true" max_bundle_size="64000" max_bundle_timeout="30"
- use_incoming_packet_handler="true" ip_ttl="2" enable_bundling="false" enable_diagnostics="true"
- use_concurrent_stack="true" thread_naming_pattern="pl" thread_pool.enabled="true"
- thread_pool.min_threads="1" thread_pool.max_threads="25" thread_pool.keep_alive_time="30000"
- thread_pool.queue_enabled="true" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
- oob_thread_pool.enabled="true" oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="4"
- oob_thread_pool.keep_alive_time="10000" oob_thread_pool.queue_enabled="true"
- oob_thread_pool.queue_max_size="10" oob_thread_pool.rejection_policy="Run"/>
- <PING timeout="2000" num_initial_members="3"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD timeout="10000" max_tries="5" shun="true"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- discard_delivered_msgs="true"/>
- <UNICAST timeout="300,600,1200,2400,3600"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false" view_bundling="true"
- view_ack_collection_timeout="5000"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
- <pbcast.FLUSH timeout="0"/>
- </jgroupsConfig>
- <sync replTimeout="2"/>
- <buddy enabled="true" poolName="cloneGroup" communicationTimeout="7">
- <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- numBuddies = 11
- ignoreColocatedBuddies = true
- </properties>
- </locator>
- </buddy>
-
- </clustering>
- <eviction wakeUpInterval="45000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="4">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- <property name="maxAge" value="15000"/>
- </default>
- <region name="/fifo" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm">
- <property name="maxNodes" value="5000"/>
- </region>
- <region name="/mru" algorithmClass="org.jboss.cache.eviction.MRUAlgorithm">
- <property name="maxNodes" value="10000"/>
- </region>
- <region name="/lfu" algorithmClass="org.jboss.cache.eviction.LFUAlgorithm">
- <property name="maxNodes" value="5000"/>
- <property name="minNodes" value="4000"/>
- </region>
- </eviction>
- <loaders passivation="false" shared="true">
- <preload>
- <node fqn="/"/>
- </preload>
- <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
- ignoreModifications="false">
- <properties>
- location=/tmp/FileCacheLoader
- </properties>
- <singletonStore enabled="false">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=5000
- </properties>
- </singletonStore>
- </loader>
- <loader class="org.jboss.cache.loader.bdbje.BdbjeCacheLoader" async="false" fetchPersistentState="false"
- ignoreModifications="false">
- <properties>
- location=/tmp/BdbjeCacheLoader
- </properties>
- <singletonStore enabled="false">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=5000
- </properties>
- </singletonStore>
- </loader>
- <loader class="org.jboss.cache.loader.jdbm.JdbmCacheLoader" async="false" fetchPersistentState="false"
- ignoreModifications="false">
- <properties>
- location=/tmp/JdbmCacheLoader
- </properties>
- <singletonStore enabled="false">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=5000
- </properties>
- </singletonStore>
- </loader>
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
- ignoreModifications="false">
- <properties>
- cache.jdbc.driver=com.foo.jdbc.Driver
- cache.jdbc.url=foo://driver
- cache.jdbc.user=sa
- cache.jdbc.password=secret
- </properties>
- <singletonStore enabled="false">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=5000
- </properties>
- </singletonStore>
- </loader>
- <loader class="org.jboss.cache.loader.TcpDelegatingCacheLoader" async="false" fetchPersistentState="false"
- ignoreModifications="false">
- <properties>
- host=127.0.0.1\nport=12121
- </properties>
- <singletonStore enabled="false">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=5000
- </properties>
- </singletonStore>
- </loader>
- <loader class="org.horizon.loader.ClusteredCacheLoader" async="false" fetchPersistentState="false"
- ignoreModifications="false">
- <properties>
- timeout=500
- </properties>
- <singletonStore enabled="false">
- <properties>
- pushStateWhenCoordinator=true
- pushStateWhenCoordinatorTimeout=5000
- </properties>
- </singletonStore>
- </loader>
- </loaders>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/local-lru-eviction.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/local-lru-eviction.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/local-lru-eviction.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering clusterName="JBossCache-Cluster">
- <stateRetrieval timeout="20000"/>
- </clustering>
-
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </default>
- <region name="/org/jboss/data">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </region>
- <region name="/org/jboss/test/data">
- <property name="maxNodes" value="5"/>
- <property name="timeToLive" value="4000"/>
- </region>
- <region name="/test">
- <property name="maxNodes" value="10000"/>
- <property name="timeToLive" value="4000"/>
- </region>
- <region name="/maxAgeTest">
- <property name="maxNodes" value="10000"/>
- <property name="timeToLive" value="8000"/>
- <property name="maxAge" value="10000"/>
- </region>
- </eviction>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/local-passivation.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/local-passivation.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/local-passivation.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <eviction wakeUpInterval="1000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000"/>
- </default>
- <region name="/org/jboss/test/data">
- <property name="maxNodes" value="100"/>
- <property name="timeToLive" value="1000"/>
- </region>
- </eviction>
- <loaders passivation="true" shared="false">
- <preload>
- <node fqn="/"/>
- </preload>
- <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
- ignoreModifications="false">
- <properties>
- </properties>
- </loader>
- </loaders>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/local-tx.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/local-tx.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/local-tx.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="false"/>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </default>
- <region name="/org/jboss/data">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </region>
- <region name="/org/jboss/test/data">
- <property name="maxNodes" value="5"/>
- <property name="timeToLive" value="4000"/>
- </region>
- </eviction>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/mixedPolicy-eviction.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering>
- <stateRetrieval timeout="20000"/>
- <jgroupsConfig configFile="udp.xml"/>
- </clustering>
-
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </default>
- <region name="/org/jboss/data" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm">
- <property name="maxNodes" value="5000"/>
- </region>
- <region name="/test/" algorithmClass="org.jboss.cache.eviction.MRUAlgorithm">
- <property name="maxNodes" value="10000"/>
- </region>
- <region name="/maxAgeTest/">
- <property name="maxNodes" value="10000"/>
- <property name="timeToLive" value="8000"/>
- <property name="maxAge" value="10000"/>
- </region>
- </eviction>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/mux.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/mux.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/mux.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering>
- <stateRetrieval timeout="20000"/>
- <jgroupsConfig multiplexerStack="tcp"/>
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/mvcc-repl-sync-br.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering>
- <stateRetrieval fetchInMemoryState="false"/>
- <jgroupsConfig>
- <TCP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false"
- enable_unicast_bundling="false" loopback="false" max_bundle_size="64000" max_bundle_timeout="30"
- oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
- oob_thread_pool.min_threads="2" oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run" recv_buf_size="20000000" thread_naming_pattern="pl"
- thread_pool.enabled="true" thread_pool.keep_alive_time="30000" thread_pool.max_threads="4"
- thread_pool.min_threads="1" thread_pool.queue_enabled="true" thread_pool.queue_max_size="50000"
- thread_pool.rejection_policy="discard" use_concurrent_stack="true" use_incoming_packet_handler="true"
- use_send_queues="false"/>
- <MPING mcast_addr="232.1.2.3" num_initial_members="3" timeout="2000"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <FD max_tries="5" shun="true" timeout="10000"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
- use_mcast_xmit="false"/>
- <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
- <pbcast.GMS join_retry_timeout="2000" join_timeout="5000" print_local_addr="true" shun="false"
- view_ack_collection_timeout="5000" view_bundling="true"/>
- <FC max_credits="5000000" min_threshold="0.20"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
- <pbcast.FLUSH timeout="0"/>
- </jgroupsConfig>
- <async/>
- <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
- <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
- <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
- <properties>
- numBuddies = 1
- ignoreColocatedBuddies = true
- </properties>
- </locator>
- </buddy>
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/policyPerRegion-eviction.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <clustering clusterName="JBossCache-Cluster123"/>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000000"/>
- </default>
- <region name="/org/jboss/data" algorithmClass="org.jboss.cache.eviction.LFUAlgorithm">
- <property name="maxNodes" value="5000"/>
- <property name="minNodes" value="1000"/>
- </region>
- <region name="/org/jboss/test/data" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm">
- <property name="maxNodes" value="5"/>
- </region>
- <region name="/test/" algorithmClass="org.jboss.cache.eviction.MRUAlgorithm">
- <property name="maxNodes" value="10000"/>
- </region>
- <region name="/maxAgeTest/" algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="10000"/>
- <property name="timeToLive" value="8000"/>
- <property name="maxAge" value="10000"/>
- </region>
- </eviction>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/configs/replSync.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/replSync.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/configs/replSync.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:starobrno-core:config:1.0">
-
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="true"/>
- <clustering>
- <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
- <jgroupsConfig configFile="udp.xml"/>
- <sync replTimeout="15000"/>
- </clustering>
-</jbosscache>
Deleted: core/branches/flat/src/test/resources/jbc3-registry-configs.xml
===================================================================
--- core/branches/flat/src/test/resources/jbc3-registry-configs.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/jbc3-registry-configs.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,185 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<registry:cache-configs xmlns="urn:jboss:jbosscache-core:config:3.0"
- xmlns:registry="urn:jboss:jbosscache-core:cache-repo:3.0">
-
- <!--
- Various JBoss Cache configurations, suitable for different caching
- uses (e.g. entities vs. queries).
-
- In all cases, TransactionManager configuration not required.
- Hibernate will plug in its own transaction manager integration.
- -->
-
-
- <!-- A config appropriate for entity/collection caching. -->
- <registry:cache-config name="optimistic-entity">
- <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction syncCommitPhase="true" syncRollbackPhase="true"
- transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <transport clusterName="optimistic-entity" multiplexerStack="udp-sync"/>
- <invalidation>
- <sync replTimeout="20000"/>
- </invalidation>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.horizon.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
-
- <!-- A config appropriate for entity/collection caching that
- uses pessimistic locking -->
- <registry:cache-config name="pessimistic-entity">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <transport clusterName="pessimistic-entity" multiplexerStack="udp-sync"/>
- <invalidation>
- <sync replTimeout="20000"/>
- </invalidation>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.horizon.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
-
- <!-- A config appropriate for query caching. Does not replicate
- queries. DO NOT STORE TIMESTAMPS IN THIS CACHE.
- -->
- <registry:cache-config name="local-query">
- <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.horizon.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
-
- <!-- A query cache that replicates queries. Replication is asynchronous.
- DO NOT STORE TIMESTAMPS IN THIS CACHE.
- -->
- <registry:cache-config name="replicated-query">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="false"/>
- <startup regionsInactiveOnStartup="false"/>
- <stateRetrieval fetchInMemoryState="false" timeout="20000"/>
- <transport clusterName="replicated-query" multiplexerStack="udp"/>
- <replication>
- <async/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.horizon.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
-
- <!-- Optimized for timestamp caching. A clustered timestamp cache
- is required if query caching is used, even if the query cache
- itself is configured with CacheMode=LOCAL.
- -->
- <registry:cache-config name="timestamps-cache">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
- <transport clusterName="timestamps-cache" multiplexerStack="udp"/>
- <replication>
- <async/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.horizon.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
-
- <!-- A config appropriate for a cache that's shared for
-entity, collection, query and timestamp caching. Not an advised
-configuration, since it requires cache mode REPL_SYNC, which is the
-least efficient mode. Also requires a full state transfer at startup,
-which can be expensive. Uses optimistic locking. -->
- <registry:cache-config name="optimistic-shared">
- <locking lockAcquisitionTimeout="15000" nodeLockingScheme="optimistic"/>
- <transaction syncCommitPhase="true" syncRollbackPhase="true"
- transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
- <transport clusterName="optimistic-shared" multiplexerStack="udp"/>
- <replication>
- <sync replTimeout="20000"/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.horizon.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
-
-
- <!-- A config appropriate for a cache that's shared for
- entity, collection, query and timestamp caching. Not an advised
- configuration, since it requires cache mode REPL_SYNC, which is the
- least efficient mode. Also requires a full state transfer at startup,
- which can be expensive. Uses pessmistic locking.
- -->
- <registry:cache-config name="pessimistic-shared">
-
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000" nodeLockingScheme="pessimistic"/>
- <serialization useRegionBasedMarshalling="true"/>
- <startup regionsInactiveOnStartup="true"/>
- <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
- <transport clusterName="pessimistic-shared" multiplexerStack="udp"/>
- <replication>
- <sync replTimeout="20000"/>
- </replication>
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.horizon.eviction.algorithms.lru.LRUAlgorithm">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLive">1000</attribute>
- </default>
- <region name="/TS">
- <attribute name="maxNodes">0</attribute>
- <attribute name="timeToLive">0</attribute>
- </region>
- </eviction>
- </registry:cache-config>
-</registry:cache-configs>
Deleted: core/branches/flat/src/test/resources/unit-test-cache-service.xml
===================================================================
--- core/branches/flat/src/test/resources/unit-test-cache-service.xml 2009-01-23 18:34:40 UTC (rev 7593)
+++ core/branches/flat/src/test/resources/unit-test-cache-service.xml 2009-01-26 10:24:58 UTC (rev 7594)
@@ -1,316 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbosscache xmlns="urn:jboss:starobrno-core:config:1.0">
- <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
- <transaction transactionManagerLookupClass="org.horizon.transaction.GenericTransactionManagerLookup"/>
- <serialization useRegionBasedMarshalling="false"/>
- <clustering>
- <sync replTimeout="15000"/>
- <stateRetrieval fetchInMemoryState="true" timeout="15000"/>
- </clustering>
-
- <eviction wakeUpInterval="2000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000"/>
- </default>
- <region name="/org/jboss/data">
- <property name="maxNodes" value="5000"/>
- <property name="timeToLive" value="1000"/>
- </region>
- <region name="/org/jboss/test/data">
- <property name="maxNodes" value="5"/>
- <property name="timeToLive" value="4"/>
- </region>
- </eviction>
- <loaders passivation="true" shared="false">
- <preload>
- <node fqn="/"/>
- </preload>
- <loader class="org.jboss.cache.loader.FileCacheLoader" async="false" fetchPersistentState="true"
- ignoreModifications="false">
- <properties/>
- </loader>
- </loaders>
-
- <protocol_stacks>
- <stack name="udp"
- description="Default: IP multicast based stack, with flow control and message bundling">
- <config>
- <UDP mcast_addr="228.10.10.10"
- mcast_port="45588"
- tos="8"
- ucast_recv_buf_size="20000000"
- ucast_send_buf_size="640000"
- mcast_recv_buf_size="25000000"
- mcast_send_buf_size="640000"
- loopback="false"
- discard_incompatible_packets="true"
- max_bundle_size="64000"
- max_bundle_timeout="30"
- use_incoming_packet_handler="true"
- ip_ttl="2"
- enable_bundling="true"
- enable_diagnostics="true"
-
- use_concurrent_stack="true"
-
- thread_naming_pattern="pl"
-
- thread_pool.enabled="true"
- thread_pool.min_threads="1"
- thread_pool.max_threads="25"
- thread_pool.keep_alive_time="30000"
- thread_pool.queue_enabled="false"
- thread_pool.queue_max_size="10"
- thread_pool.rejection_policy="Run"
-
- oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1"
- oob_thread_pool.max_threads="4"
- oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run"/>
-
- <PING timeout="2000" num_initial_members="3"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <!--
- Note that this is an atypically short timeout and a small number of retries
- configured this way to speed up unit testing, since we know all nodes run in the same JVM
- and hence failure detections will be very quick.
- -->
- <FD timeout="1000" max_tries="2" shun="true"/>
- <VERIFY_SUSPECT timeout="250"/>
- <!-- this is a more typical configuration of FD and VERIFY_SUSPECT-->
- <!--<FD timeout="10000" max_tries="5" shun="true"/>-->
- <!--<VERIFY_SUSPECT timeout="1500"/>-->
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600"
- discard_delivered_msgs="true"/>
- <UNICAST timeout="300,600"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
- max_bytes="400000"/>
- <pbcast.GMS print_local_addr="false" join_timeout="1000" shun="false"
- view_bundling="true" view_ack_collection_timeout="1000"/>
- <FC max_credits="20000000" min_threshold="0.10"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <!-- <pbcast.STATE_TRANSFER/> -->
- <pbcast.FLUSH timeout="0"/>
- </config>
- </stack>
-
- <stack name="udp-sync"
- description="IP multicast based stack, without flow control and without message bundling. This should be used
- instead of udp if (1) synchronous calls are used and (2) the message volume (rate and size)
- is not that large. Don't use this configuration if you send messages at a high sustained rate, or you might
- run out of memory">
- <config>
- <UDP mcast_addr="228.10.10.10"
- mcast_port="45588"
- tos="8"
- ucast_recv_buf_size="20000000"
- ucast_send_buf_size="640000"
- mcast_recv_buf_size="25000000"
- mcast_send_buf_size="640000"
- loopback="false"
- discard_incompatible_packets="true"
- max_bundle_size="64000"
- max_bundle_timeout="30"
- use_incoming_packet_handler="true"
- ip_ttl="2"
- enable_bundling="true"
- enable_diagnostics="true"
-
- use_concurrent_stack="true"
-
- thread_naming_pattern="pl"
-
- thread_pool.enabled="true"
- thread_pool.min_threads="1"
- thread_pool.max_threads="25"
- thread_pool.keep_alive_time="30000"
- thread_pool.queue_enabled="false"
- thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="Run"
-
- oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1"
- oob_thread_pool.max_threads="4"
- oob_thread_pool.keep_alive_time="10000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="10"
- oob_thread_pool.rejection_policy="Run"/>
-
- <PING timeout="2000" num_initial_members="3"/>
- <MERGE2 max_interval="30000" min_interval="10000"/>
- <FD_SOCK/>
- <!--
- Note that this is an atypically short timeout and a small number of retries
- configured this way to speed up unit testing, since we know all nodes run in the same JVM
- and hence failure detections will be very quick.
- -->
- <FD timeout="1000" max_tries="2" shun="true"/>
- <VERIFY_SUSPECT timeout="250"/>
- <!-- this is a more typical configuration of FD and VERIFY_SUSPECT-->
- <!--<FD timeout="10000" max_tries="5" shun="true"/>-->
- <!--<VERIFY_SUSPECT timeout="1500"/>-->
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600,900,1200"
- discard_delivered_msgs="true"/>
- <UNICAST timeout="300,600,900,1200"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
- max_bytes="400000"/>
- <pbcast.GMS print_local_addr="false" join_timeout="1000" shun="false"
- view_bundling="true" view_ack_collection_timeout="1000"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <!-- <pbcast.STATE_TRANSFER/> -->
- <pbcast.FLUSH timeout="0"/>
- </config>
- </stack>
-
-
- <stack name="tcp"
- description="TCP based stack, with flow control and message bundling. This is usually used when IP
- multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast).
- Note that TCP.bind_addr and TCPPING.initial_hosts should be set, possibly via system properties, e.g.
- -Djgroups.bind_addr=192.168.5.2 and -Djgroups.tcpping.initial_hosts=192.168.5.2[7800]">
- <config>
- <TCP start_port="7800"
- loopback="true"
- recv_buf_size="20000000"
- send_buf_size="640000"
- discard_incompatible_packets="true"
- max_bundle_size="64000"
- max_bundle_timeout="30"
- use_incoming_packet_handler="true"
- enable_bundling="true"
- use_send_queues="false"
- sock_conn_timeout="300"
- skip_suspected_members="true"
-
- use_concurrent_stack="true"
-
- thread_pool.enabled="true"
- thread_pool.min_threads="1"
- thread_pool.max_threads="25"
- thread_pool.keep_alive_time="5000"
- thread_pool.queue_enabled="false"
- thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="run"
-
- oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1"
- oob_thread_pool.max_threads="8"
- oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="100"
- oob_thread_pool.rejection_policy="run"/>
-
- <TCPPING timeout="3000"
- initial_hosts="127.0.0.1[7800],127.0.0.1[7801]"
- port_range="1"
- num_initial_members="3"/>
- <MERGE2 max_interval="100000"
- min_interval="20000"/>
- <FD_SOCK/>
- <!--
- Note that this is an atypically short timeout and a small number of retries
- configured this way to speed up unit testing, since we know all nodes run in the same JVM
- and hence failure detections will be very quick.
- -->
- <FD timeout="1000" max_tries="5" shun="true"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <BARRIER/>
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800"
- discard_delivered_msgs="true"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
- max_bytes="400000"/>
- <VIEW_SYNC avg_send_interval="60000"/>
- <pbcast.GMS print_local_addr="false" join_timeout="3000" shun="true"
- view_bundling="true"/>
- <FC max_credits="2000000"
- min_threshold="0.10"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <!-- <pbcast.STATE_TRANSFER/> -->
- <pbcast.FLUSH timeout="0"/>
- </config>
- </stack>
-
-
- <stack name="tcp-sync"
- description="TCP based stack, without flow control and without message bundling. This is usually used when IP
- multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast). This
- configuration should be used instead of tcp when (1) synchronous calls are used and (2) the message volume
- (rate and size) is not that large">
- <config>
- <TCP start_port="7800"
- loopback="true"
- recv_buf_size="20000000"
- send_buf_size="640000"
- discard_incompatible_packets="true"
- max_bundle_size="64000"
- max_bundle_timeout="30"
- use_incoming_packet_handler="true"
- enable_bundling="true"
- use_send_queues="false"
- sock_conn_timeout="300"
- skip_suspected_members="true"
-
- use_concurrent_stack="true"
-
- thread_pool.enabled="true"
- thread_pool.min_threads="1"
- thread_pool.max_threads="25"
- thread_pool.keep_alive_time="5000"
- thread_pool.queue_enabled="false"
- thread_pool.queue_max_size="100"
- thread_pool.rejection_policy="run"
-
- oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1"
- oob_thread_pool.max_threads="8"
- oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false"
- oob_thread_pool.queue_max_size="100"
- oob_thread_pool.rejection_policy="run"/>
-
- <TCPPING timeout="3000"
- initial_hosts="127.0.0.1[7800],127.0.0.1[7801]"
- port_range="1"
- num_initial_members="3"/>
- <MERGE2 max_interval="100000"
- min_interval="20000"/>
- <FD_SOCK/>
- <!--
- Note that this is an atypically short timeout and a small number of retries
- configured this way to speed up unit testing, since we know all nodes run in the same JVM
- and hence failure detections will be very quick.
- -->
- <FD timeout="1000" max_tries="5" shun="true"/>
- <VERIFY_SUSPECT timeout="1500"/>
- <BARRIER/>
- <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800"
- discard_delivered_msgs="true"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
- max_bytes="400000"/>
- <VIEW_SYNC avg_send_interval="60000"/>
- <pbcast.GMS print_local_addr="false" join_timeout="3000" shun="true"
- view_bundling="true"/>
- <FC max_credits="2000000"
- min_threshold="0.10"/>
- <FRAG2 frag_size="60000"/>
- <pbcast.STREAMING_STATE_TRANSFER/>
- <!-- <pbcast.STATE_TRANSFER/> -->
- <pbcast.FLUSH timeout="0"/>
- </config>
- </stack>
- </protocol_stacks>
-
-</jbosscache>
15 years, 11 months
JBoss Cache SVN: r7593 - in core/trunk: src/main/java/org/jboss/cache and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-23 13:34:40 -0500 (Fri, 23 Jan 2009)
New Revision: 7593
Modified:
core/trunk/pom.xml
core/trunk/src/main/java/org/jboss/cache/Version.java
Log:
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2009-01-23 13:55:58 UTC (rev 7592)
+++ core/trunk/pom.xml 2009-01-23 18:34:40 UTC (rev 7593)
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
- <jbosscache-core-version>3.0.1-SNAPSHOT</jbosscache-core-version>
+ <jbosscache-core-version>3.0.3-SNAPSHOT</jbosscache-core-version>
<!-- By default only run tests in the "unit" group -->
<defaultTestGroup>unit</defaultTestGroup>
<!-- By default only generate Javadocs when we install the module. -->
@@ -464,7 +464,7 @@
<activeByDefault>false</activeByDefault>
</activation>
<properties>
- <jbosscache-core-version>3.0.2-SNAPSHOT-JBossAS</jbosscache-core-version>
+ <jbosscache-core-version>3.0.3-SNAPSHOT-JBossAS</jbosscache-core-version>
<defaultTestGroup>functional,unit</defaultTestGroup>
<protocol.stack>tcp</protocol.stack>
</properties>
Modified: core/trunk/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Version.java 2009-01-23 13:55:58 UTC (rev 7592)
+++ core/trunk/src/main/java/org/jboss/cache/Version.java 2009-01-23 18:34:40 UTC (rev 7593)
@@ -32,10 +32,10 @@
@Immutable
public class Version
{
- public static final String version = "3.0.1-SNAPSHOT";
+ public static final String version = "3.0.3-SNAPSHOT";
public static final String codename = "Naga";
//public static final String cvs = "$Id$";
- static final byte[] version_id = {'0', '3', '0', '0', 'S'};
+ static final byte[] version_id = {'0', '3', '0', '3', 'S'};
private static final int MAJOR_SHIFT = 11;
private static final int MINOR_SHIFT = 6;
15 years, 11 months