[jboss-cvs] JBoss Messaging SVN: r2035 - in trunk: src/main/org/jboss/messaging/core/plugin and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jan 24 13:25:23 EST 2007
Author: ovidiu.feodorov at jboss.com
Date: 2007-01-24 13:25:23 -0500 (Wed, 24 Jan 2007)
New Revision: 2035
Modified:
trunk/src/main/org/jboss/jms/util/XMLUtil.java
trunk/src/main/org/jboss/messaging/core/plugin/JDBCServiceSupport.java
trunk/src/main/org/jboss/messaging/core/plugin/JDBCSupport.java
trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
trunk/tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java
trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java
Log:
Fixed XMLUtilTest.testElementToString_4() plus some reformatting.
Modified: trunk/src/main/org/jboss/jms/util/XMLUtil.java
===================================================================
--- trunk/src/main/org/jboss/jms/util/XMLUtil.java 2007-01-24 16:35:14 UTC (rev 2034)
+++ trunk/src/main/org/jboss/jms/util/XMLUtil.java 2007-01-24 18:25:23 UTC (rev 2035)
@@ -31,11 +31,11 @@
*/
public class XMLUtil
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(XMLUtil.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
public static Element stringToElement(String s) throws Exception
{
@@ -64,8 +64,7 @@
if (Node.CDATA_SECTION_NODE == type)
{
- //return "<![CDATA[" + n.getNodeValue() + "]]>";
- return n.getNodeValue();
+ return "<![CDATA[" + n.getNodeValue() + "]]>";
}
if (name.startsWith("#"))
@@ -125,14 +124,10 @@
sb.append("</").append(name).append('>');
}
+
return sb.toString();
-
-
-
-
}
-
private static final Object[] EMPTY_ARRAY = new Object[0];
/**
@@ -318,17 +313,34 @@
}
}
- // Attributes ----------------------------------------------------
+ public static String stripCDATA(String s)
+ {
+ s = s.trim();
+ if (s.startsWith("<![CDATA["))
+ {
+ s = s.substring(9);
+ int i = s.indexOf("]]>");
+ if (i == -1)
+ {
+ throw new IllegalStateException(
+ "argument starts with <![CDATA[ but cannot find pairing ]]>");
+ }
+ s = s.substring(0, i);
+ }
+ return s;
+ }
- // Constructors --------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
- // Public --------------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
- // Package protected ---------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
+
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private static List filter(NodeList nl, short[] typesToFilter)
{
@@ -350,5 +362,5 @@
return nodes;
}
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/JDBCServiceSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/JDBCServiceSupport.java 2007-01-24 16:35:14 UTC (rev 2034)
+++ trunk/src/main/org/jboss/messaging/core/plugin/JDBCServiceSupport.java 2007-01-24 18:25:23 UTC (rev 2035)
@@ -38,9 +38,6 @@
import org.jboss.tm.TransactionManagerServiceMBean;
/**
- *
- * A JDBCServiceSupport
- *
* MBean wrapper for any service that needs database attributes
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -50,22 +47,25 @@
*
*/
public abstract class JDBCServiceSupport extends ServiceMBeanSupport implements ServerPlugin
-{
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
protected DataSource ds;
-
protected Properties sqlProperties;
-
+ protected boolean createTablesOnStartup = true;
+
private String dataSourceJNDIName;
-
- protected boolean createTablesOnStartup = true;
-
private ObjectName tmObjectName;
-
private TransactionManager tm;
-
-
- // ServiceMBeanSupport overrides ---------------------------------
-
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ // ServiceMBeanSupport overrides ----------------------------------------------------------------
+
protected void startService() throws Exception
{
try
@@ -76,27 +76,27 @@
ds = (DataSource)ic.lookup(dataSourceJNDIName);
ic.close();
}
-
+
if (ds == null)
{
throw new IllegalStateException("No DataSource found. This service dependencies must " +
- "have not been enforced correctly!");
+ "have not been enforced correctly!");
}
-
+
}
catch (Throwable t)
{
throw ExceptionUtil.handleJMXInvocation(t, this + " startService");
- }
+ }
}
-
+
protected void stopService() throws Exception
{
log.debug(this + " stopped");
}
-
- // MBean attributes --------------------------------------------------------
-
+
+ // MBean attributes -----------------------------------------------------------------------------
+
public String getSqlProperties()
{
try
@@ -110,36 +110,36 @@
return "";
}
}
-
+
public void setSqlProperties(String value)
{
try
- {
+ {
ByteArrayInputStream is = new ByteArrayInputStream(value.getBytes());
sqlProperties = new Properties();
- sqlProperties.load(is);
+ sqlProperties.load(is);
}
catch (IOException shouldnothappen)
{
log.error("Caught IOException", shouldnothappen);
}
}
-
+
public void setDataSource(String dataSourceJNDIName) throws Exception
{
this.dataSourceJNDIName = dataSourceJNDIName;
}
-
+
public String getDataSource()
{
return dataSourceJNDIName;
}
-
+
public void setTransactionManager(ObjectName tmObjectName) throws Exception
{
this.tmObjectName = tmObjectName;
}
-
+
public ObjectName getTransactionManager()
{
return tmObjectName;
@@ -154,9 +154,13 @@
{
createTablesOnStartup = b;
}
-
- // Protected ----------------------------------------------------------
-
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
protected TransactionManager getTransactionManagerReference()
{
// lazy initialization
@@ -171,10 +175,10 @@
return tm;
}
-
- // Private ----------------------------------------------------------------
-
-
- // Innner classes ---------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/JDBCSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/JDBCSupport.java 2007-01-24 16:35:14 UTC (rev 2034)
+++ trunk/src/main/org/jboss/messaging/core/plugin/JDBCSupport.java 2007-01-24 18:25:23 UTC (rev 2035)
@@ -37,10 +37,7 @@
import org.jboss.messaging.core.plugin.contract.MessagingComponent;
/**
- *
- * A JDBCSupport
- *
- * Common functionality for messaging components that need to access a database
+ * Common functionality for messaging components that need to access a database.
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java 2007-01-24 16:35:14 UTC (rev 2034)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java 2007-01-24 18:25:23 UTC (rev 2035)
@@ -58,11 +58,11 @@
*/
public class JMSXDeliveryCountTest extends MessagingTestCase
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
protected JBossConnectionFactory cf;
protected Queue queue;
@@ -70,14 +70,14 @@
protected ServiceContainer sc;
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
public JMSXDeliveryCountTest(String name)
{
super(name);
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public void setUp() throws Exception
{
@@ -102,8 +102,8 @@
if (ServerManagement.isRemote())
{
- //We need to start a service container otherwise transaction manager jndi lookup
- //will fail
+ // We need to start a service container otherwise transaction manager jndi lookup
+ // will fail
sc = new ServiceContainer("transaction");
sc.start(false);
@@ -672,13 +672,13 @@
//So this won't work
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
static class DummyXAResource implements XAResource
{
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java 2007-01-24 16:35:14 UTC (rev 2034)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jboss/MBeanConfigurationElement.java 2007-01-24 18:25:23 UTC (rev 2035)
@@ -12,7 +12,6 @@
import org.w3c.dom.NodeList;
import org.jboss.jms.util.XMLUtil;
import org.jboss.logging.Logger;
-import org.jboss.test.messaging.tools.jmx.rmi.LocalTestServer;
import javax.management.ObjectName;
import java.util.Map;
@@ -31,12 +30,12 @@
*/
public class MBeanConfigurationElement
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(MBeanConfigurationElement.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
public static Class stringToClass(String type) throws Exception
{
@@ -59,7 +58,7 @@
}
}
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
protected Element delegate;
protected ObjectName on;
@@ -69,10 +68,8 @@
protected Map mbeanOptionalAttributeNames;
protected List constructors;
+ // Constructors ---------------------------------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
public MBeanConfigurationElement(Node delegate) throws Exception
{
if (!delegate.getNodeName().equals("mbean"))
@@ -124,6 +121,8 @@
{
configAttribValue = XMLUtil.getTextContent(mbeanConfigNode);
}
+ configAttribValue = XMLUtil.stripCDATA(configAttribValue);
+
mbeanConfigAttributes.put(configAttribName, configAttribValue);
}
else if ("depends".equals(mbeanConfigNodeName))
@@ -165,7 +164,7 @@
}
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public Element getDelegate()
{
@@ -239,13 +238,13 @@
return getMBeanClassName() + "[" + getObjectName() + "]";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
private class ConstructorElement
{
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java 2007-01-24 16:35:14 UTC (rev 2034)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java 2007-01-24 18:25:23 UTC (rev 2035)
@@ -31,18 +31,18 @@
*/
public class ServiceDeploymentDescriptor
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ServiceDeploymentDescriptor.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
// List<Element> contains the top level elements from under <server>
private List elements;
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
public ServiceDeploymentDescriptor(String config) throws Exception
{
@@ -64,7 +64,7 @@
}
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
/**
* Scans the list of ObjectNames present in this service configuration and returns a list
@@ -110,11 +110,11 @@
return result;
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
}
More information about the jboss-cvs-commits
mailing list