Author: manik.surtani(a)jboss.com
Date: 2009-03-25 06:26:37 -0400 (Wed, 25 Mar 2009)
New Revision: 7938
Added:
core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
Removed:
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java
Modified:
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
Log:
Moved JGroupsStackParser back to its old place
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2009-03-23 16:40:35
UTC (rev 7937)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2009-03-25 10:26:37
UTC (rev 7938)
@@ -23,7 +23,7 @@
import org.jboss.cache.Version;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.parsing.element.JGroupsStackParser;
+import org.jboss.cache.config.parsing.JGroupsStackParser;
import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.lock.IsolationLevel;
Copied: core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
(from rev 7937,
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
(rev 0)
+++
core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2009-03-25
10:26:37 UTC (rev 7938)
@@ -0,0 +1,113 @@
+/*
+ * 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.jboss.cache.config.parsing;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+/**
+ * The purpose of this class is to parse the jgroups configuration from the config file
into an compact string
+ * that can be passed as a config to the channel.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 3.0
+ */
+public class JGroupsStackParser
+{
+ // *****************
+ // NOTE: DO NOT MOVE THIS CLASS. In r7769
(
http://lists.jboss.org/pipermail/jbosscache-commits/2009-February/005353....)
+ // I moved this to the element subpackage to sit alongside other parsers, as would be
logical, but this broke
+ // POJO Cache since POJO Cache releases expect this class to be in this package. -
Manik Surtani (March 2009)
+ // *****************
+
+ /**
+ * Parses the cluster config which is used to start a JGroups channel
+ *
+ * @param config an old-style JGroups protocol config String
+ */
+ public String parseClusterConfigXml(Element config)
+ {
+ StringBuilder buffer = new StringBuilder();
+ NodeList stack = config.getChildNodes();
+ int length = stack.getLength();
+
+ for (int s = 0; s < length; s++)
+ {
+ org.w3c.dom.Node node = stack.item(s);
+ if (node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
+ {
+ continue;
+ }
+
+ // Ignore Namespace until JGroups defines one
+ Element tag = (Element) node;
+ String protocol = tag.getLocalName();
+ if (protocol == null)
+ {
+ protocol = tag.getNodeName(); // try a non-namespace aware version
+ }
+ buffer.append(protocol);
+ processAttributes(buffer, tag);
+ buffer.append(':');
+ }
+ if (buffer.length() > 0)
+ {
+ //Remove the trailing ':'
+ buffer.setLength(buffer.length() - 1);
+ }
+ return buffer.toString();
+ }
+
+ private void processAttributes(StringBuilder buffer, Element tag)
+ {
+ NamedNodeMap attrs = tag.getAttributes();
+ int attrLength = attrs.getLength();
+ if (attrLength > 0)
+ {
+ buffer.append('(');
+ }
+ for (int a = 0; a < attrLength; a++)
+ {
+ Attr attr = (Attr) attrs.item(a);
+ processSingleAttribute(buffer, attr);
+ if (a < attrLength - 1)
+ {
+ buffer.append(';');
+ }
+ }
+ if (attrLength > 0)
+ {
+ buffer.append(')');
+ }
+ }
+
+ private void processSingleAttribute(StringBuilder buffer, Attr attr)
+ {
+ String name = attr.getName();
+ String value = attr.getValue();
+ buffer.append(name);
+ buffer.append('=');
+ buffer.append(value);
+ }
+}
Property changes on:
core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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 2009-03-23
16:40:35 UTC (rev 7937)
+++
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2009-03-25
10:26:37 UTC (rev 7938)
@@ -31,7 +31,7 @@
import org.jboss.cache.config.parsing.element.CustomInterceptorsElementParser;
import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
-import org.jboss.cache.config.parsing.element.JGroupsStackParser;
+import org.jboss.cache.config.parsing.JGroupsStackParser;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.util.FileLookup;
import org.w3c.dom.Element;
Deleted:
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java 2009-03-23
16:40:35 UTC (rev 7937)
+++
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java 2009-03-25
10:26:37 UTC (rev 7938)
@@ -1,107 +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.jboss.cache.config.parsing.element;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-
-/**
- * The purpose of this class is to parse the jgroups configuration from the config file
into an compact string
- * that can be passed as a config to the channel.
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 3.0
- */
-public class JGroupsStackParser
-{
- /**
- * Parses the cluster config which is used to start a JGroups channel
- *
- * @param config an old-style JGroups protocol config String
- */
- public String parseClusterConfigXml(Element config)
- {
- StringBuilder buffer = new StringBuilder();
- NodeList stack = config.getChildNodes();
- int length = stack.getLength();
-
- for (int s = 0; s < length; s++)
- {
- org.w3c.dom.Node node = stack.item(s);
- if (node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
- {
- continue;
- }
-
- // Ignore Namespace until JGroups defines one
- Element tag = (Element) node;
- String protocol = tag.getLocalName();
- if (protocol == null)
- {
- protocol = tag.getNodeName(); // try a non-namespace aware version
- }
- buffer.append(protocol);
- processAttributes(buffer, tag);
- buffer.append(':');
- }
- if (buffer.length() > 0)
- {
- //Remove the trailing ':'
- buffer.setLength(buffer.length() - 1);
- }
- return buffer.toString();
- }
-
- private void processAttributes(StringBuilder buffer, Element tag)
- {
- NamedNodeMap attrs = tag.getAttributes();
- int attrLength = attrs.getLength();
- if (attrLength > 0)
- {
- buffer.append('(');
- }
- for (int a = 0; a < attrLength; a++)
- {
- Attr attr = (Attr) attrs.item(a);
- processSingleAttribute(buffer, attr);
- if (a < attrLength - 1)
- {
- buffer.append(';');
- }
- }
- if (attrLength > 0)
- {
- buffer.append(')');
- }
- }
-
- private void processSingleAttribute(StringBuilder buffer, Attr attr)
- {
- String name = attr.getName();
- String value = attr.getValue();
- buffer.append(name);
- buffer.append('=');
- buffer.append(value);
- }
-}
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2009-03-23 16:40:35
UTC (rev 7937)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2009-03-25 10:26:37
UTC (rev 7938)
@@ -36,9 +36,8 @@
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.LegacyConfigurationException;
import org.jboss.cache.config.RuntimeConfig;
-import org.jboss.cache.config.parsing.element.JGroupsStackParser;
+import org.jboss.cache.config.parsing.JGroupsStackParser;
import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
-import org.jboss.cache.config.parsing.RootElementBuilder;
import org.jboss.cache.config.parsing.element.BuddyElementParser;
import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
Modified:
core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java 2009-03-23
16:40:35 UTC (rev 7937)
+++
core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java 2009-03-25
10:26:37 UTC (rev 7938)
@@ -2,10 +2,10 @@
import org.testng.annotations.Test;
import org.w3c.dom.Element;
-import org.jboss.cache.config.parsing.element.JGroupsStackParser;
+import org.jboss.cache.config.parsing.JGroupsStackParser;
/**
- * Tester class for {@link org.jboss.cache.config.parsing.element.JGroupsStackParser}
+ * Tester class for {@link JGroupsStackParser}
*
* @author Mircea.Markus(a)jboss.com
* @since 3.0
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2009-03-23
16:40:35 UTC (rev 7937)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2009-03-25
10:26:37 UTC (rev 7938)
@@ -3,7 +3,7 @@
import org.jboss.cache.Cache;
import org.jboss.cache.UnitTestCacheFactory;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.element.JGroupsStackParser;
+import org.jboss.cache.config.parsing.JGroupsStackParser;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.factories.UnitTestConfigurationFactory;
import org.jboss.cache.util.TestingUtil;