Author: clebert.suconic(a)jboss.com
Date: 2010-12-30 19:39:40 -0500 (Thu, 30 Dec 2010)
New Revision: 10090
Modified:
trunk/src/config/common/schema/hornetq-configuration.xsd
trunk/src/config/jboss-as-4/clustered/hornetq-configuration.xml
trunk/src/config/jboss-as-4/non-clustered/hornetq-configuration.xml
trunk/src/config/jboss-as-5/clustered/hornetq-configuration.xml
trunk/src/config/jboss-as-5/non-clustered/hornetq-configuration.xml
trunk/src/config/jboss-as-6/clustered/hornetq-configuration.xml
trunk/src/config/jboss-as-6/non-clustered/hornetq-configuration.xml
trunk/src/main/org/hornetq/core/config/Configuration.java
trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
trunk/tests/config/ConfigurationTest-full-config.xml
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
Log:
JBPAPP-5557 - supporting name on hornetq-configuration to inject dependency on the
application server
Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd 2010-12-30 02:44:46 UTC (rev
10089)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd 2010-12-31 00:39:40 UTC (rev
10090)
@@ -4,6 +4,8 @@
<xsd:element name="configuration">
<xsd:complexType>
<xsd:all>
+ <xsd:element maxOccurs="1" minOccurs="0" name="name"
type="xsd:string">
+ </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
ref="clustered"/>
<xsd:element maxOccurs="1" minOccurs="0"
ref="file-deployment-enabled"/>
<xsd:element maxOccurs="1" minOccurs="0"
ref="persistence-enabled"/>
Modified: trunk/src/config/jboss-as-4/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as-4/clustered/hornetq-configuration.xml 2010-12-30 02:44:46
UTC (rev 10089)
+++ trunk/src/config/jboss-as-4/clustered/hornetq-configuration.xml 2010-12-31 00:39:40
UTC (rev 10090)
@@ -15,6 +15,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq
/schema/hornetq-configuration.xsd">
+ <!-- Don't change this name.
+ This is used by the dependency framework on the deployers,
+ to make sure this deployment is done before any other deployment -->
+ <name>HornetQ.main.config</name>
+
<clustered>true</clustered>
<log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
Modified: trunk/src/config/jboss-as-4/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as-4/non-clustered/hornetq-configuration.xml 2010-12-30
02:44:46 UTC (rev 10089)
+++ trunk/src/config/jboss-as-4/non-clustered/hornetq-configuration.xml 2010-12-31
00:39:40 UTC (rev 10090)
@@ -15,6 +15,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq
/schema/hornetq-configuration.xsd">
+ <!-- Don't change this name.
+ This is used by the dependency framework on the deployers,
+ to make sure this deployment is done before any other deployment -->
+ <name>HornetQ.main.config</name>
+
<log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
<bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
Modified: trunk/src/config/jboss-as-5/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as-5/clustered/hornetq-configuration.xml 2010-12-30 02:44:46
UTC (rev 10089)
+++ trunk/src/config/jboss-as-5/clustered/hornetq-configuration.xml 2010-12-31 00:39:40
UTC (rev 10090)
@@ -15,6 +15,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq
/schema/hornetq-configuration.xsd">
+ <!-- Don't change this name.
+ This is used by the dependency framework on the deployers,
+ to make sure this deployment is done before any other deployment -->
+ <name>HornetQ.main.config</name>
+
<clustered>true</clustered>
<log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
Modified: trunk/src/config/jboss-as-5/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as-5/non-clustered/hornetq-configuration.xml 2010-12-30
02:44:46 UTC (rev 10089)
+++ trunk/src/config/jboss-as-5/non-clustered/hornetq-configuration.xml 2010-12-31
00:39:40 UTC (rev 10090)
@@ -15,6 +15,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq
/schema/hornetq-configuration.xsd">
+ <!-- Don't change this name.
+ This is used by the dependency framework on the deployers,
+ to make sure this deployment is done before any other deployment -->
+ <name>HornetQ.main.config</name>
+
<log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
<bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
Modified: trunk/src/config/jboss-as-6/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as-6/clustered/hornetq-configuration.xml 2010-12-30 02:44:46
UTC (rev 10089)
+++ trunk/src/config/jboss-as-6/clustered/hornetq-configuration.xml 2010-12-31 00:39:40
UTC (rev 10090)
@@ -15,6 +15,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq
/schema/hornetq-configuration.xsd">
+ <!-- Don't change this name.
+ This is used by the dependency framework on the deployers,
+ to make sure this deployment is done before any other deployment -->
+ <name>HornetQ.main.config</name>
+
<clustered>true</clustered>
<log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
Modified: trunk/src/config/jboss-as-6/non-clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/jboss-as-6/non-clustered/hornetq-configuration.xml 2010-12-30
02:44:46 UTC (rev 10089)
+++ trunk/src/config/jboss-as-6/non-clustered/hornetq-configuration.xml 2010-12-31
00:39:40 UTC (rev 10090)
@@ -15,6 +15,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq
/schema/hornetq-configuration.xsd">
+ <!-- Don't change this name.
+ This is used by the dependency framework on the deployers,
+ to make sure this deployment is done before any other deployment -->
+ <name>HornetQ.main.config</name>
+
<log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
<bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
Modified: trunk/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/Configuration.java 2010-12-30 02:44:46 UTC (rev
10089)
+++ trunk/src/main/org/hornetq/core/config/Configuration.java 2010-12-31 00:39:40 UTC (rev
10090)
@@ -38,6 +38,13 @@
public interface Configuration extends Serializable
{
// General attributes
-------------------------------------------------------------------
+
+
+ /** To be used on dependency management on the application server */
+ String getName();
+
+ /** To be used on dependency management on the application server */
+ void setName(String name);
/**
* Returns whether this server is clustered.
Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2010-12-30 02:44:46
UTC (rev 10089)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2010-12-31 00:39:40
UTC (rev 10090)
@@ -183,6 +183,8 @@
public static final String DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME =
JULLogDelegateFactory.class.getCanonicalName();
// Attributes
-----------------------------------------------------------------------------
+
+ protected String name = "ConfigurationImpl::" +
System.identityHashCode(this);
protected boolean clustered = ConfigurationImpl.DEFAULT_CLUSTERED;
@@ -1361,4 +1363,20 @@
this.connectorServiceConfigurations = configs;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.config.Configuration#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.config.Configuration#setName(java.lang.String)
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
}
Modified: trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
--- trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-12-30
02:44:46 UTC (rev 10089)
+++ trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-12-31
00:39:40 UTC (rev 10090)
@@ -117,7 +117,7 @@
private static final String SEND_TO_DLA_ON_NO_ROUTE =
"send-to-dla-on-no-route";
// Attributes ----------------------------------------------------
-
+
private boolean validateAIO = false;
// Static --------------------------------------------------------
@@ -125,7 +125,7 @@
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
-
+
/**
* @return the validateAIO
*/
@@ -161,12 +161,16 @@
{
XMLUtil.validate(e, FileConfigurationParser.CONFIGURATION_SCHEMA_URL);
+ config.setName(XMLConfigurationUtil.getString(e, "name",
config.getName(), Validators.NO_CHECK));
+
config.setClustered(XMLConfigurationUtil.getBoolean(e, "clustered",
config.isClustered()));
config.setAllowAutoFailBack(XMLConfigurationUtil.getBoolean(e,
"allow-failback", config.isClustered()));
-
- config.setFailoverOnServerShutdown(XMLConfigurationUtil.getBoolean(e,
"failover-on-shutdown", config.isFailoverOnServerShutdown()));
+ config.setFailoverOnServerShutdown(XMLConfigurationUtil.getBoolean(e,
+
"failover-on-shutdown",
+
config.isFailoverOnServerShutdown()));
+
config.setBackup(XMLConfigurationUtil.getBoolean(e, "backup",
config.isBackup()));
config.setSharedStore(XMLConfigurationUtil.getBoolean(e, "shared-store",
config.isSharedStore()));
@@ -440,7 +444,7 @@
// correct settings in xml
// If we fall back later on these settings can be ignored
boolean supportsAIO = AIOSequentialFileFactory.isSupported();
-
+
if (supportsAIO)
{
config.setJournalType(JournalType.ASYNCIO);
@@ -451,7 +455,7 @@
{
log.warn("AIO wasn't located on this platform, it will fall back
to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO
journal");
}
-
+
config.setJournalType(JournalType.NIO);
}
}
@@ -468,7 +472,7 @@
"journal-file-size",
config.getJournalFileSize(),
Validators.GT_ZERO));
-
+
int journalBufferTimeout = XMLConfigurationUtil.getInteger(e,
"journal-buffer-timeout",
config.getJournalType()
== JournalType.ASYNCIO ? ConfigurationImpl.DEFAULT_JOURNAL_BUFFER_TIMEOUT_AIO
@@ -499,7 +503,7 @@
config.setJournalBufferSize_NIO(journalBufferSize);
config.setJournalMaxIO_NIO(journalMaxIO);
}
-
+
config.setJournalMinFiles(XMLConfigurationUtil.getInteger(e,
"journal-min-files",
config.getJournalMinFiles(),
@@ -565,7 +569,7 @@
parseQueues(e, config);
parseSecurity(e, config);
-
+
NodeList connectorServiceConfigs =
e.getElementsByTagName("connector-service");
ArrayList<ConnectorServiceConfiguration> configs = new
ArrayList<ConnectorServiceConfiguration>();
@@ -869,7 +873,7 @@
for (int i = 0; i < paramsNodes.getLength(); i++)
{
Node paramNode = paramsNodes.item(i);
-
+
NamedNodeMap attributes = paramNode.getAttributes();
Node nkey = attributes.getNamedItem("key");
@@ -911,7 +915,10 @@
if (child.getNodeName().equals("connector-ref"))
{
- String connectorName = XMLConfigurationUtil.getString(e,
"connector-ref", null, Validators.NOT_NULL_OR_EMPTY);
+ String connectorName = XMLConfigurationUtil.getString(e,
+
"connector-ref",
+ null,
+
Validators.NOT_NULL_OR_EMPTY);
connectorNames.add(connectorName);
}
@@ -937,7 +944,7 @@
String groupAddress = XMLConfigurationUtil.getString(e, "group-address",
null, Validators.NOT_NULL_OR_EMPTY);
int groupPort = XMLConfigurationUtil.getInteger(e, "group-port", -1,
Validators.MINUS_ONE_OR_GT_ZERO);
-
+
long discoveryInitialWaitTimeout = XMLConfigurationUtil.getLong(e,
"initial-wait-timeout",
HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
@@ -973,7 +980,7 @@
String name = e.getAttribute("name");
String address = XMLConfigurationUtil.getString(e, "address", null,
Validators.NOT_NULL_OR_EMPTY);
-
+
String connectorName = XMLConfigurationUtil.getString(e, "connector-ref",
null, Validators.NOT_NULL_OR_EMPTY);
boolean duplicateDetection = XMLConfigurationUtil.getBoolean(e,
@@ -1004,7 +1011,7 @@
List<String> staticConnectorNames = new ArrayList<String>();
boolean allowDirectConnectionsOnly = false;
-
+
NodeList children = e.getChildNodes();
for (int j = 0; j < children.getLength(); j++)
@@ -1018,7 +1025,7 @@
else if (child.getNodeName().equals("static-connectors"))
{
Node attr =
child.getAttributes().getNamedItem("allow-direct-connections-only");
- if(attr != null)
+ if (attr != null)
{
allowDirectConnectionsOnly =
"true".equalsIgnoreCase(attr.getNodeValue()) || allowDirectConnectionsOnly;
}
@@ -1120,11 +1127,11 @@
"password",
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD,
Validators.NO_CHECK);
-
+
boolean ha = XMLConfigurationUtil.getBoolean(brNode, "ha", false);
String filterString = null;
-
+
List<String> staticConnectorNames = new ArrayList<String>();
String discoveryGroupName = null;
@@ -1193,11 +1200,11 @@
private void getStaticConnectors(List<String> staticConnectorNames, Node child)
{
- NodeList children2 = ((Element)
child).getElementsByTagName("connector-ref");
+ NodeList children2 =
((Element)child).getElementsByTagName("connector-ref");
for (int k = 0; k < children2.getLength(); k++)
{
- Element child2 = (Element) children2.item(k);
+ Element child2 = (Element)children2.item(k);
String connectorName = child2.getChildNodes().item(0).getNodeValue();
@@ -1249,7 +1256,7 @@
mainConfig.getDivertConfigurations().add(config);
}
-
+
private ConnectorServiceConfiguration parseConnectorService(final Element e)
{
Node nameNode = e.getAttributes().getNamedItem("name");
Modified: trunk/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-full-config.xml 2010-12-30 02:44:46 UTC (rev
10089)
+++ trunk/tests/config/ConfigurationTest-full-config.xml 2010-12-31 00:39:40 UTC (rev
10090)
@@ -2,6 +2,7 @@
xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq
../../src/config/common/schema/hornetq-configuration.xsd">
+ <name>SomeNameForUseOnTheApplicationServer</name>
<clustered>true</clustered>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2010-12-30
02:44:46 UTC (rev 10089)
+++
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2010-12-31
00:39:40 UTC (rev 10090)
@@ -37,6 +37,7 @@
public void testDefaults()
{
// Check they match the values from the test file
+ Assert.assertEquals("SomeNameForUseOnTheApplicationServer",
conf.getName());
Assert.assertEquals(false, conf.isPersistenceEnabled());
Assert.assertEquals(true, conf.isFileDeploymentEnabled());
Assert.assertEquals(true, conf.isClustered());