[jboss-svn-commits] JBL Code SVN: r10779 - in labs/jbossesb/trunk: product/core/listeners/src/org/jboss/soa/esb/listeners and 28 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Apr 4 22:15:55 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-04-04 22:15:55 -0400 (Wed, 04 Apr 2007)
New Revision: 10779
Added:
labs/jbossesb/trunk/product/lib/ext/jms/oracleaq/
labs/jbossesb/trunk/product/lib/ext/jms/oracleaq/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/README.txt
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/juddi.properties
labs/jbossesb/trunk/qa/jmeter/JBossMQ-HelloWorld-Action-Oracle.jmx
Removed:
labs/jbossesb/trunk/product/lib/ext/jms/jbossmessaging/jboss-messaging-client.jar
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/listener.log
Modified:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/MessageDeliverException.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/NamingContext.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/AppServerContextUnitTest.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/persistence/manager/J2eeConnectionManager.java
labs/jbossesb/trunk/product/install/deployment.properties-example
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/SendJMSMessage.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/DrainQueuesAndTopics.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/rosetta/pooling/JmsConnectionPoolingTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java
Log:
Adding support for Oracle AQ. Adding caching for jndi lookups.
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -24,6 +24,7 @@
import java.io.Serializable;
import java.util.List;
+import java.util.Properties;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
@@ -31,16 +32,18 @@
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.NamingException;
import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.rosetta.pooling.ConnectionException;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPoolContainer;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
@@ -211,30 +214,30 @@
Queue jmsQueue;
MessageProducer jmsProducer;
String queueName;
+ JmsConnectionPool pool;
// TODO: Modify to support topic destinations too
- private JMSSendQueueSetup(String queueName) throws NamingException, JMSException {
- Context oCtx = NamingContext.getServerContext(
- Configuration.getJndiServerURL(),
- Configuration.getJndiServerContextFactory(),
- Configuration.getJndiServerPkgPrefix());
- QueueConnectionFactory qcf = (QueueConnectionFactory) oCtx.lookup("ConnectionFactory");
- QueueConnection oQconn = qcf.createQueueConnection();
-
+ private JMSSendQueueSetup(String queueName) throws NamingException, JMSException, ConnectionException {
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, Configuration.getJndiServerURL());
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, Configuration.getJndiServerContextFactory());
+ environment.setProperty(Context.URL_PKG_PREFIXES, Configuration.getJndiServerPkgPrefix());
+ Context oCtx = NamingContext.getServerContext(environment);
+ pool = JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory", JMSEpr.QUEUE_TYPE);
+
this.queueName = queueName;
- jmsSession = oQconn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+
try {
+ jmsSession = pool.getQueueSession();
jmsQueue = (Queue) oCtx.lookup(queueName);
} catch (NamingException ne) {
- jmsQueue = jmsSession.createQueue(queueName);
- } finally {
- if (oCtx!=null) {
- try {
- oCtx.close();
- } catch (NamingException ne) {
- logger.error(ne.getMessage(), ne);
- }
+ try {
+ oCtx = NamingContext.getFreshServerContext(environment);
+ jmsQueue = (Queue) oCtx.lookup(queueName);
+ } catch (NamingException nex) {
+ //ActiveMQ
+ jmsQueue = jmsSession.createQueue(queueName);
}
}
jmsProducer = jmsSession.createSender(jmsQueue);
@@ -242,8 +245,8 @@
private void close() {
try {
- jmsProducer.close();
- jmsSession.close();
+ if (jmsProducer!=null) jmsProducer.close();
+ pool.closeSession(jmsSession);
} catch (Exception e) {
logger.error("Unable to close JMS Queue Setup.", e);
}
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerUtil.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -27,7 +27,11 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collection;
+import java.util.Properties;
+import java.util.Set;
+import javax.naming.Context;
+
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.EPR;
@@ -120,14 +124,22 @@
{
String name = tree.getRequiredAttribute(JMSEpr.DESTINATION_NAME_TAG);
-
+ Set<String> names=tree.getAttributeNames();
+ Properties environment = new Properties();
+ for (String attributeName : names) {
+ if (attributeName.startsWith("java.naming.")) {
+ environment.setProperty(attributeName, tree.getAttribute(attributeName));
+ }
+ }
String type = getAttrAndWarn(tree, JMSEpr.DESTINATION_TYPE_TAG,
"queue");
- String jndiURL = getAttrAndWarn(tree, JMSEpr.JNDI_URL_TAG,"");
- String jndiContextFactory = getAttrAndWarn(tree,
- JMSEpr.JNDI_CONTEXT_FACTORY_TAG,"");
- String jndiPkgPrefix = getAttrAndWarn(tree,
- JMSEpr.JNDI_PKG_PREFIX_TAG,"");
+ String jndiURL = tree.getAttribute(JMSEpr.JNDI_URL_TAG);
+ if (jndiURL!=null) environment.setProperty(Context.PROVIDER_URL, jndiURL);
+ String jndiContextFactory = tree.getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG);
+ if (jndiContextFactory!=null) environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, jndiContextFactory);
+ String jndiPkgPrefix = tree.getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG);
+ if (jndiContextFactory!=null) environment.setProperty(Context.URL_PKG_PREFIXES, jndiPkgPrefix);
+
String jmsFactoryClass = getAttrAndWarn(tree,
JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
@@ -138,8 +150,7 @@
+ " - All messages in queue <" + name
+ "> will be picked up by listener");
- JMSEpr epr = new JMSEpr(type, name, jmsFactoryClass, jndiURL,
- jndiContextFactory, jndiPkgPrefix, selector);
+ JMSEpr epr = new JMSEpr(type, name, jmsFactoryClass, environment, selector);
return epr;
}
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -29,20 +29,23 @@
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Set;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.NamingException;
import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.rosetta.pooling.ConnectionException;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
+import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPoolContainer;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
@@ -114,6 +117,14 @@
{
prepareMessageReceiver();
}
+ catch (final ConnectionException ce)
+ {
+ if (_serviceName != null)
+ {
+ RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr);
+ }
+ throw new ManagedLifecycleException("Unexpected JMS error from prepareMessageReceiver", ce);
+ }
catch (final JMSException jmse)
{
if (_serviceName != null)
@@ -230,22 +241,9 @@
if (_queueSession != null)
{
- try
- {
- _queueSession.close();
- }
- catch (final JMSException jmse) {} // ignore
+ _pool.closeSession(_queueSession);
}
- if (_queueConnection != null)
- {
- try
- {
- _queueConnection.close();
- }
- catch (final JMSException jmse) {} // ignore
- }
-
if (_serviceName != null)
{
RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr) ;
@@ -313,72 +311,56 @@
}
} // ________________________________
- private void prepareMessageReceiver () throws ConfigurationException, JMSException
+ private void prepareMessageReceiver () throws ConfigurationException, JMSException, ConnectionException
{
- _queueConnection = null;
_queueSession = null;
_queue = null;
- String sJndiURL = ListenerUtil.obtainAtt(_config, JMSEpr.JNDI_URL_TAG,
- NamingContext.JBOSS_PROVIDER_URL);
- if (null == _config.getAttribute(JMSEpr.JNDI_URL_TAG))
- _logger
- .debug("No value specified for " + JMSEpr.JNDI_URL_TAG + " attribute" + " - Using default of: '" + sJndiURL + "'");
- String sJndiContextFactory = ListenerUtil.obtainAtt(_config,
- JMSEpr.JNDI_CONTEXT_FACTORY_TAG,
- NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
- if (null == _config.getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG))
- _logger
- .debug("No value specified for " + JMSEpr.JNDI_CONTEXT_FACTORY_TAG + " attribute" + " - Using default of: '" + sJndiContextFactory + "'");
- String sJndiPkgPrefix = ListenerUtil.obtainAtt(_config,
- JMSEpr.JNDI_PKG_PREFIX_TAG, NamingContext.JBOSS_PROVIDER_URL);
- if (null == _config.getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG))
- _logger
- .debug("No value specified for " + JMSEpr.JNDI_PKG_PREFIX_TAG + " attribute" + " - Using default of: '" + sJndiPkgPrefix + "'");
- Context oJndiCtx = NamingContext.getServerContext(sJndiURL,
- sJndiContextFactory, sJndiPkgPrefix);
- if (null == oJndiCtx)
- throw new ConfigurationException(
- "Unable fo obtain jndi context <" + sJndiURL + "," + sJndiContextFactory + "," + sJndiPkgPrefix + ">");
+ Properties environment = new Properties();
+
+ String sJndiURL = _config.getAttribute(JMSEpr.JNDI_URL_TAG);
+ String sJndiContextFactory = _config.getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG);
+ String sJndiPkgPrefix = _config.getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG);
+ if (sJndiURL!=null) environment.setProperty(Context.PROVIDER_URL, sJndiURL);
+ if (sJndiContextFactory!=null) environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, sJndiContextFactory);
+ if (sJndiPkgPrefix!=null) environment.setProperty(Context.URL_PKG_PREFIXES, sJndiPkgPrefix);
+ Set<String> names=_config.getAttributeNames();
+ for (String name : names) {
+ if (name.startsWith("java.naming.")) {
+ environment.setProperty(name, _config.getAttribute(name));
+ }
+ }
+ Context oJndiCtx = NamingContext.getServerContext(environment);
+
+ if (null == oJndiCtx)
+ throw new ConfigurationException(
+ "Unable fo obtain jndi context <" + sJndiURL + "," + sJndiContextFactory + "," + sJndiPkgPrefix + ">");
- String sFactClass = ListenerUtil.obtainAtt(_config,
- JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
- if (null == _config.getAttribute(JMSEpr.CONNECTION_FACTORY_TAG))
- _logger
- .debug("No value specified for " + JMSEpr.CONNECTION_FACTORY_TAG + " attribute" + " - Using default of: '" + sFactClass + "'");
- _serviceCategory = _config
- .getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
- _serviceName = _config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
- _myEpr = (null == _serviceName) ? null : new JMSEpr(JMSEpr.QUEUE_TYPE,
- _queueName, sFactClass, sJndiURL, sJndiContextFactory,
- sJndiPkgPrefix, _messageSelector);
-
- Object tmp = null;
-
- try
- {
- tmp = oJndiCtx.lookup(sFactClass);
- }
- catch (NamingException ex)
- {
- throw new ConfigurationException(ex);
- }
-
- QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ String sFactClass = ListenerUtil.obtainAtt(_config,
+ JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
+ if (null == _config.getAttribute(JMSEpr.CONNECTION_FACTORY_TAG))
+ _logger
+ .debug("No value specified for " + JMSEpr.CONNECTION_FACTORY_TAG + " attribute" + " - Using default of: '" + sFactClass + "'");
+ _serviceCategory = _config
+ .getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
+ _serviceName = _config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
+ _myEpr = (null == _serviceName) ? null : new JMSEpr(JMSEpr.QUEUE_TYPE,
+ _queueName, sFactClass, environment, _messageSelector);
+
+ _pool = JmsConnectionPoolContainer.getPool(environment, sFactClass, JMSEpr.QUEUE_TYPE);
+
+ try {
+ _queueSession = _pool.getQueueSession();
+ _queue = (Queue) oJndiCtx.lookup(_queueName);
+ } catch (NamingException nex) {
+ try {
+ oJndiCtx = NamingContext.getServerContext(environment);
+ _queue = (Queue) oJndiCtx.lookup(_queueName);
+ } catch (NamingException ne) {
+ _queue = _queueSession.createQueue(_queueName);
+ }
+ }
- _queueConnection = qcf.createQueueConnection();
- _queueSession = _queueConnection.createQueueSession(false,
- QueueSession.AUTO_ACKNOWLEDGE);
- try
- {
- _queue = (Queue) oJndiCtx.lookup(_queueName);
- }
- catch (NamingException ne)
- {
- _queue = _queueSession.createQueue(_queueName);
- }
- _queueConnection.start();
-
_messageReceiver = _queueSession.createReceiver(_queue,
_messageSelector);
if (null != oJndiCtx) try
@@ -490,8 +472,6 @@
protected String _queueName;
- protected QueueConnection _queueConnection;
-
protected QueueSession _queueSession;
protected Queue _queue;
@@ -521,4 +501,6 @@
protected Method _processMethod;
protected Courier _courier;
+
+ protected JmsConnectionPool _pool;
}
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -27,6 +27,7 @@
import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPoolContainer;
import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.helpers.NamingContext;
import org.jboss.soa.esb.lifecycle.LifecycleIdentity;
/**
@@ -135,6 +136,7 @@
{
throw new ManagedLifecycleException("Unexpected exception clearing JMS pools", jmse) ;
}
+ NamingContext.closeAllContexts();
}
finally
{
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/MessageDeliverException.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/MessageDeliverException.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/MessageDeliverException.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -27,6 +27,8 @@
*/
public class MessageDeliverException extends BaseException {
+ private static final long serialVersionUID = 1L;
+
public MessageDeliverException(String message) {
super(message);
}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -43,8 +43,6 @@
import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
import org.jboss.soa.esb.util.AbstractCommandVehicle;
-import junit.framework.TestCase;
-
class CommandVehicle extends AbstractCommandVehicle
{
private static final long serialVersionUID = 1L;
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/command/JmsCommandQueue.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -2,6 +2,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
import javax.jms.Connection;
import javax.jms.JMSException;
@@ -127,19 +128,22 @@
if (!Util.isNullString(sJndiName))
{
+ Properties environment = new Properties();
Map<String, Object> oNewAtts = new HashMap<String, Object>();
oNewAtts.put(COMMAND_JNDI_NAME, sJndiName);
-
+
String sJndiURL = obtainAtt(p_oP, COMMAND_JNDI_URL,"");
+ environment.put(Context.PROVIDER_URL, sJndiURL);
oNewAtts.put(COMMAND_JNDI_URL, sJndiURL);
String sJndiContextFactory = obtainAtt(p_oP,
COMMAND_JNDI_CONTEXT_FACTORY,"");
+ environment.put(Context.OBJECT_FACTORIES, sJndiContextFactory);
oNewAtts.put(COMMAND_JNDI_CONTEXT_FACTORY, sJndiContextFactory);
String sJndiPkgPrefix = obtainAtt(p_oP, COMMAND_JNDI_PKG_PREFIX,"");
+ environment.put(Context.URL_PKG_PREFIXES, sJndiPkgPrefix);
oNewAtts.put(COMMAND_JNDI_PKG_PREFIX, sJndiPkgPrefix);
- Context oJndiCtx = NamingContext.getServerContext(sJndiURL,
- sJndiContextFactory, sJndiPkgPrefix);
+ Context oJndiCtx = NamingContext.getServerContext(environment);
String sFactClass = obtainAtt(p_oP, COMMAND_CONN_FACTORY,
"ConnectionFactory");
@@ -151,11 +155,14 @@
try
{
oFactCls = oJndiCtx.lookup(sFactClass);
+ } catch (NamingException ne) {
+ oJndiCtx = NamingContext.getFreshServerContext(environment);
+ try {
+ oFactCls = oJndiCtx.lookup(sFactClass);
+ } catch (NamingException ex) {
+ throw new ConfigurationException(ex);
+ }
}
- catch (NamingException ex)
- {
- throw new ConfigurationException(ex);
- }
String sMsgSelector = p_oP.getAttribute(COMMAND_MSG_SELECTOR);
if (null != sMsgSelector)
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -26,6 +26,7 @@
import java.io.Serializable;
import java.net.URISyntaxException;
import java.util.List;
+import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
@@ -177,12 +178,15 @@
*
* @param jmsMessage
*/
- private void sendMessage (javax.jms.Message jmsMessage) throws JMSException
+ private void sendMessage (javax.jms.Message jmsMessage) throws JMSException, URISyntaxException
{
- if (_messageProducer instanceof TopicPublisher) ((TopicPublisher) _messageProducer)
- .publish(jmsMessage);
- else
- _messageProducer.send(jmsMessage);
+ String sType = _epr.getDestinationType();
+ if (JMSEpr.TOPIC_TYPE.equals(sType)) {
+ ((TopicPublisher) _messageProducer).publish(jmsMessage);
+ } else {
+ _messageProducer.send(jmsMessage);
+ }
+
} // ________________________________
private void jmsConnectRetry (Exception exc)
@@ -223,18 +227,14 @@
Context oJndiCtx = null;
try
{
- String sJndiContextFactory = _epr.getJndiContextFactory();
- String sJndiURL = _epr.getJndiURL();
- String sJndiPkgPrefix = _epr.getJndiPkgPrefix();
- oJndiCtx = NamingContext.getServerContext(sJndiURL,
- sJndiContextFactory, sJndiPkgPrefix);
+ oJndiCtx = NamingContext.getServerContext(_epr.getJndiEnvironment());
String sFactoryClass = _epr.getConnectionFactory();
if (Util.isNullString(sFactoryClass))
sFactoryClass = "ConnectionFactory";
String sType = _epr.getDestinationType();
- _pool = JmsConnectionPoolContainer.getPool(sJndiURL, sJndiContextFactory, sJndiPkgPrefix, sFactoryClass, sType);
+ _pool = JmsConnectionPoolContainer.getPool(_epr.getJndiEnvironment(), sFactoryClass, sType);
if (JMSEpr.QUEUE_TYPE.equals(sType)) {
QueueSession qSess = _pool.getQueueSession();
@@ -244,7 +244,14 @@
queue = (javax.jms.Queue) oJndiCtx.lookup(_epr
.getDestinationName());
} catch (NamingException ne) {
- queue = qSess.createQueue(_epr.getDestinationName());
+ try {
+ oJndiCtx = NamingContext.getFreshServerContext(_epr.getJndiEnvironment());
+ queue = (javax.jms.Queue) oJndiCtx.lookup(_epr
+ .getDestinationName());
+ } catch (NamingException nex) {
+ //ActiveMQ
+ queue = qSess.createQueue(_epr.getDestinationName());
+ }
}
_messageProducer = qSess.createSender(queue);
} else if (JMSEpr.TOPIC_TYPE.equals(sType)) {
@@ -285,17 +292,6 @@
{
throw new MalformedEPRException(ex);
}
- finally {
- if (oJndiCtx!=null) {
- try {
- oJndiCtx.close();
- } catch (NamingException ne) {
- _logger.error(ne.getMessage(), ne);
- }
- }
-
- }
-
} // ________________________________
public Message pickup (long millis) throws CourierException
@@ -384,21 +380,18 @@
Context oJndiCtx = null;
try
{
- String sJndiConnectionFactory = _epr.getJndiContextFactory();
- String sJndiURL = _epr.getJndiURL();
- String sJndiPkgPrefix = _epr.getJndiPkgPrefix();
- oJndiCtx = NamingContext.getServerContext(sJndiURL,
- sJndiConnectionFactory, sJndiPkgPrefix);
+ Properties environment = _epr.getJndiEnvironment();
+ oJndiCtx = NamingContext.getServerContext(environment);
if (null == oJndiCtx)
throw new ConfigurationException(
- "Unable fo obtain jndi context <" + sJndiURL + "," + sJndiConnectionFactory + "," + sJndiPkgPrefix + ">");
+ "Unable fo obtain jndi context");
String sFactoryClass = _epr.getConnectionFactory();
if (Util.isNullString(sFactoryClass))
sFactoryClass = "ConnectionFactory";
String sType = _epr.getDestinationType();
- _pool = JmsConnectionPoolContainer.getPool(sJndiURL, sJndiConnectionFactory, sJndiPkgPrefix, sFactoryClass, sType);
+ _pool = JmsConnectionPoolContainer.getPool(environment, sFactoryClass, sType);
if (JMSEpr.QUEUE_TYPE.equals(sType)) {
QueueSession qSess = _pool.getQueueSession();
@@ -408,7 +401,14 @@
queue = (javax.jms.Queue) oJndiCtx.lookup(_epr
.getDestinationName());
} catch (NamingException ne) {
- queue = qSess.createQueue(_epr.getDestinationName());
+ try {
+ oJndiCtx = NamingContext.getFreshServerContext(environment);
+ queue = (javax.jms.Queue) oJndiCtx.lookup(_epr
+ .getDestinationName());
+ } catch (NamingException nex) {
+ //ActiveMQ
+ queue = qSess.createQueue(_epr.getDestinationName());
+ }
}
_messageConsumer = qSess.createReceiver(queue, _epr
.getMessageSelector());
@@ -440,17 +440,6 @@
{
throw new MalformedEPRException(ex);
}
- finally {
- if (oJndiCtx!=null) {
- try {
- oJndiCtx.close();
- } catch (NamingException ne) {
- _logger.error(ne.getMessage(), ne);
- }
- }
-
- }
-
} // ________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPool.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -63,6 +63,8 @@
private Map<String, String> poolKey;
/** Logger */
private Logger logger = Logger.getLogger(this.getClass());
+ /** Context, which is cached until we encounter a naming exception, or the pool is rebuild */
+ private Context jndiContext;
/**
* Contructor of the pool.
*
@@ -89,10 +91,16 @@
if (jmsConnection==null) {
JmsConnectionPoolContainer.addToPool(poolKey, this);
logger.debug("Creating a JMS Connection for ");
- Context jndiContext = NamingContext.getServerContext(poolKey.get(JMSEpr.JNDI_URL_TAG)
- , poolKey.get(JMSEpr.JNDI_CONTEXT_FACTORY_TAG), poolKey.get(JMSEpr.JNDI_PKG_PREFIX_TAG));
+ jndiContext = NamingContext.getServerContext(JmsConnectionPoolContainer.getJndiEnvironment(poolKey));
String connectionFactoryString = poolKey.get(JMSEpr.CONNECTION_FACTORY_TAG);
- Object factoryConnection = jndiContext.lookup(connectionFactoryString);
+ Object factoryConnection=null;
+ try {
+ factoryConnection = jndiContext.lookup(connectionFactoryString);
+ } catch (NamingException ne) {
+ logger.info("Received NamingException, refreshing context.");
+ jndiContext = NamingContext.getFreshServerContext(JmsConnectionPoolContainer.getJndiEnvironment(poolKey));
+ factoryConnection = jndiContext.lookup(connectionFactoryString);
+ }
if (JMSEpr.QUEUE_TYPE.equals(destinationType)) {
QueueConnectionFactory factory = (QueueConnectionFactory) factoryConnection;
jmsConnection = factory.createQueueConnection();
@@ -101,7 +109,6 @@
jmsConnection = factory.createTopicConnection();
}
jmsConnection.start();
- jndiContext.close(); //TODO Make sure this is ok for MQSeries.
}
//Create a new Session
if (JMSEpr.QUEUE_TYPE.equals(destinationType)) {
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/rosetta/pooling/JmsConnectionPoolContainer.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -24,6 +24,7 @@
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import javax.jms.JMSException;
@@ -54,7 +55,7 @@
*/
public static JmsConnectionPool getPool(JMSEpr jmsEpr) throws ConnectionException, URISyntaxException
{
- return getPool(jmsEpr.getJndiURL(), jmsEpr.getJndiContextFactory(), jmsEpr.getJndiPkgPrefix()
+ return getPool(jmsEpr.getJndiEnvironment()
, jmsEpr.getConnectionFactory(), jmsEpr.getDestinationType());
}
/**
@@ -64,11 +65,9 @@
* @return
* @throws ConnectionException
*/
- public static JmsConnectionPool getPool(String jndiURL, String jndiContextFactory,
- String jndiPkgPrefix, String connectionFactory, String destinationType)
+ public static JmsConnectionPool getPool(Properties enviroment, String connectionFactory, String destinationType)
{
- Map<String,String> poolKey = createPoolKey(jndiURL, jndiContextFactory,
- jndiPkgPrefix, connectionFactory, destinationType);
+ Map<String,String> poolKey = createPoolKey(enviroment, connectionFactory, destinationType);
if (poolMap.containsKey(poolKey)) {
return poolMap.get(poolKey);
} else {
@@ -80,26 +79,39 @@
/**
* Creates a poolKey using the identifying parameters
*
- * @param jndiURL
- * @param jndiContextFactory
- * @param jndiPkgPrefix
+ * @param environment - the JNDI environment parameters
* @param connectionFactory
* @param destinationType
* @param destinationName
* @return
*/
- public static Map<String, String> createPoolKey(String jndiURL, String jndiContextFactory,
- String jndiPkgPrefix, String connectionFactory, String destinationType)
+ public static Map<String, String> createPoolKey(Properties environment, String connectionFactory, String destinationType)
{
Map<String,String> poolKey = new HashMap<String,String>();
- if (jndiURL!=null) poolKey.put(JMSEpr.JNDI_URL_TAG, jndiURL);
- if (jndiContextFactory!=null) poolKey.put(JMSEpr.JNDI_CONTEXT_FACTORY_TAG, jndiContextFactory);
- if (jndiPkgPrefix!=null) poolKey.put(JMSEpr.JNDI_PKG_PREFIX_TAG, jndiPkgPrefix);
+ if (environment!=null) {
+ for (Object key : environment.keySet()) {
+ poolKey.put(key.toString(), environment.getProperty(key.toString()));
+ }
+ }
if (connectionFactory!=null) poolKey.put(JMSEpr.CONNECTION_FACTORY_TAG, connectionFactory);
if (destinationType!=null) poolKey.put(JMSEpr.DESTINATION_TYPE_TAG, destinationType);
return poolKey;
}
/**
+ * Returns the JNDI environment in the key.
+ * @param poolKey
+ * @return
+ */
+ public static Properties getJndiEnvironment(Map<String,String> poolKey) {
+ Properties environment = new Properties();
+ for (String key: poolKey.keySet()) {
+ if (key.startsWith("java.naming.")) {
+ environment.setProperty(key, poolKey.get(key));
+ }
+ }
+ return environment;
+ }
+ /**
* Gets the number of pools in the constainer.
*
*/
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -137,7 +137,7 @@
return extensionValue;
}
- public Iterator getExtensions()
+ public Iterator<Extension> getExtensions()
{
return _extensions.iterator();
}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -27,10 +27,15 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Iterator;
+import java.util.Properties;
+import javax.naming.Context;
+
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.PortReference;
import org.jboss.soa.esb.addressing.XMLUtil;
+import org.jboss.soa.esb.addressing.PortReference.Extension;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -92,37 +97,22 @@
{
if (tag != null)
{
- if (tag.equals(SPECIFICATION_VERSION_TAG))
+ if (tag.startsWith("java.naming.")) {
+ getAddr().addExtension(tag, nl.item(i).getTextContent());
+ } else if (tag.equals(SPECIFICATION_VERSION_TAG)) {
getAddr().addExtension(SPECIFICATION_VERSION_TAG, nl.item(i).getTextContent());
- else
- {
- if (tag.equals(DESTINATION_NAME_TAG))
- getAddr().addExtension(DESTINATION_NAME_TAG, nl.item(i).getTextContent());
- else
- {
- if (tag.equals(CONNECTION_FACTORY_TAG))
- getAddr().addExtension(CONNECTION_FACTORY_TAG, nl.item(i).getTextContent());
- else
- {
- if (tag.equals(JNDI_CONTEXT_FACTORY_TAG))
- getAddr().addExtension(JNDI_CONTEXT_FACTORY_TAG, nl.item(i).getTextContent());
- else
- {
- if (tag.equals(JNDI_PKG_PREFIX_TAG))
- getAddr().addExtension(JNDI_PKG_PREFIX_TAG, nl.item(i).getTextContent());
- else
- {
- if (tag.equals(JNDI_URL_TAG))
- getAddr().addExtension(JNDI_URL_TAG, nl.item(i).getTextContent());
- else
- {
- if (tag.equals(MESSAGE_SELECTOR_TAG))
- getAddr().addExtension(MESSAGE_SELECTOR_TAG, nl.item(i).getTextContent());
- }
- }
- }
- }
- }
+ } else if (tag.equals(DESTINATION_NAME_TAG)) {
+ getAddr().addExtension(DESTINATION_NAME_TAG, nl.item(i).getTextContent());
+ } else if (tag.equals(CONNECTION_FACTORY_TAG)) {
+ getAddr().addExtension(CONNECTION_FACTORY_TAG, nl.item(i).getTextContent());
+ } else if (tag.equals(JNDI_CONTEXT_FACTORY_TAG)) {
+ getAddr().addExtension(Context.INITIAL_CONTEXT_FACTORY, nl.item(i).getTextContent());
+ } else if (tag.equals(JNDI_PKG_PREFIX_TAG)) {
+ getAddr().addExtension(Context.URL_PKG_PREFIXES, nl.item(i).getTextContent());
+ } else if (tag.equals(JNDI_URL_TAG)) {
+ getAddr().addExtension(Context.PROVIDER_URL, nl.item(i).getTextContent());
+ } else if (tag.equals(MESSAGE_SELECTOR_TAG)) {
+ getAddr().addExtension(MESSAGE_SELECTOR_TAG, nl.item(i).getTextContent());
}
}
}
@@ -145,7 +135,7 @@
String connection)
{
this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
- "","", null, null);
+ null, null);
}
/**
@@ -167,11 +157,10 @@
*/
public JMSEpr(String destinationType, String destinationName,
- String connection, String jndiUrl, String jndiContextFactory,
- String jndiPkgPrefix, String messageSelector)
+ String connection, Properties environment, String messageSelector)
{
this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
- jndiUrl, jndiContextFactory, jndiPkgPrefix, messageSelector);
+ environment, messageSelector);
}
/**
@@ -195,8 +184,7 @@
*/
public JMSEpr(String protocol, String destinationType,
- String destinationName, String connection, String jndiUrl,
- String jndiContextFactory, String jndiPkgPrefix,
+ String destinationName, String connection, Properties environment,
String messageSelector)
{
// how many of these do we really need? modify accordingly.
@@ -222,17 +210,14 @@
if (connection != null)
addr.addExtension(CONNECTION_FACTORY_TAG, connection);
- if (jndiContextFactory != null)
- addr.addExtension(JNDI_CONTEXT_FACTORY_TAG, jndiContextFactory);
-
- if (jndiPkgPrefix != null)
- addr.addExtension(JNDI_PKG_PREFIX_TAG, jndiPkgPrefix);
-
- if (jndiUrl != null)
- addr.addExtension(JNDI_URL_TAG, jndiUrl);
-
if (messageSelector != null)
addr.addExtension(MESSAGE_SELECTOR_TAG, messageSelector);
+
+ if (environment!=null) {
+ for (Object key : environment.keySet()) {
+ addr.addExtension(key.toString(), environment.getProperty(key.toString()));
+ }
+ }
setAddr(addr);
}
@@ -293,43 +278,28 @@
{
return getAddr().getExtensionValue(CONNECTION_FACTORY_TAG);
}
+
+ /**
+ * @return the jndi context factory for this EPR, or <code>null</code> if
+ * none is set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
- /**
- * @return the jndi context factory for this EPR, or <code>null</code> if
- * none is set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
- */
+ public final Properties getJndiEnvironment() throws URISyntaxException
+ {
+ Properties properties = new Properties();
+ Iterator<Extension> iter = getAddr().getExtensions();
+ while (iter.hasNext()) {
+ Extension extension = iter.next();
+ if (extension.getTag().startsWith("java.naming.") && extension.getValue()!=null) {
+ properties.put(extension.getTag(), extension.getValue());
+ }
+ }
+ return properties;
+ }
- public final String getJndiContextFactory() throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_CONTEXT_FACTORY_TAG);
- }
-
/**
- * @return the jndi pkg prefix for this EPR, or <code>null</code> if none
- * is set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
- */
-
- public final String getJndiPkgPrefix() throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_PKG_PREFIX_TAG);
- }
-
- /**
- * @return the jndi URL for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
- */
-
- public final String getJndiURL() throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_URL_TAG);
- }
-
- /**
* @return the message selector for this EPR, or <code>null</code> if none
* is set.
* @throws URISyntaxException
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -22,6 +22,8 @@
package org.jboss.soa.esb.common;
+import java.util.Properties;
+
import javax.jms.ConnectionFactory;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -332,9 +334,12 @@
String providerUrl = ModulePropertyManager.getPropertyManager(contextModuleName).getProperty(Context.PROVIDER_URL, NamingContext.JBOSS_PROVIDER_URL);
String initialContextFactory = ModulePropertyManager.getPropertyManager(contextModuleName).getProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
String urlPackagePrefix = ModulePropertyManager.getPropertyManager(contextModuleName).getProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
- Context context;
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, providerUrl);
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
+ environment.setProperty(Context.URL_PKG_PREFIXES, urlPackagePrefix);
- context = NamingContext.getServerContext(providerUrl, initialContextFactory, urlPackagePrefix);
+ Context context = NamingContext.getServerContext(environment);
if(context == null) {
// Would be nice if NamingContext.getServerContext threw an exception with
// details attached.
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -126,10 +126,8 @@
// Setting the replyTo to the queue we specific in the epr we are
// going to call
// The selectors will do the job.
- return new JMSEpr(jpr.getDestinationType(), jpr
- .getDestinationName(), jpr.getConnectionFactory(), jpr
- .getJndiURL(), jpr.getJndiContextFactory(), jpr
- .getJndiPkgPrefix(), getReplySelector());
+ return new JMSEpr(jpr.getDestinationType(), jpr.getDestinationName(),
+ jpr.getConnectionFactory(), jpr.getJndiEnvironment(), getReplySelector());
}
if(toEpr instanceof FileEpr)
{
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/NamingContext.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/NamingContext.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/NamingContext.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -22,6 +22,7 @@
package org.jboss.soa.esb.helpers;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -43,34 +44,25 @@
public static final String JBOSS_PROVIDER_URL = "localhost";
public static final String JBOSS_INITIAL_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
public static final String JBOSS_URL_PKG_PREFIX = ""; //"org.jboss.naming:org.jnp.interfaces"
+ private static ConcurrentHashMap<String,Context> _contextCache = new ConcurrentHashMap<String, Context>();
/**
* Tries to connect to the server to obtain the server Context.
*
- * @param providerUrl
- * @param initialContextFactory
- * @param urlPkgPrefixes
+ * @param properties - the JNDI environment.
* @return the InitialContext.
*/
- public static Context getServerContext(String providerUrl,
- String initialContextFactory, String urlPkgPrefixes)
+ public static Context getServerContext(Properties properties)
{
- Properties properties = new Properties();
- if (providerUrl!=null )properties.setProperty(Context.PROVIDER_URL, providerUrl);
- if (initialContextFactory!=null) properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
- if (urlPkgPrefixes!=null) properties.setProperty(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
-
+ String key = getKey(properties);
+ if (_contextCache.containsKey(key)) {
+ return _contextCache.get(key);
+ }
boolean bCtxOK = false;
Context oCtx = null;
for (int i1 = 0; (!bCtxOK) && i1 < MAX_RETRIES; i1++) {
// check if context is valid
try {
- if ((providerUrl ==null || "".equals(providerUrl))
- && (initialContextFactory == null || "".equals(initialContextFactory))
- && (urlPkgPrefixes == null || "".equals(urlPkgPrefixes))) {
- oCtx = new InitialContext();
- } else {
- oCtx = new InitialContext(properties);
- }
+ oCtx = new InitialContext(properties);
oCtx.list("__dummy2@#$%");
bCtxOK = true;
} catch (NamingException nex) {
@@ -78,11 +70,67 @@
}
}
if (bCtxOK) {
+ _contextCache.put(key, oCtx);
return oCtx;
} else {
- _logger.error("Can't connect to JNDI Server <" + providerUrl + ">");
+ _logger.error("Can't connect to JNDI Server <" + properties.get(Context.PROVIDER_URL) + ">");
return null;
}
}
+ /**
+ * Refreshing the cached JNDI context, return the new context.
+ * @param properties
+ * @return
+ */
+ public static Context getFreshServerContext(Properties properties)
+ {
+ String key = getKey(properties);
+ if (_contextCache.containsKey(key)) {
+ Context context = _contextCache.get(key);
+ try {
+ context.close();
+ } catch (NamingException ne) {
+ _logger.warn("Could not close JNDI connection.");
+ }
+ _contextCache.remove(key);
+ }
+ return getServerContext(properties);
+ }
+ /**
+ * Takes properties and serializes this into a long string which is
+ * the key into the contextCache.
+ * @param properties - property Bag.
+ * @return key into the contextCache.
+ */
+ private static String getKey(Properties properties)
+ {
+ //Can't handle nulls
+ if (properties==null) {
+ properties=new Properties();
+ }
+ //Contruct the composite key, buy serializing the properties into one String.
+ StringBuffer compositeKey= new StringBuffer("-");
+ for (Object keyObject : properties.keySet()) {
+ String key = (String) keyObject;
+ String value=(String)properties.getProperty(key);
+ compositeKey.append(key).append("=").append(value).append("-");
+ }
+ return compositeKey.toString();
+ }
+ /**
+ * Closes all Contexts, and removes them from the contextCache.
+ */
+ public static void closeAllContexts()
+ {
+ for (String key : _contextCache.keySet()) {
+ try {
+ _logger.debug("Closing JNDI connection for key: " + key);
+ _contextCache.get(key).close();
+ } catch (NamingException ne) {
+ _logger.warn("Could not close JNDI connection for key: " + key);
+ }
+ _contextCache.remove(key);
+ }
+ }
}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -22,6 +22,9 @@
package org.jboss.soa.esb.notification;
+import java.util.List;
+import java.util.Properties;
+
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
@@ -38,6 +41,7 @@
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.helpers.NamingContext;
;
@@ -92,17 +96,40 @@
if (null == sAtt)
throw new ConfigurationException("Missing queue jndiName");
+ Properties environment = new Properties();
+
String jndiURL = p_oaP[i].getAttribute(JMSEpr.JNDI_URL_TAG);
+ if (jndiURL!=null) environment.setProperty(Context.PROVIDER_URL, jndiURL);
String contextFactory = p_oaP[i].getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG);
+ if (contextFactory!=null) environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
String prefix = p_oaP[i].getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG);
+ if (prefix!=null) environment.setProperty(Context.URL_PKG_PREFIXES, prefix);
+ List<KeyValuePair> properties=p_oaP[i].childPropertyList();
+ for (KeyValuePair property : properties) {
+ if (property.getKey().startsWith("java.naming.")) {
+ environment.setProperty(property.getKey(), property.getValue());
+ }
+ }
+
String connectionFactory = p_oaP[i].getAttribute(JMSEpr.CONNECTION_FACTORY_TAG);
if (connectionFactory==null) {
connectionFactory = CONNECTION_FACTORY;
}
- mPool[i] = JmsConnectionPoolContainer.getPool(jndiURL, contextFactory, prefix, CONNECTION_FACTORY, JMSEpr.QUEUE_TYPE);
- m_oCtx[i] = NamingContext.getServerContext(jndiURL, contextFactory, prefix);
- Queue oQ = (Queue) m_oCtx[i].lookup(sAtt);
+ mPool[i] = JmsConnectionPoolContainer.getPool(environment, connectionFactory, JMSEpr.QUEUE_TYPE);
+ m_oCtx[i] = NamingContext.getServerContext(environment);
+ Queue oQ=null;
QueueSession queueSession = mPool[i].getQueueSession();
+ try {
+ oQ = (Queue) m_oCtx[i].lookup(sAtt);
+ } catch (NamingException ne) {
+ try {
+ m_oCtx[i] = NamingContext.getFreshServerContext(environment);
+ oQ = (Queue) m_oCtx[i].lookup(sAtt);
+ } catch (NamingException nex) {
+ //ActiveMQ
+ oQ = queueSession.createQueue(sAtt);
+ }
+ }
m_oaMssProd[i] = queueSession.createSender(oQ);
m_oSess[i] = queueSession;
}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -22,6 +22,9 @@
package org.jboss.soa.esb.notification;
+import java.util.List;
+import java.util.Properties;
+
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
@@ -38,6 +41,7 @@
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.helpers.NamingContext;
/**
*
@@ -70,19 +74,41 @@
{
for (int i = 0; i < p_oaP.length; i++)
{
+ Properties environment = new Properties();
String sAtt = p_oaP[i].getAttribute(ATT_DEST_NAME);
if (null == sAtt) throw new ConfigurationException("Missing topic jndiName");
String jndiURL = p_oaP[i].getAttribute(JMSEpr.JNDI_URL_TAG);
+ if (jndiURL!=null) environment.setProperty(Context.PROVIDER_URL, jndiURL);
String contextFactory = p_oaP[i].getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG);
+ if (contextFactory!=null) environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
String prefix = p_oaP[i].getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG);
+ if (prefix!=null) environment.setProperty(Context.URL_PKG_PREFIXES, prefix);
+ List<KeyValuePair> properties=p_oaP[i].childPropertyList();
+ for (KeyValuePair property : properties) {
+ if (property.getKey().startsWith("java.naming.")) {
+ environment.setProperty(property.getKey(), property.getValue());
+ }
+ }
+
String connectionFactory = p_oaP[i].getAttribute(JMSEpr.CONNECTION_FACTORY_TAG);
if (connectionFactory==null) {
connectionFactory = CONNECTION_FACTORY;
}
- mPool[i] = JmsConnectionPoolContainer.getPool(jndiURL, contextFactory, prefix, connectionFactory, JMSEpr.TOPIC_TYPE);
- m_oCtx[i] = NamingContext.getServerContext(jndiURL, contextFactory, prefix);
- Topic oT = (Topic) m_oCtx[i].lookup(sAtt);
+ mPool[i] = JmsConnectionPoolContainer.getPool(environment, connectionFactory, JMSEpr.TOPIC_TYPE);
TopicSession topicSession = mPool[i].getTopicSession();
+ m_oCtx[i] = NamingContext.getServerContext(environment);
+ Topic oT=null;
+ try {
+ oT = (Topic) m_oCtx[i].lookup(sAtt);
+ } catch (NamingException ne) {
+ m_oCtx[i] = NamingContext.getFreshServerContext(environment);
+ try {
+ oT = (Topic) m_oCtx[i].lookup(sAtt);
+ } catch (NamingException nex) {
+ //ActiveMQ
+ topicSession.createTopic(sAtt);
+ }
+ }
m_oaMssProd[i] = topicSession.createPublisher(oT);
m_oSess[i] = topicSession;
}
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -39,7 +39,7 @@
{
try
{
- new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar",null,null,null,null);
+ new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar",null,null);
}
catch (Exception ex)
{
@@ -51,7 +51,7 @@
{
try
{
- JMSEpr jms = new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar", null,null,null,null);
+ JMSEpr jms = new JMSEpr(JMSEpr.ONE_ONE_PROTOCOL, JMSEpr.QUEUE_TYPE, "bar", "foobar",null,null);
assertEquals(jms.getVersion(), JMSEpr.ONE_ONE_PROTOCOL);
assertEquals(jms.getConnectionFactory(), "foobar");
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -21,6 +21,8 @@
*/
package org.jboss.soa.esb.common.tests.utils;
+import java.util.Properties;
+
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.Queue;
@@ -82,10 +84,11 @@
QueueReceiver getQueue(String p_sJndi) throws Exception
{
- Context oCtx = NamingContext.getServerContext(
- NamingContext.JBOSS_PROVIDER_URL,
- NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY,
- NamingContext.JBOSS_URL_PKG_PREFIX);
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, NamingContext.JBOSS_PROVIDER_URL);
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+ environment.setProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
+ Context oCtx = NamingContext.getServerContext(environment);
QueueConnection oQconn = null;
QueueSession oQsess = null;
@@ -105,11 +108,11 @@
TopicSubscriber getTopic(String p_sJndi) throws Exception
{
- Context oCtx = NamingContext.getServerContext(
- NamingContext.JBOSS_PROVIDER_URL,
- NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY,
- NamingContext.JBOSS_URL_PKG_PREFIX);
-
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, NamingContext.JBOSS_PROVIDER_URL);
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+ environment.setProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
+ Context oCtx = NamingContext.getServerContext(environment);
TopicConnection oTconn = null;
TopicSession oTsess = null;
TopicConnectionFactory qcf = (TopicConnectionFactory) oCtx
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/AppServerContextUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/AppServerContextUnitTest.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/helpers/AppServerContextUnitTest.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -22,6 +22,7 @@
package org.jboss.soa.esb.helpers;
import java.util.Hashtable;
+import java.util.Properties;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -35,10 +36,13 @@
public class AppServerContextUnitTest extends TestCase {
public void test_AppServerContext() throws NamingException {
- Context ctx = NamingContext.getServerContext("http://localhost:1234",
- NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY,
- NamingContext.JBOSS_URL_PKG_PREFIX);
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, "http://localhost:1234");
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+ environment.setProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
+ Context ctx = NamingContext.getServerContext(environment);
+
Hashtable props = ctx.getEnvironment();
System.out.println(props);
assertEquals("org.jnp.interfaces.NamingContextFactory", props.get(Context.INITIAL_CONTEXT_FACTORY));
Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/persistence/manager/J2eeConnectionManager.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/persistence/manager/J2eeConnectionManager.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/persistence/manager/J2eeConnectionManager.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -2,6 +2,7 @@
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.Properties;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -64,8 +65,11 @@
// try
// {
- oJndiCtx = NamingContext.getServerContext(Configuration.getJndiServerURL(),
- Configuration.getJndiServerContextFactory(), Configuration.getJndiServerPkgPrefix());
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, Configuration.getJndiServerURL());
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, Configuration.getJndiServerContextFactory());
+ environment.setProperty(Context.URL_PKG_PREFIXES, Configuration.getJndiServerPkgPrefix());
+ oJndiCtx = NamingContext.getServerContext(environment);
if (null == oJndiCtx) {
_logger.error("could not get a valid context");
@@ -77,22 +81,13 @@
}
catch (Exception ex)
{
- _logger.error(ex);
- throw new ConfigurationException(ex);
- }
- finally
- {
- if (null != oJndiCtx) try
- {
- oJndiCtx.close();
+ try {
+ oJndiCtx = NamingContext.getFreshServerContext(environment);
+ datasource = ((DataSource) oJndiCtx.lookup(Configuration.getStoreDBDatasourceName()));
+ } catch (NamingException nex) {
+ throw new ConfigurationException(nex);
}
- catch (NamingException ne)
- {
- _logger.error(ne.getMessage(), ne);
- }
-
- }
-
+ }
}
}
Modified: labs/jbossesb/trunk/product/install/deployment.properties-example
===================================================================
--- labs/jbossesb/trunk/product/install/deployment.properties-example 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/install/deployment.properties-example 2007-04-05 02:15:55 UTC (rev 10779)
@@ -21,7 +21,7 @@
######################################################################
# Server home directory
# (By default the 'ant install' task will create this directory.)
-org.jboss.esb.server.home=/jbossesb-server-4.2.MR1
+org.jboss.esb.server.home=/jbossesb-server-4.2.MP1
# the instance of jboss you are running (default)
org.jboss.esb.appserver.config=default
######################################################################
Deleted: labs/jbossesb/trunk/product/lib/ext/jms/jbossmessaging/jboss-messaging-client.jar
===================================================================
(Binary files differ)
Added: labs/jbossesb/trunk/product/lib/ext/jms/oracleaq/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/lib/ext/jms/oracleaq/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/lib/ext/jms/oracleaq/readme.txt 2007-04-05 02:15:55 UTC (rev 10779)
@@ -0,0 +1,44 @@
+In OracleAQ use the "QueueConnectionFactory" for queues or "TopicConnectionFactory"
+for topics.
+
+From you Oracle DB installation obtain:
+aqapi13.jar
+ojdbc14.jar
+
+From lib/ext obtain
+
+asm.jar
+cglib-2.1_2jboss.jar
+mockejb.jar
+
+In plugins/org.jboss.soa.esb.oracle.aq run the package target and obtain
+
+org.jboss.soa.esb.oracle.aq.<version>.jar.
+
+under the jms-provider element add the following properties:
+
+ <property name="java.naming.factory.initial" value="org.jboss.soa.esb.oracle.aq.AQInitialContextFactory"/>
+ <property name="java.naming.oracle.aq.user" value="kurt"/>
+ <property name="java.naming.oracle.aq.password" value="kurt"/>
+ <property name="java.naming.oracle.aq.server" value="barentz"/>
+ <property name="java.naming.oracle.aq.instance" value="OSC"/>
+ <property name="java.naming.oracle.aq.schema" value="kurt"/>
+ <property name="java.naming.oracle.aq.port" value="1521"/>
+ <property name="java.naming.oracle.aq.driver" value="thin"/>
+
+Check the Helloworld_action Quickstart for an example configuration.
+
+Note that
+
+1. Oracle AQ is using a database connection as it's JMS connection.
+ see for example: http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10785/jm_opers.htm#i1006471
+2. Oracle AQ does not have a JNDI provider and it is common to register
+ Queues in an LDAP. Here we chose to register the Queues to MockContext
+ which is why you need the mockejb.jar, as well as the asm and cglib jars
+ that it depends on. The org.jboss.soa.esb.oracle.aq-4.2.MR2.jar plugin
+ does the actual work of registering. Registering to JNP proved not
+ possible because of code in the Oracle API to support option 1, the LDAP
+ registration.
+
+
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/listener.log
===================================================================
Added: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/README.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/README.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/README.txt 2007-04-05 02:15:55 UTC (rev 10779)
@@ -0,0 +1,34 @@
+To run with Oracle AQ as your JMS provider you will need to follow the following steps:
+
+1. Using the Oracle Enterprise Manager Console create 3 queues named:
+ ACTION_REQUEST, B and HELLO_WORLD_ACTION, make sure to set
+ the payload type to Object: SYS, AQ$_JMS_MESSAGE.
+
+2. Edit the jndi.properties file to reflect your database connection settings
+
+3. Copy the jndi.properties and the jboss-esb.xml in the helloworld_action directory.
+
+4. From the lib/ext/jms/oracleaq directory copy the following jars in to the
+ helloworld_action/lib directory
+
+ 26747 Mar 18 18:16 asm.jar
+ 286330 Mar 18 18:16 cglib-2.1_2jboss.jar
+ 120342 Aug 4 2006 mockejb.jar
+ 8757 Apr 4 14:13 org.jboss.soa.esb.oracle.aq-4.2.MR2.jar
+
+ and obtain the following jars from your Oracle DB install:
+
+ 772466 Mar 27 11:14 aqapi13.jar (from oracle)
+1397543 Mar 27 11:13 ojdbc14.jar (from oracle)
+
+
+Note that
+
+1. Oracle AQ is using a database connection as it's JMS connection.
+2. Oracle AQ does not have a JNDI provider and it is common to register
+ Queues in an LDAP. Here we chose to register the Queues to MockContext
+ which is why you need the mockejb.jar, as well as the asm and cglib jars
+ that it depends on. The org.jboss.soa.esb.oracle.aq-4.2.MR2.jar plugin
+ does the actual work of registering. Registering to JNP proved not
+ possible because of code in the Oracle API to support option 1, the LDAP
+ registration.
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/jboss-esb.xml 2007-04-05 02:15:55 UTC (rev 10779)
@@ -0,0 +1,84 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+
+ <providers>
+ <jms-provider name="JBossMQ" connection-factory="QueueConnectionFactory">
+ <property name="java.naming.factory.initial" value="org.jboss.soa.esb.oracle.aq.AQInitialContextFactory"/>
+ <property name="java.naming.oracle.aq.user" value="kurt"/>
+ <property name="java.naming.oracle.aq.password" value="kurt"/>
+ <property name="java.naming.oracle.aq.server" value="barentz"/>
+ <property name="java.naming.oracle.aq.instance" value="OSC"/>
+ <property name="java.naming.oracle.aq.schema" value="kurt"/>
+ <property name="java.naming.oracle.aq.port" value="1521"/>
+ <property name="java.naming.oracle.aq.driver" value="thin"/>
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="ACTION_REQUEST"
+ />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="B"
+ />
+ </jms-bus>
+
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="HelloWorld_ActionESB"
+ name="SimpleListener"
+ description="Hello World" >
+ <listeners>
+ <jms-listener name="JMS-Gateway"
+ busidref="quickstartGwChannel"
+ maxThreads="1"
+ is-gateway="true"
+ />
+ <jms-listener name="JMS-ESBListener"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action name="displayAction"
+ class="quickstart.helloworld_action.MyJMSListenerAction"
+ process="displayMessage">
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ </action>
+ <action name="playAction"
+ class="quickstart.helloworld_action.MyJMSListenerAction"
+ process="playWithMessage">
+
+ <property name="exceptionMethod" value="exceptionHandler"/>
+ </action>
+ <action name="notificationAction"
+ class="org.jboss.soa.esb.actions.Notifier">
+ <property name="okMethod" value="notifyOK" />
+ <property name="notification-details">
+ <NotificationList type="OK">
+ <target class="NotifyConsole" />
+ <target class="NotifyQueues">
+ <messageProp name="quickstart" value="hello_world_action" />
+ <queue jndiName="HELLO_WORLD_ACTION" connection-factory="QueueConnectionFactory">
+ <property name="java.naming.factory.initial" value="org.jboss.soa.esb.oracle.aq.AQInitialContextFactory"/>
+ <property name="java.naming.oracle.aq.user" value="kurt"/>
+ <property name="java.naming.oracle.aq.password" value="kurt"/>
+ <property name="java.naming.oracle.aq.server" value="barentz"/>
+ <property name="java.naming.oracle.aq.instance" value="OSC"/>
+ <property name="java.naming.oracle.aq.schema" value="kurt"/>
+ <property name="java.naming.oracle.aq.port" value="1521"/>
+ <property name="java.naming.oracle.aq.driver" value="thin"/>
+ </queue>
+ </target>
+ </NotificationList>
+ </property>
+ </action>
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/jboss-esb.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/juddi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/juddi.properties 2007-04-05 02:15:55 UTC (rev 10779)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/oracle-aq/juddi.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/SendJMSMessage.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/src/quickstart/helloworld_action/test/SendJMSMessage.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -39,10 +39,10 @@
public void setupConnection() throws JMSException, NamingException
{
InitialContext iniCtx = new InitialContext();
- Object tmp = iniCtx.lookup("ConnectionFactory");
+ Object tmp = iniCtx.lookup("QueueConnectionFactory");
QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
conn = qcf.createQueueConnection();
- que = (Queue) iniCtx.lookup("queue/quickstart_helloworld_action_Request");
+ que = (Queue) iniCtx.lookup("ACTION_REQUEST");
session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
conn.start();
System.out.println("Connection Started");
Added: labs/jbossesb/trunk/qa/jmeter/JBossMQ-HelloWorld-Action-Oracle.jmx
===================================================================
--- labs/jbossesb/trunk/qa/jmeter/JBossMQ-HelloWorld-Action-Oracle.jmx (rev 0)
+++ labs/jbossesb/trunk/qa/jmeter/JBossMQ-HelloWorld-Action-Oracle.jmx 2007-04-05 02:15:55 UTC (rev 10779)
@@ -0,0 +1,115 @@
+<jmeterTestPlan version="1.2" properties="1.8">
+ <hashTree>
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="JBossESB" enabled="true">
+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="TestPlan.user_define_classpath"></stringProp>
+ <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
+ <boolProp name="TestPlan.functional_mode">false</boolProp>
+ <stringProp name="TestPlan.comments"></stringProp>
+ </TestPlan>
+ <hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Point-to-Point" enabled="true">
+ <longProp name="ThreadGroup.start_time">1172254399000</longProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.num_threads">30</stringProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
+ <intProp name="LoopController.loops">-1</intProp>
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ </elementProp>
+ <longProp name="ThreadGroup.end_time">1172254399000</longProp>
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <JMSSampler guiclass="JMSConfigGui" testclass="JMSSampler" testname="JMS Point-to-Point" enabled="true">
+ <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <elementProp name="JMSSampler.jndiProperties" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="java.naming.oracle.aq.user" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">kurt</stringProp>
+ <stringProp name="Argument.name">java.naming.oracle.aq.user</stringProp>
+ </elementProp>
+ <elementProp name="java.naming.oracle.aq.password" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">kurt</stringProp>
+ <stringProp name="Argument.name">java.naming.oracle.aq.password</stringProp>
+ </elementProp>
+ <elementProp name="java.naming.oracle.aq.server" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">barentz</stringProp>
+ <stringProp name="Argument.name">java.naming.oracle.aq.server</stringProp>
+ </elementProp>
+ <elementProp name="java.naming.oracle.aq.instance" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">OSC</stringProp>
+ <stringProp name="Argument.name">java.naming.oracle.aq.instance</stringProp>
+ </elementProp>
+ <elementProp name="java.naming.oracle.aq.schema" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">kurt</stringProp>
+ <stringProp name="Argument.name">java.naming.oracle.aq.schema</stringProp>
+ </elementProp>
+ <elementProp name="java.naming.oracle.aq.port" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">1521</stringProp>
+ <stringProp name="Argument.name">java.naming.oracle.aq.port</stringProp>
+ </elementProp>
+ <elementProp name="java.naming.oracle.aq.driver" elementType="Argument">
+ <stringProp name="Argument.metadata">=</stringProp>
+ <stringProp name="Argument.value">thin</stringProp>
+ <stringProp name="Argument.name">java.naming.oracle.aq.driver</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <boolProp name="JMSSampler.isFireAndForget">false</boolProp>
+ <stringProp name="JMSSampler.ReceiveQueue">HELLO_WORLD_ACTION</stringProp>
+ <stringProp name="JMSSampler.timeout">200000</stringProp>
+ <stringProp name="JMSSampler.SendQueue">ACTION_REQUEST</stringProp>
+ <stringProp name="JMSSampler.contextProviderUrl"></stringProp>
+ <stringProp name="JMSSampler.queueconnectionfactory">QueueConnectionFactory</stringProp>
+ <stringProp name="JMSSampler.initialContextFactory">org.jboss.soa.esb.oracle.aq.AQInitialContextFactory</stringProp>
+ <stringProp name="HTTPSamper.xml_data">oracle test</stringProp>
+ </JMSSampler>
+ <hashTree/>
+ <ResultCollector guiclass="GraphVisualizer" testclass="ResultCollector" testname="Graph Results" enabled="true">
+ <objProp>
+ <value class="SampleSaveConfiguration">
+ <time>true</time>
+ <latency>true</latency>
+ <timestamp>true</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>false</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+ <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ </value>
+ <name>saveConfig</name>
+ </objProp>
+ <stringProp name="filename">C:\eclipse\workspace\jbossesb_profile\qa\jmeter\reports\JBossMQ-QueuA-to-A.jtl</stringProp>
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ </hashTree>
+ </hashTree>
+</jmeterTestPlan>
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/DrainQueuesAndTopics.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/DrainQueuesAndTopics.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/objpersist/DrainQueuesAndTopics.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -22,6 +22,8 @@
package org.jboss.soa.esb.objpersist;
+import java.util.Properties;
+
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.QueueConnection;
@@ -40,10 +42,6 @@
public class DrainQueuesAndTopics
{
private static final int MAX_TIMES_NOMSG = 10;
- private static final String JNDI_URL = "localhost";
- private static final String JNDI_CONNECTION_FACTORY
- = NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY;
-
private Context m_oCtx;
public DrainQueuesAndTopics() throws Exception
@@ -56,7 +54,11 @@
public int purgeQueueTopic(String p_sName) throws Exception
{
int iRet = 0;
- m_oCtx = NamingContext.getServerContext(JNDI_URL, JNDI_CONNECTION_FACTORY, null);
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, NamingContext.JBOSS_PROVIDER_URL);
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+ environment.setProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
+ m_oCtx = NamingContext.getServerContext(environment);
System.out.println(p_sName);
MessageConsumer oCns = null;
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/rosetta/pooling/JmsConnectionPoolingTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/rosetta/pooling/JmsConnectionPoolingTest.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/rosetta/pooling/JmsConnectionPoolingTest.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -21,7 +21,10 @@
*/
package org.jboss.soa.esb.rosetta.pooling;
+import java.util.Properties;
+
import javax.jms.Session;
+import javax.naming.Context;
import junit.framework.JUnit4TestAdapter;
@@ -44,7 +47,12 @@
{
JmsConnectionPool jmsConnectionPool = null;
try {
- jmsConnectionPool = JmsConnectionPoolContainer.getPool(NamingContext.JBOSS_PROVIDER_URL, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY, null, "ConnectionFactory", JMSEpr.QUEUE_TYPE);
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, NamingContext.JBOSS_PROVIDER_URL);
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+ environment.setProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
+
+ jmsConnectionPool = JmsConnectionPoolContainer.getPool(environment,"ConnectionFactory", JMSEpr.QUEUE_TYPE);
assertEquals(0, jmsConnectionPool.getSessionsInPool());
//Open 3 concurrent sessions
Session session1 = jmsConnectionPool.getQueueSession();
@@ -81,16 +89,20 @@
{
try {
- JmsConnectionPool jmsConnectionPool = JmsConnectionPoolContainer.getPool(NamingContext.JBOSS_PROVIDER_URL, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY, null, "ConnectionFactory", JMSEpr.QUEUE_TYPE);
- jmsConnectionPool = JmsConnectionPoolContainer.getPool(NamingContext.JBOSS_PROVIDER_URL, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY, null, "ConnectionFactory", JMSEpr.QUEUE_TYPE);
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, NamingContext.JBOSS_PROVIDER_URL);
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+ environment.setProperty(Context.URL_PKG_PREFIXES, NamingContext.JBOSS_URL_PKG_PREFIX);
+ JmsConnectionPool jmsConnectionPool = JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory", JMSEpr.QUEUE_TYPE);
+ jmsConnectionPool = JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory", JMSEpr.QUEUE_TYPE);
//This should be the same pool
assertEquals(1, JmsConnectionPoolContainer.getNumberOfPools());
- jmsConnectionPool = JmsConnectionPoolContainer.getPool(NamingContext.JBOSS_PROVIDER_URL, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY, null, "ConnectionFactory", JMSEpr.TOPIC_TYPE);
+ jmsConnectionPool = JmsConnectionPoolContainer.getPool(environment, "ConnectionFactory", JMSEpr.TOPIC_TYPE);
//This should be a different pool, so now we should have 2.
assertEquals(2, JmsConnectionPoolContainer.getNumberOfPools());
- jmsConnectionPool = JmsConnectionPoolContainer.getPool(null, null, null, "ConnectionFactory", JMSEpr.TOPIC_TYPE);
+ jmsConnectionPool = JmsConnectionPoolContainer.getPool(null, "ConnectionFactory", JMSEpr.TOPIC_TYPE);
//This should be a different pool, so now we should have 3.
assertEquals(3, JmsConnectionPoolContainer.getNumberOfPools());
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java 2007-04-05 02:12:23 UTC (rev 10778)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/JMSClientUtil.java 2007-04-05 02:15:55 UTC (rev 10779)
@@ -23,6 +23,7 @@
package org.jboss.soa.esb.util;
import java.io.Serializable;
+import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -122,10 +123,11 @@
String queueName;
private JMSSendQueueSetup(QUEUE queue) throws Exception {
- Context oCtx = NamingContext.getServerContext(
- Configuration.getJndiServerURL(),
- Configuration.getJndiServerContextFactory(),
- Configuration.getJndiServerPkgPrefix());
+ Properties environment = new Properties();
+ environment.setProperty(Context.PROVIDER_URL, Configuration.getJndiServerURL());
+ environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, Configuration.getJndiServerContextFactory());
+ environment.setProperty(Context.URL_PKG_PREFIXES, Configuration.getJndiServerPkgPrefix());
+ Context oCtx = NamingContext.getServerContext(environment);
QueueConnectionFactory qcf = (QueueConnectionFactory) oCtx.lookup("ConnectionFactory");
QueueConnection oQconn = qcf.createQueueConnection();
More information about the jboss-svn-commits
mailing list