Author: gaohoward
Date: 2010-10-10 21:04:43 -0400 (Sun, 10 Oct 2010)
New Revision: 9765
Added:
trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java
trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java
trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java
trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java
trunk/src/main/org/hornetq/jms/server/impl/JMSFactoryType.java
Modified:
trunk/docs/user-manual/en/configuration-index.xml
trunk/docs/user-manual/en/using-jms.xml
trunk/docs/user-manual/zh/configuration-index.xml
trunk/docs/user-manual/zh/using-jms.xml
trunk/src/config/common/schema/hornetq-jms.xsd
trunk/src/main/org/hornetq/api/core/client/HornetQClient.java
trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java
trunk/src/main/org/hornetq/jms/bridge/ConnectionFactoryFactory.java
trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
trunk/src/main/org/hornetq/jms/bridge/impl/JNDIConnectionFactoryFactory.java
trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
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/JMSServerManagerImpl.java
trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
Log:
HORNETQ-515 -- code and doc
Modified: trunk/docs/user-manual/en/configuration-index.xml
===================================================================
--- trunk/docs/user-manual/en/configuration-index.xml 2010-10-11 01:01:04 UTC (rev 9764)
+++ trunk/docs/user-manual/en/configuration-index.xml 2010-10-11 01:04:43 UTC (rev 9765)
@@ -1018,6 +1018,22 @@
<colspec colname="c4" colnum="4"/>
<tbody>
<row>
+ <entry
id="configuration.connection-factory.signature">
+ <link
linkend="using-jms.configure.factory.types">connection-factory.signature
(attribute)</link>
+ </entry>
+ <entry>String</entry>
+ <entry>Type of connection factory</entry>
+ <entry>generic</entry>
+ </row>
+ <row>
+ <entry
id="configuration.connection-factory.signature">
+ <link
linkend="using-jms.configure.factory.types">connection-factory.xa</link>
+ </entry>
+ <entry>Boolean</entry>
+ <entry>If it is a XA connection factory</entry>
+ <entry>false</entry>
+ </row>
+ <row>
<entry
id="configuration.connection-factory.auto-group">
<link
linkend="message-grouping.jmsconfigure">connection-factory.auto-group</link>
</entry>
Modified: trunk/docs/user-manual/en/using-jms.xml
===================================================================
--- trunk/docs/user-manual/en/using-jms.xml 2010-10-11 01:01:04 UTC (rev 9764)
+++ trunk/docs/user-manual/en/using-jms.xml 2010-10-11 01:04:43 UTC (rev 9765)
@@ -87,6 +87,82 @@
defines the transport and parameters used to actually connect to the
server.</para>
</note>
</section>
+ <section id="using-jms.configure.factory.types">
+ <title>Connection Factory Types</title>
+ <para>The JMS API doc provides several connection factories for
applications. HornetQ JMS users
+ can choose to configure the types for their connection factories. Each
connection factory
+ has a <literal>signature</literal> attribute and a
<literal>xa</literal> parameter, the
+ combination of which determines the type of the factory. Attribute
<literal>signature</literal>
+ has three possible string values, i.e.
<emphasis>generic</emphasis>,
+ <emphasis>queue</emphasis> and
<emphasis>topic</emphasis>; <literal>xa</literal> is a boolean
+ type parameter. The following table gives their configuration values for
different
+ connection factory interfaces.</para>
+ <table frame="topbot"
id="using-jms.table.configure.factory.types">
+ <title>Configuration for Connection Factory Types</title>
+ <tgroup cols="3">
+ <colspec colname="signature" colnum="1"/>
+ <colspec colname="xa" colnum="2"/>
+ <colspec colname="cftype" colnum="3"/>
+ <thead>
+ <row>
+ <entry>signature</entry>
+ <entry>xa</entry>
+ <entry>Connection Factory Type</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>generic (default)</entry>
+ <entry>false (default)</entry>
+ <entry>javax.jms.ConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>generic</entry>
+ <entry>true</entry>
+ <entry>javax.jms.XAConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>queue</entry>
+ <entry>false</entry>
+ <entry>javax.jms.QueueConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>queue</entry>
+ <entry>true</entry>
+
<entry>javax.jms.XAQueueConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>topic</entry>
+ <entry>false</entry>
+ <entry>javax.jms.TopicConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>topic</entry>
+ <entry>true</entry>
+
<entry>javax.jms.XATopicConnectionFactory</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>As an example, the following configures an
XAQueueConnectionFactory:</para>
+ <programlisting>
+<configuration xmlns="urn:hornetq"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq ../schemas/hornetq-jms.xsd ">
+
+ <connection-factory name="ConnectionFactory"
signature="queue">
+ <xa>true</xa>
+ <connectors>
+ <connector-ref connector-name="netty"/>
+ </connectors>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ </entries>
+ </connection-factory>
+</configuration>
+ </programlisting>
+
+ </section>
<section>
<title>JNDI configuration</title>
<para>When using JNDI from the client side you need to specify a set of
JNDI properties
Modified: trunk/docs/user-manual/zh/configuration-index.xml
===================================================================
--- trunk/docs/user-manual/zh/configuration-index.xml 2010-10-11 01:01:04 UTC (rev 9764)
+++ trunk/docs/user-manual/zh/configuration-index.xml 2010-10-11 01:04:43 UTC (rev 9765)
@@ -952,6 +952,22 @@
<entry/>
</row>
<row>
+ <entry
id="configuration.connection-factory.signature">
+ <link
linkend="using-jms.configure.factory.types">connection-factory.signature
(属性)</link>
+ </entry>
+ <entry>String</entry>
+ <entry>连接工厂的类型</entry>
+ <entry>generic</entry>
+ </row>
+ <row>
+ <entry
id="configuration.connection-factory.signature">
+ <link
linkend="using-jms.configure.factory.types">connection-factory.xa</link>
+ </entry>
+ <entry>Boolean</entry>
+ <entry>是否是XA类型的连接工厂</entry>
+ <entry>false</entry>
+ </row>
+ <row>
<entry
id="configuration.connection-factory.auto-group">
<link
linkend="message-grouping.jmsconfigure">connection-factory.auto-group</link>
</entry>
Modified: trunk/docs/user-manual/zh/using-jms.xml
===================================================================
--- trunk/docs/user-manual/zh/using-jms.xml 2010-10-11 01:01:04 UTC (rev 9764)
+++ trunk/docs/user-manual/zh/using-jms.xml 2010-10-11 01:04:43 UTC (rev 9765)
@@ -72,6 +72,77 @@
<literal>hornetq-configuration.xml</literal>
中。它定义了采用何种传输与服务器连接。</para>
</note>
</section>
+ <section id="using-jms.configure.factory.types">
+ <title>连接工厂的类型</title>
+ <para>在JMS API文档中有几种不同类型的连接工厂供用户使用。HornetQ为用户提供了配置连接工厂类型的参数。用户可以通过
+
配置连接工厂的”signature"属性和"xa"参数来得到想要的类型。“singature"属性是字符串类型,它有三个可选值:
+
<emphasis>generic</emphasis>、<emphasis>queue</emphasis>和<emphasis>topic</emphasis>;
+
<literal>xa</literal>是一个布尔型参数。下表给出了不同类型连接工厂对应的配置值:</para>
+ <table frame="topbot"
id="using-jms.table.configure.factory.types">
+ <title>连接工厂类型的配置</title>
+ <tgroup cols="3">
+ <colspec colname="signature" colnum="1"/>
+ <colspec colname="xa" colnum="2"/>
+ <colspec colname="cftype" colnum="3"/>
+ <thead>
+ <row>
+ <entry>signature</entry>
+ <entry>xa</entry>
+ <entry>连接工厂的类型</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>generic (默认)</entry>
+ <entry>false (默认)</entry>
+ <entry>javax.jms.ConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>generic</entry>
+ <entry>true</entry>
+ <entry>javax.jms.XAConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>queue</entry>
+ <entry>false</entry>
+ <entry>javax.jms.QueueConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>queue</entry>
+ <entry>true</entry>
+
<entry>javax.jms.XAQueueConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>topic</entry>
+ <entry>false</entry>
+ <entry>javax.jms.TopicConnectionFactory</entry>
+ </row>
+ <row>
+ <entry>topic</entry>
+ <entry>true</entry>
+
<entry>javax.jms.XATopicConnectionFactory</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>下面的例子配置了一个XAQueueConnectionFactory:</para>
+ <programlisting>
+<configuration xmlns="urn:hornetq"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq ../schemas/hornetq-jms.xsd ">
+
+ <connection-factory name="ConnectionFactory"
signature="queue">
+ <xa>true</xa>
+ <connectors>
+ <connector-ref connector-name="netty"/>
+ </connectors>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ </entries>
+ </connection-factory>
+</configuration>
+ </programlisting>
+ </section>
<section>
<title>JNDI的配置</title>
<para>当客户端使用JNDI时需要定义一些JNDI的参数。这些参数主要用来确定JNDI服务的地址。这些参数通常保存在
Modified: trunk/src/config/common/schema/hornetq-jms.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-jms.xsd 2010-10-11 01:01:04 UTC (rev 9764)
+++ trunk/src/config/common/schema/hornetq-jms.xsd 2010-10-11 01:04:43 UTC (rev 9765)
@@ -26,6 +26,7 @@
<xsd:element name="connection-factory">
<xsd:complexType>
<xsd:all>
+ <xsd:element name="xa" type="xsd:boolean"
maxOccurs="1" minOccurs="0"></xsd:element>
<xsd:element name="discovery-group-ref"
type="discovery-group-refType" maxOccurs="1"
minOccurs="0"></xsd:element>
<xsd:element name="discovery-initial-wait-timeout"
type="xsd:long" maxOccurs="1"
minOccurs="0"></xsd:element>
@@ -135,6 +136,7 @@
</xsd:element>
</xsd:all>
<xsd:attribute name="name"
type="xsd:string"></xsd:attribute>
+ <xsd:attribute name="signature"
type="xsd:string"></xsd:attribute>
</xsd:complexType>
</xsd:element>
Modified: trunk/src/main/org/hornetq/api/core/client/HornetQClient.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/client/HornetQClient.java 2010-10-11 01:01:04 UTC
(rev 9764)
+++ trunk/src/main/org/hornetq/api/core/client/HornetQClient.java 2010-10-11 01:04:43 UTC
(rev 9765)
@@ -91,6 +91,8 @@
public static final boolean DEFAULT_CACHE_LARGE_MESSAGE_CLIENT = false;
public static final int DEFAULT_INITIAL_MESSAGE_PACKET_SIZE = 1500;
+
+ public static final boolean DEFAULT_XA = false;
/**
* Creates a ClientSessionFactory using all the defaults.
Modified: trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java 2010-10-11 01:01:04 UTC (rev
9764)
+++ trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java 2010-10-11 01:04:43 UTC (rev
9765)
@@ -23,6 +23,13 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
+import org.hornetq.jms.client.HornetQJMSConnectionFactory;
+import org.hornetq.jms.client.HornetQQueueConnectionFactory;
+import org.hornetq.jms.client.HornetQTopicConnectionFactory;
+import org.hornetq.jms.client.HornetQXAConnectionFactory;
+import org.hornetq.jms.client.HornetQXAQueueConnectionFactory;
+import org.hornetq.jms.client.HornetQXATopicConnectionFactory;
+import org.hornetq.jms.server.impl.JMSFactoryType;
/**
* A utility class for creating HornetQ client-side JMS managed resources.
@@ -49,9 +56,9 @@
* @param sessionFactory The underlying ClientSessionFactory to use.
* @return The HornetQConnectionFactory.
*/
- public static HornetQConnectionFactory createConnectionFactory(final
ClientSessionFactory sessionFactory)
+ public static HornetQJMSConnectionFactory createConnectionFactory(final
ClientSessionFactory sessionFactory)
{
- return new HornetQConnectionFactory(sessionFactory);
+ return new HornetQJMSConnectionFactory(sessionFactory);
}
/**
@@ -59,11 +66,38 @@
*
* @param discoveryAddress The address to use for discovery.
* @param discoveryPort The port to use for discovery.
+ * @param jmsFactoryType
* @return The HornetQConnectionFactory.
*/
- public static HornetQConnectionFactory createConnectionFactory(final String
discoveryAddress, final int discoveryPort)
+ public static HornetQConnectionFactory createConnectionFactory(final String
discoveryAddress, final int discoveryPort, JMSFactoryType jmsFactoryType)
{
- return new HornetQConnectionFactory(discoveryAddress, discoveryPort);
+ HornetQConnectionFactory factory = null;
+ if (jmsFactoryType.equals(JMSFactoryType.CF))
+ {
+ factory = new HornetQJMSConnectionFactory(discoveryAddress, discoveryPort);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF))
+ {
+ factory = new HornetQQueueConnectionFactory(discoveryAddress, discoveryPort);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF))
+ {
+ factory = new HornetQTopicConnectionFactory(discoveryAddress, discoveryPort);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.XA_CF))
+ {
+ factory = new HornetQXAConnectionFactory(discoveryAddress, discoveryPort);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF))
+ {
+ factory = new HornetQXAQueueConnectionFactory(discoveryAddress, discoveryPort);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF))
+ {
+ factory = new HornetQXATopicConnectionFactory(discoveryAddress, discoveryPort);
+ }
+
+ return factory;
}
/**
@@ -72,22 +106,75 @@
* @param staticConnectors The list of TransportConfiguration to use.
* @return The HornetQConnectionFactory.
*/
- public static HornetQConnectionFactory createConnectionFactory(final
List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors)
+ public static HornetQConnectionFactory createConnectionFactory(final
List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors,
+ final JMSFactoryType
jmsFactoryType)
{
- return new HornetQConnectionFactory(staticConnectors);
+ HornetQConnectionFactory factory = null;
+ if (jmsFactoryType.equals(JMSFactoryType.CF))
+ {
+ factory = new HornetQJMSConnectionFactory(staticConnectors);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF))
+ {
+ factory = new HornetQQueueConnectionFactory(staticConnectors);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF))
+ {
+ factory = new HornetQTopicConnectionFactory(staticConnectors);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.XA_CF))
+ {
+ factory = new HornetQXAConnectionFactory(staticConnectors);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF))
+ {
+ factory = new HornetQXAQueueConnectionFactory(staticConnectors);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF))
+ {
+ factory = new HornetQXATopicConnectionFactory(staticConnectors);
+ }
+
+ return factory;
}
/**
* Creates a HornetQConnectionFactory using a single pair of live-backup
TransportConfiguration.
*
- * @param connectorConfig The TransportConfiguration of the server to connect to.
- * @param backupConnectorConfig The TransportConfiguration of the backup server to
connect to. can be null.
+ * @param connectorConfigs The TransportConfiguration of the server to connect to.
* @return The HornetQConnectionFactory.
*/
public static HornetQConnectionFactory createConnectionFactory(final
TransportConfiguration connectorConfig,
- final TransportConfiguration backupConnectorConfig)
+ final
TransportConfiguration backupConnectorConfig,
+ final JMSFactoryType
jmsFactoryType)
{
- return new HornetQConnectionFactory(connectorConfig, backupConnectorConfig);
+ HornetQConnectionFactory factory = null;
+ if (jmsFactoryType.equals(JMSFactoryType.CF))
+ {
+ factory = new HornetQJMSConnectionFactory(connectorConfig,
backupConnectorConfig);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF))
+ {
+ factory = new HornetQQueueConnectionFactory(connectorConfig,
backupConnectorConfig);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF))
+ {
+ factory = new HornetQTopicConnectionFactory(connectorConfig,
backupConnectorConfig);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.XA_CF))
+ {
+ factory = new HornetQXAConnectionFactory(connectorConfig,
backupConnectorConfig);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF))
+ {
+ factory = new HornetQXAQueueConnectionFactory(connectorConfig,
backupConnectorConfig);
+ }
+ else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF))
+ {
+ factory = new HornetQXATopicConnectionFactory(connectorConfig,
backupConnectorConfig);
+ }
+
+ return factory;
}
/**
@@ -96,11 +183,16 @@
* @param connectorConfig The TransportConfiguration of the server.
* @return The HornetQConnectionFactory.
*/
- public static HornetQConnectionFactory createConnectionFactory(final
TransportConfiguration connectorConfig)
+ public static HornetQJMSConnectionFactory createConnectionFactory(final
TransportConfiguration connectorConfig)
{
- return new HornetQConnectionFactory(connectorConfig);
+ return new HornetQJMSConnectionFactory(connectorConfig);
}
+ public static HornetQXAConnectionFactory createXAConnectionFactory(final
TransportConfiguration connectorConfig)
+ {
+ return new HornetQXAConnectionFactory(connectorConfig);
+ }
+
/**
* Creates a client-side representation of a JMS Topic.
*
Modified: trunk/src/main/org/hornetq/jms/bridge/ConnectionFactoryFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/ConnectionFactoryFactory.java 2010-10-11
01:01:04 UTC (rev 9764)
+++ trunk/src/main/org/hornetq/jms/bridge/ConnectionFactoryFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -13,8 +13,6 @@
package org.hornetq.jms.bridge;
-import javax.jms.ConnectionFactory;
-
/**
* A ConnectionFactoryFactory
*
@@ -26,5 +24,5 @@
*/
public interface ConnectionFactoryFactory
{
- ConnectionFactory createConnectionFactory() throws Exception;
+ Object createConnectionFactory() throws Exception;
}
Modified: trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2010-10-11 01:01:04 UTC
(rev 9764)
+++ trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2010-10-11 01:04:43 UTC
(rev 9765)
@@ -969,7 +969,7 @@
{
Connection conn;
- ConnectionFactory cf = cff.createConnectionFactory();
+ Object cf = cff.createConnectionFactory();
if (qualityOfServiceMode == QualityOfServiceMode.ONCE_AND_ONLY_ONCE && !(cf
instanceof XAConnectionFactory))
{
@@ -992,7 +992,7 @@
{
JMSBridgeImpl.log.trace("Creating a non XA connection");
}
- conn = cf.createConnection();
+ conn = ((ConnectionFactory)cf).createConnection();
}
}
else
@@ -1011,7 +1011,7 @@
{
JMSBridgeImpl.log.trace("Creating a non XA connection");
}
- conn = cf.createConnection(username, password);
+ conn = ((ConnectionFactory)cf).createConnection(username, password);
}
}
Modified: trunk/src/main/org/hornetq/jms/bridge/impl/JNDIConnectionFactoryFactory.java
===================================================================
---
trunk/src/main/org/hornetq/jms/bridge/impl/JNDIConnectionFactoryFactory.java 2010-10-11
01:01:04 UTC (rev 9764)
+++
trunk/src/main/org/hornetq/jms/bridge/impl/JNDIConnectionFactoryFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -15,8 +15,6 @@
import java.util.Hashtable;
-import javax.jms.ConnectionFactory;
-
import org.hornetq.jms.bridge.ConnectionFactoryFactory;
@@ -36,9 +34,9 @@
super(jndiProperties, lookup);
}
- public ConnectionFactory createConnectionFactory() throws Exception
+ public Object createConnectionFactory() throws Exception
{
- return (ConnectionFactory)createObject();
+ return createObject();
}
}
Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2010-10-11
01:01:04 UTC (rev 9764)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -17,18 +17,12 @@
import java.util.List;
import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
import javax.jms.XAQueueConnection;
-import javax.jms.XAQueueConnectionFactory;
import javax.jms.XATopicConnection;
-import javax.jms.XATopicConnectionFactory;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.Referenceable;
@@ -48,8 +42,7 @@
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt> $Id$
*/
-public class HornetQConnectionFactory implements ConnectionFactory,
QueueConnectionFactory, TopicConnectionFactory,
- XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory,
Serializable, Referenceable
+public class HornetQConnectionFactory implements Serializable, Referenceable
{
// Constants
------------------------------------------------------------------------------------
Added: trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
(rev 0)
+++ trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2009 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.client;
+
+import java.util.List;
+
+import javax.jms.ConnectionFactory;
+
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientSessionFactory;
+
+
+/**
+ * A class that represents a ConnectionFactory.
+ *
+ * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
+ */
+public class HornetQJMSConnectionFactory extends HornetQConnectionFactory implements
ConnectionFactory
+{
+
+ private final static long serialVersionUID = -2810634789345348326L;
+
+ public HornetQJMSConnectionFactory(TransportConfiguration transportConfiguration)
+ {
+ super(transportConfiguration);
+ }
+
+ public HornetQJMSConnectionFactory(ClientSessionFactory sessionFactory)
+ {
+ super(sessionFactory);
+ }
+
+ public HornetQJMSConnectionFactory(String discoveryAddress, int discoveryPort)
+ {
+ super(discoveryAddress, discoveryPort);
+ }
+
+ public HornetQJMSConnectionFactory(List<Pair<TransportConfiguration,
TransportConfiguration>> connectorConfigs)
+ {
+ super(connectorConfigs);
+ }
+
+ public HornetQJMSConnectionFactory(TransportConfiguration connectorConfig,
+ TransportConfiguration backupConnectorConfig)
+ {
+ super(connectorConfig, backupConnectorConfig);
+ }
+}
Added: trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java
(rev 0)
+++ trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -0,0 +1,49 @@
+/*
+ * 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.client;
+
+import java.util.List;
+
+import javax.jms.QueueConnectionFactory;
+
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.TransportConfiguration;
+
+
+/**
+ * A class that represents a QueueConnectionFactory.
+ *
+ * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
+ *
+ */
+public class HornetQQueueConnectionFactory extends HornetQConnectionFactory implements
QueueConnectionFactory
+{
+ private static final long serialVersionUID = 5312455021322463546L;
+
+ public HornetQQueueConnectionFactory(String discoveryAddress, int discoveryPort)
+ {
+ super(discoveryAddress, discoveryPort);
+ }
+
+ public HornetQQueueConnectionFactory(List<Pair<TransportConfiguration,
TransportConfiguration>> connectorConfigs)
+ {
+ super(connectorConfigs);
+ }
+
+ public HornetQQueueConnectionFactory(TransportConfiguration connectorConfig,
+ TransportConfiguration backupConnectorConfig)
+ {
+ super(connectorConfig, backupConnectorConfig);
+ }
+}
Added: trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java
(rev 0)
+++ trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -0,0 +1,49 @@
+/*
+ * 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.client;
+
+import java.util.List;
+
+import javax.jms.TopicConnectionFactory;
+
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.TransportConfiguration;
+
+
+/**
+ * A class that represents a TopicConnectionFactory.
+ *
+ * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
+ *
+ */
+public class HornetQTopicConnectionFactory extends HornetQConnectionFactory implements
TopicConnectionFactory
+{
+ private static final long serialVersionUID = 7317051989866548455L;
+
+ public HornetQTopicConnectionFactory(String discoveryAddress, int discoveryPort)
+ {
+ super(discoveryAddress, discoveryPort);
+ }
+
+ public HornetQTopicConnectionFactory(List<Pair<TransportConfiguration,
TransportConfiguration>> connectorConfigs)
+ {
+ super(connectorConfigs);
+ }
+
+ public HornetQTopicConnectionFactory(TransportConfiguration connectorConfig,
+ TransportConfiguration backupConnectorConfig)
+ {
+ super(connectorConfig, backupConnectorConfig);
+ }
+}
Added: trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
(rev 0)
+++ trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -0,0 +1,53 @@
+/*
+ * 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.client;
+
+import java.util.List;
+
+import javax.jms.XAConnectionFactory;
+
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.TransportConfiguration;
+
+
+/**
+ * A class that represents a XAConnectionFactory.
+ *
+ * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
+ */
+public class HornetQXAConnectionFactory extends HornetQConnectionFactory implements
XAConnectionFactory
+{
+ private static final long serialVersionUID = 743611571839154115L;
+
+ public HornetQXAConnectionFactory(String discoveryAddress, int discoveryPort)
+ {
+ super(discoveryAddress, discoveryPort);
+ }
+
+ public HornetQXAConnectionFactory(List<Pair<TransportConfiguration,
TransportConfiguration>> connectorConfigs)
+ {
+ super(connectorConfigs);
+ }
+
+ public HornetQXAConnectionFactory(TransportConfiguration connectorConfig,
+ TransportConfiguration backupConnectorConfig)
+ {
+ super(connectorConfig, backupConnectorConfig);
+ }
+
+ public HornetQXAConnectionFactory(TransportConfiguration connectorConfig)
+ {
+ super(connectorConfig);
+ }
+}
Added: trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java
(rev 0)
+++ trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -0,0 +1,49 @@
+/*
+ * 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.client;
+
+import java.util.List;
+
+import javax.jms.XAQueueConnectionFactory;
+
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.TransportConfiguration;
+
+
+/**
+ * A class that represents a XAQueueConnectionFactory.
+ *
+ * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
+ *
+ */
+public class HornetQXAQueueConnectionFactory extends HornetQConnectionFactory implements
XAQueueConnectionFactory
+{
+ private static final long serialVersionUID = 8612457847251087454L;
+
+ public HornetQXAQueueConnectionFactory(String discoveryAddress, int discoveryPort)
+ {
+ super(discoveryAddress, discoveryPort);
+ }
+
+ public HornetQXAQueueConnectionFactory(List<Pair<TransportConfiguration,
TransportConfiguration>> connectorConfigs)
+ {
+ super(connectorConfigs);
+ }
+
+ public HornetQXAQueueConnectionFactory(TransportConfiguration connectorConfig,
+ TransportConfiguration backupConnectorConfig)
+ {
+ super(connectorConfig, backupConnectorConfig);
+ }
+}
Added: trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java
(rev 0)
+++ trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -0,0 +1,49 @@
+/*
+ * 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.client;
+
+import java.util.List;
+
+import javax.jms.XATopicConnectionFactory;
+
+import org.hornetq.api.core.Pair;
+import org.hornetq.api.core.TransportConfiguration;
+
+
+/**
+ * A class that represents a XATopicConnectionFactory.
+ *
+ * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
+ *
+ */
+public class HornetQXATopicConnectionFactory extends HornetQConnectionFactory implements
XATopicConnectionFactory
+{
+ private static final long serialVersionUID = -7018290426884419693L;
+
+ public HornetQXATopicConnectionFactory(String discoveryAddress, int discoveryPort)
+ {
+ super(discoveryAddress, discoveryPort);
+ }
+
+ public HornetQXATopicConnectionFactory(List<Pair<TransportConfiguration,
TransportConfiguration>> connectorConfigs)
+ {
+ super(connectorConfigs);
+ }
+
+ public HornetQXATopicConnectionFactory(TransportConfiguration connectorConfig,
+ TransportConfiguration backupConnectorConfig)
+ {
+ super(connectorConfig, backupConnectorConfig);
+ }
+}
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-10-11
01:01:04 UTC (rev 9764)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -38,6 +38,7 @@
import org.hornetq.api.jms.management.TopicControl;
import org.hornetq.core.management.impl.MBeanInfoHelper;
import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.impl.JMSFactoryType;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -163,7 +164,7 @@
{
TransportConfiguration liveTC = new
TransportConfiguration(liveTransportClassName, liveTransportParams);
- server.createConnectionFactory(name, liveTC,
JMSServerControlImpl.convert(jndiBindings));
+ server.createConnectionFactory(name, liveTC, JMSFactoryType.CF,
JMSServerControlImpl.convert(jndiBindings));
sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
}
@@ -173,6 +174,121 @@
}
}
+ public void createXAConnectionFactory(final String name,
+ final String liveTransportClassName,
+ final Map<String, Object>
liveTransportParams,
+ final Object[] jndiBindings) throws Exception
+ {
+ checkStarted();
+
+ clearIO();
+
+ try
+ {
+ TransportConfiguration liveTC = new
TransportConfiguration(liveTransportClassName, liveTransportParams);
+
+ server.createConnectionFactory(name, liveTC, JMSFactoryType.XA_CF,
JMSServerControlImpl.convert(jndiBindings));
+
+ sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+ public void createQueueConnectionFactory(final String name,
+ final String liveTransportClassName,
+ final Map<String, Object>
liveTransportParams,
+ final Object[] jndiBindings) throws Exception
+ {
+ checkStarted();
+
+ clearIO();
+
+ try
+ {
+ TransportConfiguration liveTC = new
TransportConfiguration(liveTransportClassName, liveTransportParams);
+
+ server.createConnectionFactory(name, liveTC, JMSFactoryType.QUEUE_CF,
JMSServerControlImpl.convert(jndiBindings));
+
+ sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+ public void createTopicConnectionFactory(final String name,
+ final String liveTransportClassName,
+ final Map<String, Object>
liveTransportParams,
+ final Object[] jndiBindings) throws Exception
+ {
+ checkStarted();
+
+ clearIO();
+
+ try
+ {
+ TransportConfiguration liveTC = new
TransportConfiguration(liveTransportClassName, liveTransportParams);
+
+ server.createConnectionFactory(name, liveTC, JMSFactoryType.TOPIC_CF,
JMSServerControlImpl.convert(jndiBindings));
+
+ sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+ public void createXAQueueConnectionFactory(final String name,
+ final String liveTransportClassName,
+ final Map<String, Object>
liveTransportParams,
+ final Object[] jndiBindings) throws Exception
+ {
+ checkStarted();
+
+ clearIO();
+
+ try
+ {
+ TransportConfiguration liveTC = new
TransportConfiguration(liveTransportClassName, liveTransportParams);
+
+ server.createConnectionFactory(name, liveTC, JMSFactoryType.QUEUE_XA_CF,
JMSServerControlImpl.convert(jndiBindings));
+
+ sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+ public void createXATopicConnectionFactory(final String name,
+ final String liveTransportClassName,
+ final Map<String, Object>
liveTransportParams,
+ final Object[] jndiBindings) throws Exception
+ {
+ checkStarted();
+
+ clearIO();
+
+ try
+ {
+ TransportConfiguration liveTC = new
TransportConfiguration(liveTransportClassName, liveTransportParams);
+
+ server.createConnectionFactory(name, liveTC, JMSFactoryType.TOPIC_XA_CF,
JMSServerControlImpl.convert(jndiBindings));
+
+ sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
public void createConnectionFactory(final String name,
final Object[] liveConnectorsTransportClassNames,
final Object[] liveConnectorTransportParams,
Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-10-11 01:01:04 UTC
(rev 9764)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-10-11 01:04:43 UTC
(rev 9765)
@@ -25,6 +25,7 @@
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.impl.JMSFactoryType;
import org.hornetq.spi.core.naming.BindingRegistry;
/**
@@ -170,7 +171,7 @@
TransportConfiguration backupTC,
String ... bindings) throws Exception;
- void createConnectionFactory(String name, TransportConfiguration liveTC, String ...
bindings) throws Exception;
+ void createConnectionFactory(String name, TransportConfiguration liveTC,
JMSFactoryType cfType, String ... bindings) throws Exception;
void createConnectionFactory(String name,
String clientID,
@@ -222,6 +223,7 @@
boolean failoverOnInitialConnection,
boolean failoverOnServerShutdown,
String groupId,
+ JMSFactoryType factoryType,
String ... bindings) throws Exception;
void createConnectionFactory(String name,
Modified:
trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
===================================================================
---
trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-10-11
01:01:04 UTC (rev 9764)
+++
trunk/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -19,6 +19,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.impl.JMSFactoryType;
/**
* A ConnectionFactoryConfiguration
@@ -202,4 +203,8 @@
String getGroupID();
void setGroupID(String groupID);
+
+ void setFactoryType(JMSFactoryType factType);
+
+ JMSFactoryType getFactoryType();
}
Modified:
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
---
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-10-11
01:01:04 UTC (rev 9764)
+++
trunk/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -21,6 +21,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.impl.JMSFactoryType;
import org.hornetq.utils.BufferHelper;
import org.hornetq.utils.DataConstants;
@@ -115,6 +116,8 @@
private String groupID = null;
+ private JMSFactoryType factoryType = JMSFactoryType.CF;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -671,6 +674,8 @@
failoverOnServerShutdown = buffer.readBoolean();
groupID = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+ factoryType = JMSFactoryType.valueOf(buffer.readInt());
}
/* (non-Javadoc)
@@ -762,6 +767,8 @@
buffer.writeBoolean(failoverOnServerShutdown);
BufferHelper.writeAsNullableSimpleString(buffer, groupID);
+
+ buffer.writeInt(factoryType.intValue());
}
@@ -860,8 +867,20 @@
DataConstants.SIZE_BOOLEAN + // failoverOnServerShutdown
- BufferHelper.sizeOfNullableSimpleString(groupID);
+ BufferHelper.sizeOfNullableSimpleString(groupID) +
+
+ DataConstants.SIZE_INT; //factoryType
}
+
+ public void setFactoryType(JMSFactoryType factoryType)
+ {
+ this.factoryType = factoryType;
+ }
+
+ public JMSFactoryType getFactoryType()
+ {
+ return factoryType;
+ }
// Public --------------------------------------------------------
Added: trunk/src/main/org/hornetq/jms/server/impl/JMSFactoryType.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSFactoryType.java
(rev 0)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSFactoryType.java 2010-10-11 01:04:43 UTC
(rev 9765)
@@ -0,0 +1,83 @@
+/*
+ * 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;
+
+/**
+ * A JMSFactoryType
+ *
+ * @author howard
+ *
+ *
+ */
+public enum JMSFactoryType
+{
+ CF, QUEUE_CF, TOPIC_CF, XA_CF, QUEUE_XA_CF, TOPIC_XA_CF;
+
+ public int intValue()
+ {
+ int val = 0;
+ switch (this)
+ {
+ case CF:
+ val = 0;
+ break;
+ case QUEUE_CF:
+ val = 1;
+ break;
+ case TOPIC_CF:
+ val = 2;
+ break;
+ case XA_CF:
+ val = 3;
+ break;
+ case QUEUE_XA_CF:
+ val = 4;
+ break;
+ case TOPIC_XA_CF:
+ val = 5;
+ break;
+ }
+ return val;
+ }
+
+ public static JMSFactoryType valueOf(int val)
+ {
+ JMSFactoryType type;
+ switch (val)
+ {
+ case 0:
+ type = CF;
+ break;
+ case 1:
+ type = QUEUE_CF;
+ break;
+ case 2:
+ type = TOPIC_CF;
+ break;
+ case 3:
+ type = XA_CF;
+ break;
+ case 4:
+ type = QUEUE_XA_CF;
+ break;
+ case 5:
+ type = TOPIC_XA_CF;
+ break;
+ default:
+ type = XA_CF;
+ break;
+ }
+ return type;
+ }
+}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-10-11
01:01:04 UTC (rev 9764)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -205,7 +205,14 @@
Element e = (Element)node;
String name =
node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
+
+ String fact = e.getAttribute("signature");
+ boolean isXA = XMLConfigurationUtil.getBoolean(e,
+ "xa",
+ HornetQClient.DEFAULT_XA);
+ JMSFactoryType factType = resolveFactoryType(fact, isXA);
+
long clientFailureCheckPeriod = XMLConfigurationUtil.getLong(e,
"client-failure-check-period",
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
@@ -381,6 +388,7 @@
cfConfig.setConnectorNames(connectorNames);
}
+ cfConfig.setFactoryType(factType);
cfConfig.setClientID(clientID);
cfConfig.setClientFailureCheckPeriod(clientFailureCheckPeriod);
cfConfig.setConnectionTTL(connectionTTL);
@@ -413,6 +421,46 @@
return cfConfig;
}
+ private JMSFactoryType resolveFactoryType(String fact, boolean isXA) throws
HornetQException
+ {
+ if ("".equals(fact))
+ {
+ fact = "generic";
+ }
+ if (isXA)
+ {
+ if ("generic".equals(fact))
+ {
+ return JMSFactoryType.XA_CF;
+ }
+ if ("queue".equals(fact))
+ {
+ return JMSFactoryType.QUEUE_XA_CF;
+ }
+ if ("topic".equals(fact))
+ {
+ return JMSFactoryType.TOPIC_XA_CF;
+ }
+ }
+ else
+ {
+ if ("generic".equals(fact))
+ {
+ return JMSFactoryType.CF;
+ }
+ if ("queue".equals(fact))
+ {
+ return JMSFactoryType.QUEUE_CF;
+ }
+ if ("topic".equals(fact))
+ {
+ return JMSFactoryType.TOPIC_CF;
+ }
+ }
+ throw new HornetQException(HornetQException.INTERNAL_ERROR, "Invalid signature
" + fact +
+ " at parseConnectionFactory");
+ }
+
/**
* hook for integration layers
* @param topicName
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-10-11
01:01:04 UTC (rev 9764)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-10-11
01:04:43 UTC (rev 9765)
@@ -23,7 +23,6 @@
import javax.naming.Context;
import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import org.hornetq.api.core.HornetQException;
@@ -754,6 +753,7 @@
final boolean
failoverOnInitialConnection,
final boolean
failoverOnServerShutdown,
final String groupId,
+ final JMSFactoryType factoryType,
String... jndiBindings) throws
Exception
{
checkInitialised();
@@ -790,6 +790,7 @@
configuration.setFailoverOnInitialConnection(failoverOnInitialConnection);
configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
configuration.setGroupID(groupId);
+ configuration.setFactoryType(factoryType);
createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -969,13 +970,14 @@
final int
reconnectAttempts,
final boolean
failoverOnInitialConnection,
final boolean
failoverOnServerShutdown,
- final String groupId)
throws Exception
+ final String groupId,
+ final JMSFactoryType
jmsFactoryType) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf =
(HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress,
discoveryPort);
+ cf =
(HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress,
discoveryPort, jmsFactoryType);
cf.setClientID(clientID);
cf.setLocalBindAddress(localBindAddress);
cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
@@ -1043,13 +1045,14 @@
final int
reconnectAttempts,
final boolean
failoverOnInitialConnection,
final boolean
failoverOnServerShutdown,
- final String groupId)
throws Exception
+ final String groupId,
+ final JMSFactoryType
jmsFactoryType) throws Exception
{
checkInitialised();
HornetQConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf =
(HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
+ cf =
(HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs,
jmsFactoryType);
cf.setClientID(clientID);
cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
cf.setConnectionTTL(connectionTTL);
@@ -1213,7 +1216,8 @@
cfConfig.getReconnectAttempts(),
cfConfig.isFailoverOnInitialConnection(),
cfConfig.isFailoverOnServerShutdown(),
- cfConfig.getGroupID());
+ cfConfig.getGroupID(),
+ cfConfig.getFactoryType());
}
else
{
@@ -1247,7 +1251,8 @@
cfConfig.getReconnectAttempts(),
cfConfig.isFailoverOnInitialConnection(),
cfConfig.isFailoverOnServerShutdown(),
- cfConfig.getGroupID());
+ cfConfig.getGroupID(),
+ cfConfig.getFactoryType());
}
connectionFactories.put(cfConfig.getName(), cf);
@@ -1258,6 +1263,7 @@
public synchronized void createConnectionFactory(final String name,
final TransportConfiguration liveTC,
+ final JMSFactoryType cfType,
final String... jndiBindings) throws
Exception
{
checkInitialised();
@@ -1265,6 +1271,7 @@
if (cf == null)
{
ConnectionFactoryConfiguration configuration = new
ConnectionFactoryConfigurationImpl(name, liveTC);
+ configuration.setFactoryType(cfType);
createConnectionFactory(true, configuration, jndiBindings);
}
}
Modified: trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2010-10-11 01:01:04 UTC (rev
9764)
+++ trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2010-10-11 01:04:43 UTC (rev
9765)
@@ -35,6 +35,7 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.jms.client.HornetQConnectionFactory;
+import org.hornetq.jms.server.impl.JMSFactoryType;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.core.logging.Logger;
import org.hornetq.ra.inflow.HornetQActivation;
@@ -1389,13 +1390,13 @@
: new
TransportConfiguration(backUpCOnnectorClassname,
backupConnectionParams);
- cf = HornetQJMSClient.createConnectionFactory(transportConf, backup);
+ cf = HornetQJMSClient.createConnectionFactory(transportConf, backup,
JMSFactoryType.XA_CF);
}
else if (discoveryAddress != null)
{
Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ?
overrideProperties.getDiscoveryPort()
:
getDiscoveryPort();
- cf = HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
+ cf = HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort,
JMSFactoryType.XA_CF);
}
else
{