Author: mircea.markus
Date: 2008-08-27 06:20:06 -0400 (Wed, 27 Aug 2008)
New Revision: 6622
Modified:
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java
core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml
core/trunk/src/test/resources/jbc2-registry-configs.xml
Log:
xml improvements and bug fixes
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-08-26 22:46:35
UTC (rev 6621)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-08-27 10:20:06
UTC (rev 6622)
@@ -70,7 +70,7 @@
{
c = parser.parseFile(configFileName);
}
- catch (OldFileFormatException e)
+ catch (ConfigurationException e)
{
log.warn("Detected legacy configuration file format when parsing [" +
configFileName + "]. Migrating to the new (3.x) file format is recommended. See
FAQs for details.");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
@@ -160,7 +160,7 @@
{
c = parser.parseStream(is);
}
- catch (OldFileFormatException e)
+ catch (ConfigurationException e)
{
log.warn("Detected legacy configuration file format when parsing
configuration file. Migrating to the new (3.x) file format is recommended. See FAQs for
details.");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-08-26
22:46:35 UTC (rev 6621)
+++
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-08-27
10:20:06 UTC (rev 6622)
@@ -50,8 +50,8 @@
* This class is stateful and one instance should be used for parsing a single
configuration file.
*
* @author Mircea.Markus(a)jboss.com
- * @since 3.0
* @see org.jboss.cache.config.parsing.RootElementBuilder
+ * @since 3.0
*/
public class XmlConfigurationParser extends XmlParserBase
{
@@ -64,6 +64,7 @@
*/
private Configuration config = new Configuration();
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.
@@ -95,7 +96,6 @@
* Parses an XML file and returns a new configuration.
* For looking up the file, {@link org.jboss.cache.util.FileLookup} is used.
*
- * @throws OldFileFormatException if the file has a 2.x format
* @see org.jboss.cache.util.FileLookup
*/
public Configuration parseFile(String filename)
@@ -110,8 +110,6 @@
/**
* Similar to {@link #parseFile(String)}, just that it does not create the input
stream.
- *
- * @throws OldFileFormatException if the file has a 2.x format
*/
public Configuration parseStream(InputStream configStream)
{
@@ -121,8 +119,6 @@
/**
* Root should be the <b>jbosscache</b> element in the configuration
file.
- *
- * @throws OldFileFormatException if the file has a 2.x format
*/
public Configuration parseElement(Element root)
{
@@ -147,11 +143,6 @@
{
if (!ignoreRoot)
{
- if ("server".equalsIgnoreCase(root.getNodeName()))
- {
- throw new OldFileFormatException();
- }
-
if (!"jbosscache".equals(root.getLocalName()) ||
!RootElementBuilder.JBOSSCACHE_CORE_NS.equals(root.getNamespaceURI()))
throw new ConfigurationException("Expected root element {" +
RootElementBuilder.JBOSSCACHE_CORE_NS + "}" + "jbosscache");
}
Modified: core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java 2008-08-26 22:46:35
UTC (rev 6621)
+++ core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java 2008-08-27 10:20:06
UTC (rev 6622)
@@ -15,7 +15,6 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.OldFileFormatException;
import org.jboss.cache.config.parsing.XmlConfigurationParser;
import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -87,7 +86,7 @@
{
c = parser.parseFile(configFileName);
}
- catch (OldFileFormatException e)
+ catch (ConfigurationException e)
{
System.out.println("Detected legacy configuration file format when parsing
[" + configFileName + "]. Migrating to the new (3.x) file format is
recommended. See FAQs for details.");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
Modified:
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java 2008-08-26
22:46:35 UTC (rev 6621)
+++
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationParserTest.java 2008-08-27
10:20:06 UTC (rev 6622)
@@ -1,12 +1,6 @@
package org.jboss.cache.config.parsing;
-import org.jboss.cache.config.BuddyReplicationConfig;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.CustomInterceptorConfig;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.config.OldFileFormatException;
+import org.jboss.cache.config.*;
import org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor;
import org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor;
import org.jboss.cache.eviction.LRUAlgorithmConfig;
@@ -45,7 +39,7 @@
parser.parseFile("configs/conf2x/pess-local.xml");
assert false : "exception expected";
}
- catch (OldFileFormatException e)
+ catch (ConfigurationException e)
{
//expectd
}
Modified:
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java 2008-08-26
22:46:35 UTC (rev 6621)
+++
core/trunk/src/test/java/org/jboss/cache/config/parsing/XmlConfigurationSchemaTest.java 2008-08-27
10:20:06 UTC (rev 6622)
@@ -32,7 +32,8 @@
"parser-test.xml",
"policyPerRegion-eviction.xml",
"replSync.xml",
- "string-property-replaced.xml"
+ "string-property-replaced.xml",
+ "mvcc-repl-sync-br.xml"
};
/**
Modified: core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml
===================================================================
--- core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml 2008-08-26 22:46:35 UTC
(rev 6621)
+++ core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml 2008-08-27 10:20:06 UTC
(rev 6622)
@@ -31,7 +31,7 @@
</jgroupsConfig>
</transport>
<replication>
- <async replTimeout="15000"/>
+ <async/>
<buddy enabled="true" poolName="myBuddyPoolReplicationGroup"
communicationTimeout="2000">
<dataGravitation auto="false" removeOnFind="true"
searchBackupTrees="true"/>
<locator
class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
Modified: core/trunk/src/test/resources/jbc2-registry-configs.xml
===================================================================
(Binary files differ)
Show replies by date