JBoss hornetq SVN: r8865 - in trunk: src/main/org/hornetq/jms/server/config and 3 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-02-05 20:13:06 -0500 (Fri, 05 Feb 2010)
New Revision: 8865
Modified:
trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
Log:
Refactoring on parser for better integration with AS6
Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-02-04 22:18:08 UTC (rev 8864)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-02-06 01:13:06 UTC (rev 8865)
@@ -21,6 +21,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
/**
* The JMS Management interface.
@@ -202,6 +203,8 @@
boolean failoverOnServerShutdown,
String groupId,
List<String> jndiBindings) throws Exception;
+
+ void createConnectionFactory(ConnectionFactoryConfiguration cfConfig) throws Exception;
/**
* destroys a connection factory.
Modified: trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-02-04 22:18:08 UTC (rev 8864)
+++ trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-02-06 01:13:06 UTC (rev 8865)
@@ -17,6 +17,7 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.jms.server.JMSServerManager;
/**
* A ConnectionFactoryConfiguration
@@ -39,6 +40,34 @@
void setDiscoveryPort(int discoveryPort);
+
+ /**
+ * A Reference to the group configuration.
+ */
+ String getDiscoveryGroupName();
+
+ /**
+ * A Reference to the group configuration.
+ */
+ void setDiscoveryGroupName(String groupName);
+
+
+ /**
+ * A List of connector names that will be converted into ConnnectorConfigs.
+ * This is useful when using the method {@link JMSServerManager#createConnectionFactory(ConnectionFactoryConfiguration)}
+ *
+ * @return
+ */
+ List<Pair<String, String>> getConnectorNames();
+
+ /**
+ * A List of connector names that will be converted into ConnnectorConfigs.
+ * This is useful when using the method {@link JMSServerManager#createConnectionFactory(ConnectionFactoryConfiguration)}
+ *
+ * @return
+ */
+ void setConnectorNames(List<Pair<String, String>> connectors);
+
List<Pair<TransportConfiguration, TransportConfiguration>> getConnectorConfigs();
void setConnectorConfigs(List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs);
Modified: trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-02-04 22:18:08 UTC (rev 8864)
+++ trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-02-06 01:13:06 UTC (rev 8865)
@@ -37,11 +37,15 @@
private final String[] bindings;
private final String name;
+
+ private String discoveryGroupName;
private String discoveryAddress;
private int discoveryPort;
+ private List<Pair<String, String>> connectorNames;
+
private List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs;
private String clientID = null;
@@ -144,7 +148,7 @@
connectorConfigs.addAll(transportConfigs);
}
- private ConnectionFactoryConfigurationImpl(final String name, final String... bindings)
+ public ConnectionFactoryConfigurationImpl(final String name, final String... bindings)
{
this.name = name;
this.bindings = new String[bindings.length];
@@ -493,6 +497,39 @@
this.groupID = groupID;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.config.ConnectionFactoryConfiguration#getConnectorNames()
+ */
+ public List<Pair<String, String>> getConnectorNames()
+ {
+ return connectorNames;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.config.ConnectionFactoryConfiguration#setConnectorNames(java.util.List)
+ */
+ public void setConnectorNames(List<Pair<String, String>> connectors)
+ {
+ this.connectorNames = connectors;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.config.ConnectionFactoryConfiguration#getDiscoveryGroupName()
+ */
+ public String getDiscoveryGroupName()
+ {
+ return discoveryGroupName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.config.ConnectionFactoryConfiguration#setDiscoveryGroupName(java.lang.String)
+ */
+ public void setDiscoveryGroupName(String groupName)
+ {
+ this.discoveryGroupName = groupName;
+
+ }
+
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-02-04 22:18:08 UTC (rev 8864)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-02-06 01:13:06 UTC (rev 8865)
@@ -21,12 +21,9 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Pair;
-import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.Validators;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.cluster.DiscoveryGroupConfiguration;
import org.hornetq.jms.server.JMSServerConfigParser;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.config.JMSConfiguration;
@@ -60,17 +57,10 @@
// Attributes ----------------------------------------------------
- private final Configuration configuration;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public JMSServerConfigParserImpl(final Configuration configuration)
- {
- this.configuration = configuration;
- }
-
// Public --------------------------------------------------------
/**
@@ -317,8 +307,8 @@
Validators.GT_ZERO);
String groupid = XMLConfigurationUtil.getString(e, "group-id", null, Validators.NO_CHECK);
List<String> jndiBindings = new ArrayList<String>();
- List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
+ List<Pair<String, String>> connectorNames = new ArrayList<Pair<String,String>>();
+ String discoveryGroupName = null;
NodeList children = node.getChildNodes();
@@ -349,53 +339,26 @@
if (JMSServerDeployer.CONNECTOR_REF_ELEMENT.equals(entry.getNodeName()))
{
String connectorName = entry.getAttributes().getNamedItem("connector-name").getNodeValue();
- TransportConfiguration connector = configuration.getConnectorConfigurations().get(connectorName);
- if (connector == null)
- {
- JMSServerConfigParserImpl.log.warn("There is no connector with name '" + connectorName +
- "' deployed.");
- throw new HornetQException(HornetQException.ILLEGAL_STATE,
- "There is no connector with name '" + connectorName + "' deployed.");
- }
+ String backupConnectorName = null;
- TransportConfiguration backupConnector = null;
Node backupNode = entry.getAttributes().getNamedItem("backup-connector-name");
if (backupNode != null)
{
- String backupConnectorName = backupNode.getNodeValue();
- backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
-
- if (backupConnector == null)
- {
- JMSServerConfigParserImpl.log.warn("There is no backup connector with name '" + backupConnectorName +
- "' deployed.");
- throw new HornetQException(HornetQException.ILLEGAL_STATE,
- "There is no backup connector with name '" + backupConnectorName +
- "' deployed.");
- }
+ backupConnectorName = backupNode.getNodeValue();
}
-
- connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(connector,
- backupConnector));
+
+
+ connectorNames.add(new Pair<String, String>(connectorName, backupConnectorName));
+
+
}
}
}
else if (JMSServerDeployer.DISCOVERY_GROUP_ELEMENT.equals(child.getNodeName()))
{
- String discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
+ discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
- discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations().get(discoveryGroupName);
-
- if (discoveryGroupConfiguration == null)
- {
- JMSServerConfigParserImpl.log.warn("There is no discovery group with name '" + discoveryGroupName +
- "' deployed.");
-
- throw new HornetQException(HornetQException.ILLEGAL_STATE,
- "There is no discovery group with name '" + discoveryGroupName +
- "' deployed.");
- }
}
}
@@ -403,13 +366,17 @@
String[] strbindings = jndiBindings.toArray(new String[jndiBindings.size()]);
- if (discoveryGroupConfiguration != null)
+ if (discoveryGroupName != null)
{
- cfConfig = newCF(name, discoveryInitialWaitTimeout, discoveryGroupConfiguration, strbindings);
+ cfConfig = new ConnectionFactoryConfigurationImpl(name,
+ strbindings);
+ cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
+ cfConfig.setDiscoveryGroupName(discoveryGroupName);
}
else
{
- cfConfig = newCF(name, connectorConfigs, strbindings);
+ cfConfig = new ConnectionFactoryConfigurationImpl(name, strbindings);
+ cfConfig.setConnectorNames(connectorNames);
}
cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
@@ -444,47 +411,9 @@
return cfConfig;
}
- /**
- * hook for integration layers
- * @param name
- * @param connectorConfigs
- * @param strbindings
- * @return
- */
- protected ConnectionFactoryConfiguration newCF(final String name,
- final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
- final String[] strbindings)
- {
- ConnectionFactoryConfigurationImpl cfConfig;
- cfConfig = new ConnectionFactoryConfigurationImpl(name, connectorConfigs, strbindings);
- return cfConfig;
- }
/**
* hook for integration layers
- * @param name
- * @param discoveryInitialWaitTimeout
- * @param discoveryGroupConfiguration
- * @param strbindings
- * @return
- */
- protected ConnectionFactoryConfigurationImpl newCF(final String name,
- final long discoveryInitialWaitTimeout,
- final DiscoveryGroupConfiguration discoveryGroupConfiguration,
- final String[] strbindings)
- {
- ConnectionFactoryConfigurationImpl cfConfig;
- cfConfig = new ConnectionFactoryConfigurationImpl(name,
- discoveryGroupConfiguration.getGroupAddress(),
- discoveryGroupConfiguration.getGroupPort(),
- strbindings);
- cfConfig.setDiscoveryRefreshTimeout(discoveryGroupConfiguration.getRefreshTimeout());
- cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
- return cfConfig;
- }
-
- /**
- * hook for integration layers
* @param topicName
* @param strBindings
* @return
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-02-04 22:18:08 UTC (rev 8864)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-02-06 01:13:06 UTC (rev 8865)
@@ -71,7 +71,7 @@
configuration = config;
- parser = new JMSServerConfigParserImpl(configuration);
+ parser = new JMSServerConfigParserImpl();
}
/**
@@ -195,84 +195,7 @@
private void deployConnectionFactory(final Node node) throws Exception
{
ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node);
-
- ArrayList<String> listBindings = new ArrayList<String>();
- for (String str: cfConfig.getBindings())
- {
- listBindings.add(str);
- }
-
- if (cfConfig.getDiscoveryAddress() != null)
- {
- jmsServerControl.createConnectionFactory(cfConfig.getName(),
- cfConfig.getDiscoveryAddress(),
- cfConfig.getDiscoveryPort(),
- cfConfig.getClientID(),
- cfConfig.getDiscoveryRefreshTimeout(),
- cfConfig.getClientFailureCheckPeriod(),
- cfConfig.getConnectionTTL(),
- cfConfig.getCallTimeout(),
- cfConfig.isCacheLargeMessagesClient(),
- cfConfig.getMinLargeMessageSize(),
- cfConfig.getConsumerWindowSize(),
- cfConfig.getConsumerMaxRate(),
- cfConfig.getConfirmationWindowSize(),
- cfConfig.getProducerWindowSize(),
- cfConfig.getProducerMaxRate(),
- cfConfig.isBlockOnAcknowledge(),
- cfConfig.isBlockOnDurableSend(),
- cfConfig.isBlockOnNonDurableSend(),
- cfConfig.isAutoGroup(),
- cfConfig.isPreAcknowledge(),
- cfConfig.getLoadBalancingPolicyClassName(),
- cfConfig.getTransactionBatchSize(),
- cfConfig.getDupsOKBatchSize(),
- cfConfig.getInitialWaitTimeout(),
- cfConfig.isUseGlobalPools(),
- cfConfig.getScheduledThreadPoolMaxSize(),
- cfConfig.getThreadPoolMaxSize(),
- cfConfig.getRetryInterval(),
- cfConfig.getRetryIntervalMultiplier(),
- cfConfig.getMaxRetryInterval(),
- cfConfig.getReconnectAttempts(),
- cfConfig.isFailoverOnServerShutdown(),
- cfConfig.getGroupID(),
- listBindings);
- }
- else
- {
- jmsServerControl.createConnectionFactory(cfConfig.getName(),
- cfConfig.getConnectorConfigs(),
- cfConfig.getClientID(),
- cfConfig.getClientFailureCheckPeriod(),
- cfConfig.getConnectionTTL(),
- cfConfig.getCallTimeout(),
- cfConfig.isCacheLargeMessagesClient(),
- cfConfig.getMinLargeMessageSize(),
- cfConfig.getConsumerWindowSize(),
- cfConfig.getConsumerMaxRate(),
- cfConfig.getConfirmationWindowSize(),
- cfConfig.getProducerWindowSize(),
- cfConfig.getProducerMaxRate(),
- cfConfig.isBlockOnAcknowledge(),
- cfConfig.isBlockOnDurableSend(),
- cfConfig.isBlockOnNonDurableSend(),
- cfConfig.isAutoGroup(),
- cfConfig.isPreAcknowledge(),
- cfConfig.getLoadBalancingPolicyClassName(),
- cfConfig.getTransactionBatchSize(),
- cfConfig.getDupsOKBatchSize(),
- cfConfig.isUseGlobalPools(),
- cfConfig.getScheduledThreadPoolMaxSize(),
- cfConfig.getThreadPoolMaxSize(),
- cfConfig.getRetryInterval(),
- cfConfig.getRetryIntervalMultiplier(),
- cfConfig.getMaxRetryInterval(),
- cfConfig.getReconnectAttempts(),
- cfConfig.isFailoverOnServerShutdown(),
- cfConfig.getGroupID(),
- listBindings);
- }
+ jmsServerControl.createConnectionFactory(cfConfig);
}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-02-04 22:18:08 UTC (rev 8864)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-02-06 01:13:06 UTC (rev 8865)
@@ -14,7 +14,6 @@
package org.hornetq.jms.server.impl;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -26,15 +25,18 @@
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.jms.HornetQJMSClient;
+import org.hornetq.core.config.Configuration;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.FileDeploymentManager;
import org.hornetq.core.deployers.impl.XmlDeployer;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.ActivateCallback;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.cluster.DiscoveryGroupConfiguration;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.SelectorTranslator;
@@ -357,7 +359,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(connectorConfigs);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
}
bindConnectionFactory(cf, name, jndiBindings);
@@ -372,7 +374,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(connectorConfigs);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
cf.setClientID(clientID);
}
@@ -415,7 +417,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(connectorConfigs);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
cf.setClientID(clientID);
cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
cf.setConnectionTTL(connectionTTL);
@@ -488,7 +490,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
cf.setClientID(clientID);
cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
@@ -532,7 +534,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
}
bindConnectionFactory(cf, name, jndiBindings);
@@ -548,13 +550,100 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
cf.setClientID(clientID);
}
bindConnectionFactory(cf, name, jndiBindings);
}
+ public synchronized void createConnectionFactory(final ConnectionFactoryConfiguration cfConfig) throws Exception
+ {
+
+ ArrayList<String> listBindings = new ArrayList<String>();
+ for (String str : cfConfig.getBindings())
+ {
+ listBindings.add(str);
+ }
+
+ List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = lookupConnectors(cfConfig);
+
+ lookupDiscovery(cfConfig);
+
+ if (cfConfig.getDiscoveryAddress() != null)
+ {
+ createConnectionFactory(cfConfig.getName(),
+ cfConfig.getDiscoveryAddress(),
+ cfConfig.getDiscoveryPort(),
+ cfConfig.getClientID(),
+ cfConfig.getDiscoveryRefreshTimeout(),
+ cfConfig.getClientFailureCheckPeriod(),
+ cfConfig.getConnectionTTL(),
+ cfConfig.getCallTimeout(),
+ cfConfig.isCacheLargeMessagesClient(),
+ cfConfig.getMinLargeMessageSize(),
+ cfConfig.getConsumerWindowSize(),
+ cfConfig.getConsumerMaxRate(),
+ cfConfig.getConfirmationWindowSize(),
+ cfConfig.getProducerWindowSize(),
+ cfConfig.getProducerMaxRate(),
+ cfConfig.isBlockOnAcknowledge(),
+ cfConfig.isBlockOnDurableSend(),
+ cfConfig.isBlockOnNonDurableSend(),
+ cfConfig.isAutoGroup(),
+ cfConfig.isPreAcknowledge(),
+ cfConfig.getLoadBalancingPolicyClassName(),
+ cfConfig.getTransactionBatchSize(),
+ cfConfig.getDupsOKBatchSize(),
+ cfConfig.getInitialWaitTimeout(),
+ cfConfig.isUseGlobalPools(),
+ cfConfig.getScheduledThreadPoolMaxSize(),
+ cfConfig.getThreadPoolMaxSize(),
+ cfConfig.getRetryInterval(),
+ cfConfig.getRetryIntervalMultiplier(),
+ cfConfig.getMaxRetryInterval(),
+ cfConfig.getReconnectAttempts(),
+ cfConfig.isFailoverOnServerShutdown(),
+ cfConfig.getGroupID(),
+ listBindings);
+ }
+ else
+ {
+ createConnectionFactory(cfConfig.getName(),
+ connectorConfigs,
+ cfConfig.getClientID(),
+ cfConfig.getClientFailureCheckPeriod(),
+ cfConfig.getConnectionTTL(),
+ cfConfig.getCallTimeout(),
+ cfConfig.isCacheLargeMessagesClient(),
+ cfConfig.getMinLargeMessageSize(),
+ cfConfig.getConsumerWindowSize(),
+ cfConfig.getConsumerMaxRate(),
+ cfConfig.getConfirmationWindowSize(),
+ cfConfig.getProducerWindowSize(),
+ cfConfig.getProducerMaxRate(),
+ cfConfig.isBlockOnAcknowledge(),
+ cfConfig.isBlockOnDurableSend(),
+ cfConfig.isBlockOnNonDurableSend(),
+ cfConfig.isAutoGroup(),
+ cfConfig.isPreAcknowledge(),
+ cfConfig.getLoadBalancingPolicyClassName(),
+ cfConfig.getTransactionBatchSize(),
+ cfConfig.getDupsOKBatchSize(),
+ cfConfig.isUseGlobalPools(),
+ cfConfig.getScheduledThreadPoolMaxSize(),
+ cfConfig.getThreadPoolMaxSize(),
+ cfConfig.getRetryInterval(),
+ cfConfig.getRetryIntervalMultiplier(),
+ cfConfig.getMaxRetryInterval(),
+ cfConfig.getReconnectAttempts(),
+ cfConfig.isFailoverOnServerShutdown(),
+ cfConfig.getGroupID(),
+ listBindings);
+ }
+
+ }
+
public synchronized void createConnectionFactory(final String name,
final TransportConfiguration liveTC,
final List<String> jndiBindings) throws Exception
@@ -563,7 +652,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(liveTC);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC);
}
bindConnectionFactory(cf, name, jndiBindings);
@@ -578,7 +667,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(liveTC);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC);
cf.setClientID(clientID);
}
@@ -594,7 +683,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(liveTC, backupTC);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC, backupTC);
}
bindConnectionFactory(cf, name, jndiBindings);
@@ -610,7 +699,7 @@
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(liveTC, backupTC);
+ cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(liveTC, backupTC);
cf.setClientID(clientID);
}
@@ -741,6 +830,36 @@
return true;
}
+ /**
+ * @param cfConfig
+ * @throws HornetQException
+ */
+ private void lookupDiscovery(final ConnectionFactoryConfiguration cfConfig) throws HornetQException
+ {
+ if (cfConfig.getDiscoveryGroupName() != null)
+ {
+ Configuration configuration = server.getConfiguration();
+
+ DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
+ discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations()
+ .get(cfConfig.getDiscoveryGroupName());
+
+ if (discoveryGroupConfiguration == null)
+ {
+ JMSServerManagerImpl.log.warn("There is no discovery group with name '" + cfConfig.getDiscoveryGroupName() +
+ "' deployed.");
+
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "There is no discovery group with name '" + cfConfig.getDiscoveryGroupName() +
+ "' deployed.");
+ }
+
+ cfConfig.setDiscoveryAddress(discoveryGroupConfiguration.getGroupAddress());
+ cfConfig.setDiscoveryPort(discoveryGroupConfiguration.getGroupPort());
+
+ }
+ }
+
private void addToDestinationBindings(final String destination, final String jndiBinding)
{
if (destinations.get(destination) == null)
@@ -765,77 +884,7 @@
List<ConnectionFactoryConfiguration> connectionFactoryConfigurations = config.getConnectionFactoryConfigurations();
for (ConnectionFactoryConfiguration config : connectionFactoryConfigurations)
{
- if (config.getDiscoveryAddress() != null)
- {
- createConnectionFactory(config.getName(),
- config.getDiscoveryAddress(),
- config.getDiscoveryPort(),
- config.getClientID(),
- config.getDiscoveryRefreshTimeout(),
- config.getClientFailureCheckPeriod(),
- config.getConnectionTTL(),
- config.getCallTimeout(),
- config.isCacheLargeMessagesClient(),
- config.getMinLargeMessageSize(),
- config.getConsumerWindowSize(),
- config.getConsumerMaxRate(),
- config.getConfirmationWindowSize(),
- config.getProducerWindowSize(),
- config.getProducerMaxRate(),
- config.isBlockOnAcknowledge(),
- config.isBlockOnDurableSend(),
- config.isBlockOnNonDurableSend(),
- config.isAutoGroup(),
- config.isPreAcknowledge(),
- config.getLoadBalancingPolicyClassName(),
- config.getTransactionBatchSize(),
- config.getDupsOKBatchSize(),
- config.getInitialWaitTimeout(),
- config.isUseGlobalPools(),
- config.getScheduledThreadPoolMaxSize(),
- config.getThreadPoolMaxSize(),
- config.getRetryInterval(),
- config.getRetryIntervalMultiplier(),
- config.getMaxRetryInterval(),
- config.getReconnectAttempts(),
- config.isFailoverOnServerShutdown(),
- config.getGroupID(),
- Arrays.asList(config.getBindings()));
- }
- else
- {
- createConnectionFactory(config.getName(),
- config.getConnectorConfigs(),
- config.getClientID(),
- config.getClientFailureCheckPeriod(),
- config.getConnectionTTL(),
- config.getCallTimeout(),
- config.isCacheLargeMessagesClient(),
- config.getMinLargeMessageSize(),
- config.getConsumerWindowSize(),
- config.getConsumerMaxRate(),
- config.getConfirmationWindowSize(),
- config.getProducerWindowSize(),
- config.getProducerMaxRate(),
- config.isBlockOnAcknowledge(),
- config.isBlockOnDurableSend(),
- config.isBlockOnNonDurableSend(),
- config.isAutoGroup(),
- config.isPreAcknowledge(),
- config.getLoadBalancingPolicyClassName(),
- config.getTransactionBatchSize(),
- config.getDupsOKBatchSize(),
- config.isUseGlobalPools(),
- config.getScheduledThreadPoolMaxSize(),
- config.getThreadPoolMaxSize(),
- config.getRetryInterval(),
- config.getRetryIntervalMultiplier(),
- config.getMaxRetryInterval(),
- config.getReconnectAttempts(),
- config.isFailoverOnServerShutdown(),
- config.getGroupID(),
- Arrays.asList(config.getBindings()));
- }
+ createConnectionFactory(config);
}
List<QueueConfiguration> queueConfigs = config.getQueueConfigurations();
@@ -859,4 +908,57 @@
}
}
+ /**
+ * @param cfConfig
+ * @return
+ * @throws HornetQException
+ */
+ private List<Pair<TransportConfiguration, TransportConfiguration>> lookupConnectors(final ConnectionFactoryConfiguration cfConfig) throws HornetQException
+ {
+ if (cfConfig.getConnectorConfigs() != null)
+ {
+ return cfConfig.getConnectorConfigs();
+ }
+ else
+ {
+ Configuration configuration = server.getConfiguration();
+ List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
+
+ for (Pair<String, String> configConnector : cfConfig.getConnectorNames())
+ {
+ String connectorName = configConnector.a;
+ String backupConnectorName = configConnector.b;
+
+ TransportConfiguration connector = configuration.getConnectorConfigurations().get(connectorName);
+
+ if (connector == null)
+ {
+ JMSServerManagerImpl.log.warn("There is no connector with name '" + connectorName + "' deployed.");
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "There is no connector with name '" + connectorName + "' deployed.");
+ }
+
+ TransportConfiguration backupConnector = null;
+
+ if (backupConnectorName != null)
+ {
+ backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
+
+ if (backupConnector == null)
+ {
+ JMSServerManagerImpl.log.warn("There is no backup connector with name '" + backupConnectorName +
+ "' deployed.");
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "There is no backup connector with name '" + backupConnectorName +
+ "' deployed.");
+ }
+ }
+
+ connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(connector, backupConnector));
+ }
+ return connectorConfigs;
+
+ }
+ }
+
}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java 2010-02-04 22:18:08 UTC (rev 8864)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java 2010-02-06 01:13:06 UTC (rev 8865)
@@ -54,7 +54,7 @@
// anything so the parsing will work
config.getConnectorConfigurations().put("netty", new TransportConfiguration());
- JMSServerConfigParser parser = new JMSServerConfigParserImpl(config);
+ JMSServerConfigParser parser = new JMSServerConfigParserImpl();
String conf = "hornetq-jms-for-JMSServerDeployerTest.xml";
URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
14 years, 10 months
JBoss hornetq SVN: r8864 - in trunk: src/main/org/hornetq/jms/server and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-02-04 17:18:08 -0500 (Thu, 04 Feb 2010)
New Revision: 8864
Added:
trunk/src/main/org/hornetq/jms/server/JMSServerConfigParser.java
Modified:
trunk/build-maven.xml
trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
Log:
Adding JMSServerConfigParser interface
Modified: trunk/build-maven.xml
===================================================================
--- trunk/build-maven.xml 2010-02-04 19:23:40 UTC (rev 8863)
+++ trunk/build-maven.xml 2010-02-04 22:18:08 UTC (rev 8864)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.0.0.snapshot"/>
+ <property name="hornetq.version" value="2.1.0.snapshot"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
Added: trunk/src/main/org/hornetq/jms/server/JMSServerConfigParser.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerConfigParser.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerConfigParser.java 2010-02-04 22:18:08 UTC (rev 8864)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.jms.server;
+
+import java.io.InputStream;
+
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.JMSConfiguration;
+import org.hornetq.jms.server.config.QueueConfiguration;
+import org.hornetq.jms.server.config.TopicConfiguration;
+import org.w3c.dom.Node;
+
+/**
+ * A JMSServerConfigParser
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public interface JMSServerConfigParser
+{
+ /**
+ * Parse the JMS Configuration XML as a JMSConfiguration object
+ */
+ JMSConfiguration parseConfiguration(final InputStream stream) throws Exception;
+
+ /**
+ * Parse the JMS Configuration XML as a JMSConfiguration object
+ */
+ JMSConfiguration parseConfiguration(final Node rootnode) throws Exception;
+
+ /**
+ * Parse the topic node as a TopicConfiguration object
+ * @param node
+ * @return
+ * @throws Exception
+ */
+ TopicConfiguration parseTopicConfiguration(final Node node) throws Exception;
+
+ /**
+ * Parse the Queue Configuration node as a QueueConfiguration object
+ * @param node
+ * @return
+ * @throws Exception
+ */
+ QueueConfiguration parseQueueConfiguration(final Node node) throws Exception;
+
+ /**
+ * Parse the Connection Configuration node as a ConnectionFactoryConfiguration object
+ * @param node
+ * @return
+ * @throws Exception
+ */
+ ConnectionFactoryConfiguration parseConnectionFactoryConfiguration(final Node node) throws Exception;
+}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-02-04 19:23:40 UTC (rev 8863)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-02-04 22:18:08 UTC (rev 8864)
@@ -27,6 +27,7 @@
import org.hornetq.core.config.impl.Validators;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.cluster.DiscoveryGroupConfiguration;
+import org.hornetq.jms.server.JMSServerConfigParser;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.config.JMSConfiguration;
import org.hornetq.jms.server.config.QueueConfiguration;
@@ -49,7 +50,7 @@
*
*
*/
-public class JMSServerConfigParserImpl
+public class JMSServerConfigParserImpl implements JMSServerConfigParser
{
private static final Logger log = Logger.getLogger(JMSServerConfigParserImpl.class);
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-02-04 19:23:40 UTC (rev 8863)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-02-04 22:18:08 UTC (rev 8864)
@@ -19,6 +19,7 @@
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.XmlDeployer;
import org.hornetq.core.logging.Logger;
+import org.hornetq.jms.server.JMSServerConfigParser;
import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.config.QueueConfiguration;
@@ -36,7 +37,7 @@
private final Configuration configuration;
- private final JMSServerConfigParserImpl parser;
+ private final JMSServerConfigParser parser;
private final JMSServerManager jmsServerControl;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java 2010-02-04 19:23:40 UTC (rev 8863)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java 2010-02-04 22:18:08 UTC (rev 8864)
@@ -18,6 +18,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.Configuration;
+import org.hornetq.jms.server.JMSServerConfigParser;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.config.JMSConfiguration;
import org.hornetq.jms.server.config.QueueConfiguration;
@@ -53,7 +54,7 @@
// anything so the parsing will work
config.getConnectorConfigurations().put("netty", new TransportConfiguration());
- JMSServerConfigParserImpl parser = new JMSServerConfigParserImpl(config);
+ JMSServerConfigParser parser = new JMSServerConfigParserImpl(config);
String conf = "hornetq-jms-for-JMSServerDeployerTest.xml";
URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
14 years, 10 months
JBoss hornetq SVN: r8863 - in trunk: src/main/org/hornetq/core/persistence/impl/journal and 4 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-02-04 14:23:40 -0500 (Thu, 04 Feb 2010)
New Revision: 8863
Modified:
trunk/src/main/org/hornetq/core/persistence/OperationContext.java
trunk/src/main/org/hornetq/core/persistence/StorageManager.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
trunk/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java
trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
Log:
Removing complete operation as it is not used
Modified: trunk/src/main/org/hornetq/core/persistence/OperationContext.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/OperationContext.java 2010-02-04 10:37:19 UTC (rev 8862)
+++ trunk/src/main/org/hornetq/core/persistence/OperationContext.java 2010-02-04 19:23:40 UTC (rev 8863)
@@ -35,9 +35,6 @@
void replicationDone();
- /** To be called when there are no more operations pending */
- void complete();
-
void waitCompletion() throws Exception;
boolean waitCompletion(long timeout) throws Exception;
Modified: trunk/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2010-02-04 10:37:19 UTC (rev 8862)
+++ trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2010-02-04 19:23:40 UTC (rev 8863)
@@ -78,9 +78,6 @@
* @throws Exception */
void waitOnOperations() throws Exception;
- /** To close the OperationsContext */
- void completeOperations();
-
void clearContext();
UUID getPersistentID();
Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-02-04 10:37:19 UTC (rev 8862)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-02-04 19:23:40 UTC (rev 8863)
@@ -292,14 +292,6 @@
perfBlastPages = config.getJournalPerfBlastPages();
}
- /* (non-Javadoc)
- * @see org.hornetq.core.persistence.StorageManager#completeReplication()
- */
- public void completeOperations()
- {
- getContext().complete();
- }
-
public void clearContext()
{
OperationContextImpl.clearContext();
Modified: trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java 2010-02-04 10:37:19 UTC (rev 8862)
+++ trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java 2010-02-04 19:23:40 UTC (rev 8863)
@@ -501,7 +501,6 @@
}
finally
{
- storageManager.completeOperations();
storageManager.clearContext();
}
}
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java 2010-02-04 10:37:19 UTC (rev 8862)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/Redistributor.java 2010-02-04 19:23:40 UTC (rev 8863)
@@ -160,8 +160,6 @@
execPrompter();
}
});
-
- storageManager.completeOperations();
}
private void execPrompter()
Modified: trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2010-02-04 10:37:19 UTC (rev 8862)
+++ trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2010-02-04 19:23:40 UTC (rev 8863)
@@ -584,8 +584,6 @@
{
acknowledge(ref);
}
-
- storageManager.completeOperations();
}
public void setExpiryAddress(final SimpleString expiryAddress)
Modified: trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2010-02-04 10:37:19 UTC (rev 8862)
+++ trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2010-02-04 19:23:40 UTC (rev 8863)
@@ -463,9 +463,6 @@
Assert.assertEquals(msg, msgsResult.get(1));
- // Clearing any exception from the Context, so we can use the context again
- ctx.complete();
-
final CountDownLatch latch3 = new CountDownLatch(1);
ctx.executeOnCompletion(new IOAsyncTask()
14 years, 10 months
JBoss hornetq SVN: r8862 - trunk/src/main/org/hornetq/jms/management/impl.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-02-04 05:37:19 -0500 (Thu, 04 Feb 2010)
New Revision: 8862
Modified:
trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
Log:
added missing subscription infos
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-02-04 02:12:55 UTC (rev 8861)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-02-04 10:37:19 UTC (rev 8862)
@@ -269,7 +269,7 @@
subscriptionInfo[2] = subName;
subscriptionInfo[3] = queue.isDurable();
subscriptionInfo[4] = queue.getMessageCount();
-
+ subscriptionInfo[5] = filter;
subInfos.add(subscriptionInfo);
}
return subInfos.toArray(new Object[subInfos.size()]);
14 years, 10 months
JBoss hornetq SVN: r8861 - in trunk: src/main/org/hornetq/jms/server/config/impl and 3 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-02-03 21:12:55 -0500 (Wed, 03 Feb 2010)
New Revision: 8861
Added:
trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
Removed:
trunk/tests/src/org/hornetq/tests/util/junit/
Modified:
trunk/build-hornetq.xml
trunk/build-maven.xml
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
Log:
Refactoring parser of xml jms configuration for a better integration with the Application Server 5 and 6 and adding install script on build-maven.xml for upload on local repository for development and tests purposes on the AS integration
Modified: trunk/build-hornetq.xml
===================================================================
--- trunk/build-hornetq.xml 2010-01-31 11:49:12 UTC (rev 8860)
+++ trunk/build-hornetq.xml 2010-02-04 02:12:55 UTC (rev 8861)
@@ -637,7 +637,7 @@
<!-- ======================================================================================== -->
<target name="jar"
- depends="jar-core, jar-core-client, jar-jms, jar-jms-client, jar-transports, jar-jboss-integration, jar-jboss-service, jar-bootstrap, jar-logging, jar-ra, jar-mc, jar-jnp-client">
+ depends="jar-core, jar-core-client, jar-jms, jar-jms-client, jar-transports, jar-jboss-integration, jar-jboss-service, jar-bootstrap, jar-logging, jar-ra, jar-mc, jar-jnp-client, jar-resources">
</target>
<target name="jar-jnp-client" depends="init">
@@ -792,7 +792,7 @@
</target>
<property name="build.examples.dir" value="${build.dir}/examples"/>
- <target name="jar-resources" depends="clean,init">
+ <target name="jar-resources" depends="init">
<jar jarfile="${build.jars.dir}/${resources.jar.name}">
<fileset dir=".">
<include name="examples/**"/>
Modified: trunk/build-maven.xml
===================================================================
--- trunk/build-maven.xml 2010-01-31 11:49:12 UTC (rev 8860)
+++ trunk/build-maven.xml 2010-02-04 02:12:55 UTC (rev 8861)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.0.0.CR3"/>
+ <property name="hornetq.version" value="2.0.0.snapshot"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
@@ -88,6 +88,60 @@
</target>
+ <target name="install">
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-resources"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-jms"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-jms-client"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-core"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-jboss-as-integration"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-bootstrap"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-core-client"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-logging"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-ra"/>
+ </antcall>
+
+ <antcall target="upload-local-target">
+ <param name="artifact.id" value="hornetq-transports"/>
+ </antcall>
+
+ </target>
+
+ <target name="upload-local-target">
+ <exec executable="mvn">
+ <arg value="install:install-file"/>
+ <arg value="-DgroupId=org.hornetq"/>
+ <arg value="-DartifactId=${artifact.id}"/>
+ <arg value="-Dversion=${hornetq.version}"/>
+ <arg value="-Dpackaging=jar"/>
+ <arg value="-Dfile=./build/jars/${artifact.id}.jar"/>
+ </exec>
+ </target>
+
<target name="upload">
<exec executable="mvn">
<arg value="-s settings.xml"/>
@@ -172,4 +226,4 @@
<checksum file="${dest.dir}/${jarName}/maven-metadata.xml" algorithm="sha1"/>
</target>
-</project>
\ No newline at end of file
+</project>
Modified: trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-01-31 11:49:12 UTC (rev 8860)
+++ trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-02-04 02:12:55 UTC (rev 8861)
@@ -19,7 +19,6 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
/**
@@ -138,7 +137,6 @@
public ConnectionFactoryConfigurationImpl(final String name,
final List<Pair<TransportConfiguration, TransportConfiguration>> transportConfigs,
- final TransportConfiguration backupConfig,
final String... bindings)
{
this(name, bindings);
Added: trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java (rev 0)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-02-04 02:12:55 UTC (rev 8861)
@@ -0,0 +1,535 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.jms.server.impl;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.Validators;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.server.cluster.DiscoveryGroupConfiguration;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.JMSConfiguration;
+import org.hornetq.jms.server.config.QueueConfiguration;
+import org.hornetq.jms.server.config.TopicConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+import org.hornetq.jms.server.config.impl.JMSConfigurationImpl;
+import org.hornetq.jms.server.config.impl.QueueConfigurationImpl;
+import org.hornetq.jms.server.config.impl.TopicConfigurationImpl;
+import org.hornetq.utils.XMLConfigurationUtil;
+import org.hornetq.utils.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * It parses JMS Configuration Files
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class JMSServerConfigParserImpl
+{
+ private static final Logger log = Logger.getLogger(JMSServerConfigParserImpl.class);
+
+ // Constants -----------------------------------------------------
+
+ protected static final String NAME_ATTR = "name";
+
+ // Attributes ----------------------------------------------------
+
+ private final Configuration configuration;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public JMSServerConfigParserImpl(final Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ // Public --------------------------------------------------------
+
+ /**
+ * Parse the JMS Configuration XML as a JMSConfiguration object
+ */
+ public JMSConfiguration parseConfiguration(final InputStream stream) throws Exception
+ {
+ Reader reader = new InputStreamReader(stream);
+ String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
+ xml = XMLUtil.replaceSystemProps(xml);
+ return parseConfiguration(XMLUtil.stringToElement(xml));
+ }
+
+ /**
+ * Parse the JMS Configuration XML as a JMSConfiguration object
+ */
+ public JMSConfiguration parseConfiguration(final Node rootnode) throws Exception
+ {
+
+ ArrayList<QueueConfiguration> queues = new ArrayList<QueueConfiguration>();
+ ArrayList<TopicConfiguration> topics = new ArrayList<TopicConfiguration>();
+ ArrayList<ConnectionFactoryConfiguration> cfs = new ArrayList<ConnectionFactoryConfiguration>();
+
+ Element e = (Element)rootnode;
+
+ org.hornetq.utils.XMLUtil.validate(rootnode, "schema/hornetq-jms.xsd");
+
+ String elements[] = new String[] { JMSServerDeployer.QUEUE_NODE_NAME,
+ JMSServerDeployer.TOPIC_NODE_NAME,
+ JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME };
+ for (String element : elements)
+ {
+ NodeList children = e.getElementsByTagName(element);
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ Node node = children.item(i);
+ Node keyNode = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR);
+ if (keyNode == null)
+ {
+ JMSServerConfigParserImpl.log.error("key attribute missing for configuration " + node);
+ continue;
+ }
+
+ if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
+ {
+ cfs.add(parseConnectionFactoryConfiguration(node));
+ }
+ else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
+ {
+ topics.add(parseTopicConfiguration(node));
+ }
+ else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
+ {
+ queues.add(parseQueueConfiguration(node));
+ }
+ }
+ }
+
+ JMSConfiguration value = newConfig(queues, topics, cfs);
+
+ return value;
+ }
+
+ /**
+ * Parse the topic node as a TopicConfiguration object
+ * @param node
+ * @return
+ * @throws Exception
+ */
+ public TopicConfiguration parseTopicConfiguration(final Node node) throws Exception
+ {
+ String topicName = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
+ NodeList children = node.getChildNodes();
+ ArrayList<String> jndiNames = new ArrayList<String>();
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ Node child = children.item(i);
+
+ if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
+ {
+ String jndiElement = child.getAttributes().getNamedItem("name").getNodeValue();
+ jndiNames.add(jndiElement);
+ }
+ }
+
+ String[] strBindings = jndiNames.toArray(new String[jndiNames.size()]);
+
+ return newTopic(topicName, strBindings);
+
+ }
+
+ /**
+ * Parse the Queue Configuration node as a QueueConfiguration object
+ * @param node
+ * @return
+ * @throws Exception
+ */
+ public QueueConfiguration parseQueueConfiguration(final Node node) throws Exception
+ {
+ Element e = (Element)node;
+ NamedNodeMap atts = node.getAttributes();
+ String queueName = atts.getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
+ String selectorString = null;
+ boolean durable = XMLConfigurationUtil.getBoolean(e, "durable", JMSServerDeployer.DEFAULT_QUEUE_DURABILITY);
+ NodeList children = node.getChildNodes();
+ ArrayList<String> jndiNames = new ArrayList<String>();
+ for (int i = 0; i < children.getLength(); i++)
+ {
+ Node child = children.item(i);
+
+ if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
+ {
+ String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
+ jndiNames.add(jndiName);
+ }
+ else if (JMSServerDeployer.QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName()))
+ {
+ Node selectorNode = children.item(i);
+ Node attNode = selectorNode.getAttributes().getNamedItem("string");
+ selectorString = attNode.getNodeValue();
+ }
+ }
+
+ String jndiArray[] = jndiNames.toArray(new String[jndiNames.size()]);
+ return newQueue(queueName, selectorString, durable, jndiArray);
+ }
+
+ /**
+ * Parse the Connection Configuration node as a ConnectionFactoryConfiguration object
+ * @param node
+ * @return
+ * @throws Exception
+ */
+ public ConnectionFactoryConfiguration parseConnectionFactoryConfiguration(final Node node) throws Exception
+ {
+ if (!node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
+ {
+ // sanity check, this shouldn't ever happen
+ throw new HornetQException(HornetQException.INTERNAL_ERROR, "Invalid node " + node.getNodeName() +
+ " at parseConnectionFactory");
+ }
+ Element e = (Element)node;
+
+ String name = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
+
+ long clientFailureCheckPeriod = XMLConfigurationUtil.getLong(e,
+ "client-failure-check-period",
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ Validators.MINUS_ONE_OR_GT_ZERO);
+ long connectionTTL = XMLConfigurationUtil.getLong(e,
+ "connection-ttl",
+ HornetQClient.DEFAULT_CONNECTION_TTL,
+ Validators.MINUS_ONE_OR_GE_ZERO);
+ long callTimeout = XMLConfigurationUtil.getLong(e,
+ "call-timeout",
+ HornetQClient.DEFAULT_CALL_TIMEOUT,
+ Validators.GE_ZERO);
+ String clientID = XMLConfigurationUtil.getString(e, "client-id", null, Validators.NO_CHECK);
+ int dupsOKBatchSize = XMLConfigurationUtil.getInteger(e,
+ "dups-ok-batch-size",
+ HornetQClient.DEFAULT_ACK_BATCH_SIZE,
+ Validators.GT_ZERO);
+ int transactionBatchSize = XMLConfigurationUtil.getInteger(e,
+ "transaction-batch-size",
+ HornetQClient.DEFAULT_ACK_BATCH_SIZE,
+ Validators.GT_ZERO);
+ int consumerWindowSize = XMLConfigurationUtil.getInteger(e,
+ "consumer-window-size",
+ HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
+ Validators.MINUS_ONE_OR_GE_ZERO);
+ int producerWindowSize = XMLConfigurationUtil.getInteger(e,
+ "producer-window-size",
+ HornetQClient.DEFAULT_PRODUCER_WINDOW_SIZE,
+ Validators.MINUS_ONE_OR_GT_ZERO);
+ int consumerMaxRate = XMLConfigurationUtil.getInteger(e,
+ "consumer-max-rate",
+ HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
+ Validators.MINUS_ONE_OR_GT_ZERO);
+ int confirmationWindowSize = XMLConfigurationUtil.getInteger(e,
+ "confirmation-window-size",
+ HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
+ Validators.MINUS_ONE_OR_GT_ZERO);
+ int producerMaxRate = XMLConfigurationUtil.getInteger(e,
+ "producer-max-rate",
+ HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
+ Validators.MINUS_ONE_OR_GT_ZERO);
+ boolean cacheLargeMessagesClient = XMLConfigurationUtil.getBoolean(e,
+ "cache-large-message-client",
+ HornetQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT);
+ int minLargeMessageSize = XMLConfigurationUtil.getInteger(e,
+ "min-large-message-size",
+ HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ Validators.GT_ZERO);
+ boolean blockOnAcknowledge = XMLConfigurationUtil.getBoolean(e,
+ "block-on-acknowledge",
+ HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE);
+ boolean blockOnNonDurableSend = XMLConfigurationUtil.getBoolean(e,
+ "block-on-non-durable-send",
+ HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND);
+ boolean blockOnDurableSend = XMLConfigurationUtil.getBoolean(e,
+ "block-on-durable-send",
+ HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND);
+ boolean autoGroup = XMLConfigurationUtil.getBoolean(e, "auto-group", HornetQClient.DEFAULT_AUTO_GROUP);
+ boolean preAcknowledge = XMLConfigurationUtil.getBoolean(e,
+ "pre-acknowledge",
+ HornetQClient.DEFAULT_PRE_ACKNOWLEDGE);
+ long retryInterval = XMLConfigurationUtil.getLong(e,
+ "retry-interval",
+ HornetQClient.DEFAULT_RETRY_INTERVAL,
+ Validators.GT_ZERO);
+ double retryIntervalMultiplier = XMLConfigurationUtil.getDouble(e,
+ "retry-interval-multiplier",
+ HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ Validators.GT_ZERO);
+ long maxRetryInterval = XMLConfigurationUtil.getLong(e,
+ "max-retry-interval",
+ HornetQClient.DEFAULT_MAX_RETRY_INTERVAL,
+ Validators.GT_ZERO);
+ int reconnectAttempts = XMLConfigurationUtil.getInteger(e,
+ "reconnect-attempts",
+ HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
+ Validators.MINUS_ONE_OR_GE_ZERO);
+ boolean failoverOnServerShutdown = XMLConfigurationUtil.getBoolean(e,
+ "failover-on-server-shutdown",
+ HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
+ boolean useGlobalPools = XMLConfigurationUtil.getBoolean(e,
+ "use-global-pools",
+ HornetQClient.DEFAULT_USE_GLOBAL_POOLS);
+ int scheduledThreadPoolMaxSize = XMLConfigurationUtil.getInteger(e,
+ "scheduled-thread-pool-max-size",
+ HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
+ Validators.MINUS_ONE_OR_GT_ZERO);
+ int threadPoolMaxSize = XMLConfigurationUtil.getInteger(e,
+ "thread-pool-max-size",
+ HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
+ Validators.MINUS_ONE_OR_GT_ZERO);
+ String connectionLoadBalancingPolicyClassName = XMLConfigurationUtil.getString(e,
+ "connection-load-balancing-policy-class-name",
+ HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ Validators.NOT_NULL_OR_EMPTY);
+ long discoveryInitialWaitTimeout = XMLConfigurationUtil.getLong(e,
+ "discovery-initial-wait-timeout",
+ HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
+ Validators.GT_ZERO);
+ String groupid = XMLConfigurationUtil.getString(e, "group-id", null, Validators.NO_CHECK);
+ List<String> jndiBindings = new ArrayList<String>();
+ List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
+ DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
+
+ NodeList children = node.getChildNodes();
+
+ for (int j = 0; j < children.getLength(); j++)
+ {
+ Node child = children.item(j);
+
+ if (JMSServerDeployer.ENTRIES_NODE_NAME.equals(child.getNodeName()))
+ {
+ NodeList entries = child.getChildNodes();
+ for (int i = 0; i < entries.getLength(); i++)
+ {
+ Node entry = entries.item(i);
+ if (JMSServerDeployer.ENTRY_NODE_NAME.equals(entry.getNodeName()))
+ {
+ String jndiName = entry.getAttributes().getNamedItem("name").getNodeValue();
+
+ jndiBindings.add(jndiName);
+ }
+ }
+ }
+ else if (JMSServerDeployer.CONNECTORS_NODE_NAME.equals(child.getNodeName()))
+ {
+ NodeList entries = child.getChildNodes();
+ for (int i = 0; i < entries.getLength(); i++)
+ {
+ Node entry = entries.item(i);
+ if (JMSServerDeployer.CONNECTOR_REF_ELEMENT.equals(entry.getNodeName()))
+ {
+ String connectorName = entry.getAttributes().getNamedItem("connector-name").getNodeValue();
+ TransportConfiguration connector = configuration.getConnectorConfigurations().get(connectorName);
+
+ if (connector == null)
+ {
+ JMSServerConfigParserImpl.log.warn("There is no connector with name '" + connectorName +
+ "' deployed.");
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "There is no connector with name '" + connectorName + "' deployed.");
+ }
+
+ TransportConfiguration backupConnector = null;
+ Node backupNode = entry.getAttributes().getNamedItem("backup-connector-name");
+ if (backupNode != null)
+ {
+ String backupConnectorName = backupNode.getNodeValue();
+ backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
+
+ if (backupConnector == null)
+ {
+ JMSServerConfigParserImpl.log.warn("There is no backup connector with name '" + backupConnectorName +
+ "' deployed.");
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "There is no backup connector with name '" + backupConnectorName +
+ "' deployed.");
+ }
+ }
+
+ connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(connector,
+ backupConnector));
+ }
+ }
+ }
+ else if (JMSServerDeployer.DISCOVERY_GROUP_ELEMENT.equals(child.getNodeName()))
+ {
+ String discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
+
+ discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations().get(discoveryGroupName);
+
+ if (discoveryGroupConfiguration == null)
+ {
+ JMSServerConfigParserImpl.log.warn("There is no discovery group with name '" + discoveryGroupName +
+ "' deployed.");
+
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "There is no discovery group with name '" + discoveryGroupName +
+ "' deployed.");
+ }
+ }
+ }
+
+ ConnectionFactoryConfiguration cfConfig;
+
+ String[] strbindings = jndiBindings.toArray(new String[jndiBindings.size()]);
+
+ if (discoveryGroupConfiguration != null)
+ {
+ cfConfig = newCF(name, discoveryInitialWaitTimeout, discoveryGroupConfiguration, strbindings);
+ }
+ else
+ {
+ cfConfig = newCF(name, connectorConfigs, strbindings);
+ }
+
+ cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
+ cfConfig.setClientID(clientID);
+ cfConfig.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ cfConfig.setConnectionTTL(connectionTTL);
+ cfConfig.setCallTimeout(callTimeout);
+ cfConfig.setCacheLargeMessagesClient(cacheLargeMessagesClient);
+ cfConfig.setMinLargeMessageSize(minLargeMessageSize);
+ cfConfig.setConsumerWindowSize(consumerWindowSize);
+ cfConfig.setConsumerMaxRate(consumerMaxRate);
+ cfConfig.setConfirmationWindowSize(confirmationWindowSize);
+ cfConfig.setProducerWindowSize(producerWindowSize);
+ cfConfig.setProducerMaxRate(producerMaxRate);
+ cfConfig.setBlockOnAcknowledge(blockOnAcknowledge);
+ cfConfig.setBlockOnDurableSend(blockOnDurableSend);
+ cfConfig.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ cfConfig.setAutoGroup(autoGroup);
+ cfConfig.setPreAcknowledge(preAcknowledge);
+ cfConfig.setLoadBalancingPolicyClassName(connectionLoadBalancingPolicyClassName);
+ cfConfig.setTransactionBatchSize(transactionBatchSize);
+ cfConfig.setDupsOKBatchSize(dupsOKBatchSize);
+ cfConfig.setUseGlobalPools(useGlobalPools);
+ cfConfig.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ cfConfig.setThreadPoolMaxSize(threadPoolMaxSize);
+ cfConfig.setRetryInterval(retryInterval);
+ cfConfig.setRetryIntervalMultiplier(retryIntervalMultiplier);
+ cfConfig.setMaxRetryInterval(maxRetryInterval);
+ cfConfig.setReconnectAttempts(reconnectAttempts);
+ cfConfig.setFailoverOnServerShutdown(failoverOnServerShutdown);
+ cfConfig.setGroupID(groupid);
+ return cfConfig;
+ }
+
+ /**
+ * hook for integration layers
+ * @param name
+ * @param connectorConfigs
+ * @param strbindings
+ * @return
+ */
+ protected ConnectionFactoryConfiguration newCF(final String name,
+ final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
+ final String[] strbindings)
+ {
+ ConnectionFactoryConfigurationImpl cfConfig;
+ cfConfig = new ConnectionFactoryConfigurationImpl(name, connectorConfigs, strbindings);
+ return cfConfig;
+ }
+
+ /**
+ * hook for integration layers
+ * @param name
+ * @param discoveryInitialWaitTimeout
+ * @param discoveryGroupConfiguration
+ * @param strbindings
+ * @return
+ */
+ protected ConnectionFactoryConfigurationImpl newCF(final String name,
+ final long discoveryInitialWaitTimeout,
+ final DiscoveryGroupConfiguration discoveryGroupConfiguration,
+ final String[] strbindings)
+ {
+ ConnectionFactoryConfigurationImpl cfConfig;
+ cfConfig = new ConnectionFactoryConfigurationImpl(name,
+ discoveryGroupConfiguration.getGroupAddress(),
+ discoveryGroupConfiguration.getGroupPort(),
+ strbindings);
+ cfConfig.setDiscoveryRefreshTimeout(discoveryGroupConfiguration.getRefreshTimeout());
+ cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
+ return cfConfig;
+ }
+
+ /**
+ * hook for integration layers
+ * @param topicName
+ * @param strBindings
+ * @return
+ */
+ protected TopicConfiguration newTopic(final String topicName, final String[] strBindings)
+ {
+ return new TopicConfigurationImpl(topicName, strBindings);
+ }
+
+ /**
+ * hook for integration layers
+ * @param queueName
+ * @param selectorString
+ * @param durable
+ * @param jndiArray
+ * @return
+ */
+ protected QueueConfiguration newQueue(final String queueName,
+ final String selectorString,
+ final boolean durable,
+ final String[] jndiArray)
+ {
+ return new QueueConfigurationImpl(queueName, selectorString, durable, jndiArray);
+ }
+
+ /**
+ * hook for integration layers
+ * @param queues
+ * @param topics
+ * @param cfs
+ * @return
+ */
+ protected JMSConfiguration newConfig(final ArrayList<QueueConfiguration> queues,
+ final ArrayList<TopicConfiguration> topics,
+ final ArrayList<ConnectionFactoryConfiguration> cfs)
+ {
+ JMSConfiguration value = new JMSConfigurationImpl(cfs, queues, topics);
+ return value;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-01-31 11:49:12 UTC (rev 8860)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-02-04 02:12:55 UTC (rev 8861)
@@ -14,23 +14,16 @@
package org.hornetq.jms.server.impl;
import java.util.ArrayList;
-import java.util.List;
-import org.hornetq.api.core.Pair;
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.Validators;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.XmlDeployer;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.cluster.DiscoveryGroupConfiguration;
import org.hornetq.jms.server.JMSServerManager;
-import org.hornetq.utils.XMLConfigurationUtil;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.QueueConfiguration;
+import org.hornetq.jms.server.config.TopicConfiguration;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
@@ -42,28 +35,30 @@
private static final Logger log = Logger.getLogger(JMSServerDeployer.class);
private final Configuration configuration;
+
+ private final JMSServerConfigParserImpl parser;
private final JMSServerManager jmsServerControl;
- private static final String CONNECTOR_REF_ELEMENT = "connector-ref";
+ protected static final String CONNECTOR_REF_ELEMENT = "connector-ref";
- private static final String DISCOVERY_GROUP_ELEMENT = "discovery-group-ref";
+ protected static final String DISCOVERY_GROUP_ELEMENT = "discovery-group-ref";
- private static final String ENTRIES_NODE_NAME = "entries";
+ protected static final String ENTRIES_NODE_NAME = "entries";
- private static final String ENTRY_NODE_NAME = "entry";
+ protected static final String ENTRY_NODE_NAME = "entry";
- private static final String CONNECTORS_NODE_NAME = "connectors";
+ protected static final String CONNECTORS_NODE_NAME = "connectors";
- private static final String CONNECTION_FACTORY_NODE_NAME = "connection-factory";
+ protected static final String CONNECTION_FACTORY_NODE_NAME = "connection-factory";
- private static final String QUEUE_NODE_NAME = "queue";
+ protected static final String QUEUE_NODE_NAME = "queue";
- private static final String QUEUE_SELECTOR_NODE_NAME = "selector";
+ protected static final String QUEUE_SELECTOR_NODE_NAME = "selector";
- private static final String TOPIC_NODE_NAME = "topic";
+ protected static final String TOPIC_NODE_NAME = "topic";
- private static final boolean DEFAULT_QUEUE_DURABILITY = true;
+ protected static final boolean DEFAULT_QUEUE_DURABILITY = true;
public JMSServerDeployer(final JMSServerManager jmsServerManager,
final DeploymentManager deploymentManager,
@@ -74,6 +69,8 @@
jmsServerControl = jmsServerManager;
configuration = config;
+
+ parser = new JMSServerConfigParserImpl(configuration);
}
/**
@@ -117,305 +114,15 @@
{
if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
{
- Element e = (Element)node;
-
- long clientFailureCheckPeriod = XMLConfigurationUtil.getLong(e,
- "client-failure-check-period",
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- Validators.MINUS_ONE_OR_GT_ZERO);
- long connectionTTL = XMLConfigurationUtil.getLong(e,
- "connection-ttl",
- HornetQClient.DEFAULT_CONNECTION_TTL,
- Validators.MINUS_ONE_OR_GE_ZERO);
- long callTimeout = XMLConfigurationUtil.getLong(e,
- "call-timeout",
- HornetQClient.DEFAULT_CALL_TIMEOUT,
- Validators.GE_ZERO);
- String clientID = XMLConfigurationUtil.getString(e, "client-id", null, Validators.NO_CHECK);
- int dupsOKBatchSize = XMLConfigurationUtil.getInteger(e,
- "dups-ok-batch-size",
- HornetQClient.DEFAULT_ACK_BATCH_SIZE,
- Validators.GT_ZERO);
- int transactionBatchSize = XMLConfigurationUtil.getInteger(e,
- "transaction-batch-size",
- HornetQClient.DEFAULT_ACK_BATCH_SIZE,
- Validators.GT_ZERO);
- int consumerWindowSize = XMLConfigurationUtil.getInteger(e,
- "consumer-window-size",
- HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
- Validators.MINUS_ONE_OR_GE_ZERO);
- int producerWindowSize = XMLConfigurationUtil.getInteger(e,
- "producer-window-size",
- HornetQClient.DEFAULT_PRODUCER_WINDOW_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int consumerMaxRate = XMLConfigurationUtil.getInteger(e,
- "consumer-max-rate",
- HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int confirmationWindowSize = XMLConfigurationUtil.getInteger(e,
- "confirmation-window-size",
- HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int producerMaxRate = XMLConfigurationUtil.getInteger(e,
- "producer-max-rate",
- HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- boolean cacheLargeMessagesClient = XMLConfigurationUtil.getBoolean(e,
- "cache-large-message-client",
- HornetQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT);
- int minLargeMessageSize = XMLConfigurationUtil.getInteger(e,
- "min-large-message-size",
- HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- Validators.GT_ZERO);
- boolean blockOnAcknowledge = XMLConfigurationUtil.getBoolean(e,
- "block-on-acknowledge",
- HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE);
- boolean blockOnNonDurableSend = XMLConfigurationUtil.getBoolean(e,
- "block-on-non-durable-send",
- HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND);
- boolean blockOnDurableSend = XMLConfigurationUtil.getBoolean(e,
- "block-on-durable-send",
- HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND);
- boolean autoGroup = XMLConfigurationUtil.getBoolean(e,
- "auto-group",
- HornetQClient.DEFAULT_AUTO_GROUP);
- boolean preAcknowledge = XMLConfigurationUtil.getBoolean(e,
- "pre-acknowledge",
- HornetQClient.DEFAULT_PRE_ACKNOWLEDGE);
- long retryInterval = XMLConfigurationUtil.getLong(e,
- "retry-interval",
- HornetQClient.DEFAULT_RETRY_INTERVAL,
- Validators.GT_ZERO);
- double retryIntervalMultiplier = XMLConfigurationUtil.getDouble(e,
- "retry-interval-multiplier",
- HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
- Validators.GT_ZERO);
- long maxRetryInterval = XMLConfigurationUtil.getLong(e,
- "max-retry-interval",
- HornetQClient.DEFAULT_MAX_RETRY_INTERVAL,
- Validators.GT_ZERO);
- int reconnectAttempts = XMLConfigurationUtil.getInteger(e,
- "reconnect-attempts",
- HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
- Validators.MINUS_ONE_OR_GE_ZERO);
- boolean failoverOnServerShutdown = XMLConfigurationUtil.getBoolean(e,
- "failover-on-server-shutdown",
- HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
- boolean useGlobalPools = XMLConfigurationUtil.getBoolean(e,
- "use-global-pools",
- HornetQClient.DEFAULT_USE_GLOBAL_POOLS);
- int scheduledThreadPoolMaxSize = XMLConfigurationUtil.getInteger(e,
- "scheduled-thread-pool-max-size",
- HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int threadPoolMaxSize = XMLConfigurationUtil.getInteger(e,
- "thread-pool-max-size",
- HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- String connectionLoadBalancingPolicyClassName = XMLConfigurationUtil.getString(e,
- "connection-load-balancing-policy-class-name",
- HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- Validators.NOT_NULL_OR_EMPTY);
- long discoveryInitialWaitTimeout = XMLConfigurationUtil.getLong(e,
- "discovery-initial-wait-timeout",
- HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
- Validators.GT_ZERO);
- String groupid = XMLConfigurationUtil.getString(e, "group-id", null, Validators.NO_CHECK);
- List<String> jndiBindings = new ArrayList<String>();
- List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
-
- NodeList children = node.getChildNodes();
-
- for (int j = 0; j < children.getLength(); j++)
- {
- Node child = children.item(j);
-
- if (JMSServerDeployer.ENTRIES_NODE_NAME.equals(child.getNodeName()))
- {
- NodeList entries = child.getChildNodes();
- for (int i = 0; i < entries.getLength(); i++)
- {
- Node entry = entries.item(i);
- if (JMSServerDeployer.ENTRY_NODE_NAME.equals(entry.getNodeName()))
- {
- String jndiName = entry.getAttributes().getNamedItem("name").getNodeValue();
-
- jndiBindings.add(jndiName);
- }
- }
- }
- else if (JMSServerDeployer.CONNECTORS_NODE_NAME.equals(child.getNodeName()))
- {
- NodeList entries = child.getChildNodes();
- for (int i = 0; i < entries.getLength(); i++)
- {
- Node entry = entries.item(i);
- if (JMSServerDeployer.CONNECTOR_REF_ELEMENT.equals(entry.getNodeName()))
- {
- String connectorName = entry.getAttributes().getNamedItem("connector-name").getNodeValue();
- TransportConfiguration connector = configuration.getConnectorConfigurations().get(connectorName);
-
- if (connector == null)
- {
- JMSServerDeployer.log.warn("There is no connector with name '" + connectorName + "' deployed.");
- return;
- }
-
- TransportConfiguration backupConnector = null;
- Node backupNode = entry.getAttributes().getNamedItem("backup-connector-name");
- if (backupNode != null)
- {
- String backupConnectorName = backupNode.getNodeValue();
- backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
-
- if (backupConnector == null)
- {
- JMSServerDeployer.log.warn("There is no backup connector with name '" + connectorName +
- "' deployed.");
- return;
- }
- }
-
- connectorConfigs.add(new Pair<TransportConfiguration, TransportConfiguration>(connector,
- backupConnector));
- }
- }
- }
- else if (JMSServerDeployer.DISCOVERY_GROUP_ELEMENT.equals(child.getNodeName()))
- {
- String discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
-
- discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations().get(discoveryGroupName);
-
- if (discoveryGroupConfiguration == null)
- {
- JMSServerDeployer.log.warn("There is no discovery group with name '" + discoveryGroupName +
- "' deployed.");
-
- return;
- }
- }
- }
-
- String name = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
-
- if (discoveryGroupConfiguration != null)
- {
- jmsServerControl.createConnectionFactory(name,
- discoveryGroupConfiguration.getGroupAddress(),
- discoveryGroupConfiguration.getGroupPort(),
- clientID,
- discoveryGroupConfiguration.getRefreshTimeout(),
- clientFailureCheckPeriod,
- connectionTTL,
- callTimeout,
- cacheLargeMessagesClient,
- minLargeMessageSize,
- consumerWindowSize,
- consumerMaxRate,
- confirmationWindowSize,
- producerWindowSize,
- producerMaxRate,
- blockOnAcknowledge,
- blockOnDurableSend,
- blockOnNonDurableSend,
- autoGroup,
- preAcknowledge,
- connectionLoadBalancingPolicyClassName,
- transactionBatchSize,
- dupsOKBatchSize,
- discoveryInitialWaitTimeout,
- useGlobalPools,
- scheduledThreadPoolMaxSize,
- threadPoolMaxSize,
- retryInterval,
- retryIntervalMultiplier,
- maxRetryInterval,
- reconnectAttempts,
- failoverOnServerShutdown,
- groupid,
- jndiBindings);
- }
- else
- {
- jmsServerControl.createConnectionFactory(name,
- connectorConfigs,
- clientID,
- clientFailureCheckPeriod,
- connectionTTL,
- callTimeout,
- cacheLargeMessagesClient,
- minLargeMessageSize,
- consumerWindowSize,
- consumerMaxRate,
- confirmationWindowSize,
- producerWindowSize,
- producerMaxRate,
- blockOnAcknowledge,
- blockOnDurableSend,
- blockOnNonDurableSend,
- autoGroup,
- preAcknowledge,
- connectionLoadBalancingPolicyClassName,
- transactionBatchSize,
- dupsOKBatchSize,
- useGlobalPools,
- scheduledThreadPoolMaxSize,
- threadPoolMaxSize,
- retryInterval,
- retryIntervalMultiplier,
- maxRetryInterval,
- reconnectAttempts,
- failoverOnServerShutdown,
- groupid,
- jndiBindings);
- }
+ deployConnectionFactory(node);
}
else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
- Element e = (Element)node;
- NamedNodeMap atts = node.getAttributes();
- String queueName = atts.getNamedItem(getKeyAttribute()).getNodeValue();
- String selectorString = null;
- boolean durable = XMLConfigurationUtil.getBoolean(e, "durable", JMSServerDeployer.DEFAULT_QUEUE_DURABILITY);
- NodeList children = node.getChildNodes();
- ArrayList<String> jndiNames = new ArrayList<String>();
- for (int i = 0; i < children.getLength(); i++)
- {
- Node child = children.item(i);
-
- if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
- {
- String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
- jndiNames.add(jndiName);
- }
- else if (JMSServerDeployer.QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName()))
- {
- Node selectorNode = children.item(i);
- Node attNode = selectorNode.getAttributes().getNamedItem("string");
- selectorString = attNode.getNodeValue();
- }
- }
- for (String jndiName : jndiNames)
- {
- jmsServerControl.createQueue(queueName, jndiName, selectorString, durable);
- }
+ deployQueue(node);
}
else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
{
- String topicName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++)
- {
- Node child = children.item(i);
-
- if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
- {
- String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
- jmsServerControl.createTopic(topicName, jndiName);
- }
- }
+ deployTopic(node);
}
}
@@ -451,4 +158,121 @@
return new String[] { "hornetq-jms.xml" };
}
+
+
+
+ /**
+ * @param node
+ * @throws Exception
+ */
+ private void deployTopic(final Node node) throws Exception
+ {
+ TopicConfiguration topicConfig = parser.parseTopicConfiguration(node);
+ for (String jndi : topicConfig.getBindings())
+ {
+ jmsServerControl.createTopic(topicConfig.getName(), jndi);
+ }
+ }
+
+ /**
+ * @param node
+ * @throws Exception
+ */
+ private void deployQueue(final Node node) throws Exception
+ {
+ QueueConfiguration queueconfig = parser.parseQueueConfiguration(node);
+ for (String jndiName : queueconfig.getBindings())
+ {
+ jmsServerControl.createQueue(queueconfig.getName(), jndiName, queueconfig.getSelector(), queueconfig.isDurable());
+ }
+ }
+
+ /**
+ * @param node
+ * @throws Exception
+ */
+ private void deployConnectionFactory(final Node node) throws Exception
+ {
+ ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node);
+
+ ArrayList<String> listBindings = new ArrayList<String>();
+ for (String str: cfConfig.getBindings())
+ {
+ listBindings.add(str);
+ }
+
+ if (cfConfig.getDiscoveryAddress() != null)
+ {
+ jmsServerControl.createConnectionFactory(cfConfig.getName(),
+ cfConfig.getDiscoveryAddress(),
+ cfConfig.getDiscoveryPort(),
+ cfConfig.getClientID(),
+ cfConfig.getDiscoveryRefreshTimeout(),
+ cfConfig.getClientFailureCheckPeriod(),
+ cfConfig.getConnectionTTL(),
+ cfConfig.getCallTimeout(),
+ cfConfig.isCacheLargeMessagesClient(),
+ cfConfig.getMinLargeMessageSize(),
+ cfConfig.getConsumerWindowSize(),
+ cfConfig.getConsumerMaxRate(),
+ cfConfig.getConfirmationWindowSize(),
+ cfConfig.getProducerWindowSize(),
+ cfConfig.getProducerMaxRate(),
+ cfConfig.isBlockOnAcknowledge(),
+ cfConfig.isBlockOnDurableSend(),
+ cfConfig.isBlockOnNonDurableSend(),
+ cfConfig.isAutoGroup(),
+ cfConfig.isPreAcknowledge(),
+ cfConfig.getLoadBalancingPolicyClassName(),
+ cfConfig.getTransactionBatchSize(),
+ cfConfig.getDupsOKBatchSize(),
+ cfConfig.getInitialWaitTimeout(),
+ cfConfig.isUseGlobalPools(),
+ cfConfig.getScheduledThreadPoolMaxSize(),
+ cfConfig.getThreadPoolMaxSize(),
+ cfConfig.getRetryInterval(),
+ cfConfig.getRetryIntervalMultiplier(),
+ cfConfig.getMaxRetryInterval(),
+ cfConfig.getReconnectAttempts(),
+ cfConfig.isFailoverOnServerShutdown(),
+ cfConfig.getGroupID(),
+ listBindings);
+ }
+ else
+ {
+ jmsServerControl.createConnectionFactory(cfConfig.getName(),
+ cfConfig.getConnectorConfigs(),
+ cfConfig.getClientID(),
+ cfConfig.getClientFailureCheckPeriod(),
+ cfConfig.getConnectionTTL(),
+ cfConfig.getCallTimeout(),
+ cfConfig.isCacheLargeMessagesClient(),
+ cfConfig.getMinLargeMessageSize(),
+ cfConfig.getConsumerWindowSize(),
+ cfConfig.getConsumerMaxRate(),
+ cfConfig.getConfirmationWindowSize(),
+ cfConfig.getProducerWindowSize(),
+ cfConfig.getProducerMaxRate(),
+ cfConfig.isBlockOnAcknowledge(),
+ cfConfig.isBlockOnDurableSend(),
+ cfConfig.isBlockOnNonDurableSend(),
+ cfConfig.isAutoGroup(),
+ cfConfig.isPreAcknowledge(),
+ cfConfig.getLoadBalancingPolicyClassName(),
+ cfConfig.getTransactionBatchSize(),
+ cfConfig.getDupsOKBatchSize(),
+ cfConfig.isUseGlobalPools(),
+ cfConfig.getScheduledThreadPoolMaxSize(),
+ cfConfig.getThreadPoolMaxSize(),
+ cfConfig.getRetryInterval(),
+ cfConfig.getRetryIntervalMultiplier(),
+ cfConfig.getMaxRetryInterval(),
+ cfConfig.getReconnectAttempts(),
+ cfConfig.isFailoverOnServerShutdown(),
+ cfConfig.getGroupID(),
+ listBindings);
+ }
+ }
+
+
}
Added: trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java 2010-02-04 02:12:55 UTC (rev 8861)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.jms.server.config;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.JMSConfiguration;
+import org.hornetq.jms.server.config.QueueConfiguration;
+import org.hornetq.jms.server.config.TopicConfiguration;
+import org.hornetq.jms.server.impl.JMSServerConfigParserImpl;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * A JMSServerConfigParserTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class JMSServerConfigParserTest extends ServiceTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+
+ public void testParsing() throws Exception
+ {
+ Configuration config = createDefaultConfig();
+
+ // anything so the parsing will work
+ config.getConnectorConfigurations().put("netty", new TransportConfiguration());
+
+ JMSServerConfigParserImpl parser = new JMSServerConfigParserImpl(config);
+
+ String conf = "hornetq-jms-for-JMSServerDeployerTest.xml";
+ URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
+
+ InputStream stream = confURL.openStream();
+
+ JMSConfiguration jmsconfig = parser.parseConfiguration(stream);
+ stream.close();
+
+ ConnectionFactoryConfiguration cfConfig = jmsconfig.getConnectionFactoryConfigurations().get(0);
+
+ assertEquals(1234, cfConfig.getClientFailureCheckPeriod());
+ assertEquals(5678, cfConfig.getCallTimeout());
+ assertEquals(12345, cfConfig.getConsumerWindowSize());
+ assertEquals(6789, cfConfig.getConsumerMaxRate());
+ assertEquals(123456, cfConfig.getConfirmationWindowSize());
+ assertEquals(7712652, cfConfig.getProducerWindowSize());
+ assertEquals(789, cfConfig.getProducerMaxRate());
+ assertEquals(12, cfConfig.getMinLargeMessageSize());
+ assertEquals("TestClientID", cfConfig.getClientID());
+ assertEquals(3456, cfConfig.getDupsOKBatchSize());
+ assertEquals(4567, cfConfig.getTransactionBatchSize());
+ assertEquals(true, cfConfig.isBlockOnAcknowledge());
+ assertEquals(false, cfConfig.isBlockOnNonDurableSend());
+ assertEquals(true, cfConfig.isBlockOnDurableSend());
+ assertEquals(false, cfConfig.isAutoGroup());
+ assertEquals(true, cfConfig.isPreAcknowledge());
+ assertEquals(2345, cfConfig.getConnectionTTL());
+ assertEquals(678, cfConfig.getInitialWaitTimeout());
+ assertEquals(false, cfConfig.isFailoverOnServerShutdown());
+ assertEquals("FooClass", cfConfig.getLoadBalancingPolicyClassName());
+ assertEquals(34, cfConfig.getReconnectAttempts());
+ assertEquals(5, cfConfig.getRetryInterval());
+ assertEquals(6.0, cfConfig.getRetryIntervalMultiplier());
+ assertEquals(300, cfConfig.getMaxRetryInterval());
+ assertEquals(true, cfConfig.isCacheLargeMessagesClient());
+
+
+ assertEquals(1, jmsconfig.getQueueConfigurations().size());
+
+ QueueConfiguration queueConfig = jmsconfig.getQueueConfigurations().get(0);
+ assertEquals("fullConfigurationQueue", queueConfig.getName());
+ assertEquals(2, queueConfig.getBindings().length);
+ assertEquals("/fullConfigurationQueue", queueConfig.getBindings()[0]);
+ assertEquals("/queue/fullConfigurationQueue", queueConfig.getBindings()[1]);
+
+
+ assertEquals(1, jmsconfig.getTopicConfigurations().size());
+ TopicConfiguration topicConfig = jmsconfig.getTopicConfigurations().get(0);
+ assertEquals("fullConfigurationTopic", topicConfig.getName());
+ assertEquals(2, topicConfig.getBindings().length);
+ assertEquals("/fullConfigurationTopic", topicConfig.getBindings()[0]);
+ assertEquals("/topic/fullConfigurationTopic", topicConfig.getBindings()[1]);
+
+
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
14 years, 10 months