[jboss-svn-commits] JBL Code SVN: r10437 - in labs/jbossesb/trunk/product: docs and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Mar 22 12:10:52 EDT 2007


Author: kurt.stam at jboss.com
Date: 2007-03-22 12:10:52 -0400 (Thu, 22 Mar 2007)
New Revision: 10437

Modified:
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.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/docs/AdministrationGuide.odt
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld/base-build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/base-build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml
Log:
http://jira.jboss.com/jira/browse/JBESB-488 Allowing to override JNDI and connectionFactory Settings.

Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java	2007-03-22 15:55:42 UTC (rev 10436)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java	2007-03-22 16:10:52 UTC (rev 10437)
@@ -35,9 +35,7 @@
 import org.apache.log4j.Logger;
 import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
 import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.common.Configuration;
 import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.helpers.NamingContext;
 import org.jboss.soa.esb.message.format.MessageType;
 
 /**
@@ -95,19 +93,19 @@
 	 * JMS destination (javax.jms.Destination) to send/publish the notification
 	 * at sendNotification() time
 	 */
-	protected Context m_oCtx;
+	protected Context[] m_oCtx;
 
 	private Properties m_oProps = new Properties();
 
 	/**
 	 * The javax.jms.Connection instance used to talk to JMS
 	 */
-	protected JmsConnectionPool mPool;
+	protected JmsConnectionPool[] mPool;
 
 	/**
 	 * The javax.jms.Session instance used to talk to JMS
 	 */
-	protected Session m_oSess;
+	protected Session[] m_oSess;
 
 	/**
 	 * Array with an instance of javax.jms.MessageProducer on each entry that
@@ -141,11 +139,6 @@
 
 			m_oProps.setProperty(sKey.trim(), sVal);
 		}
-
-//      //REVIEW make the JNDI setting configurable in the Notifier config.
-        m_oCtx = NamingContext.getServerContext(Configuration.getJndiServerURL(), 
-                    Configuration.getJndiServerContextFactory(), Configuration.getJndiServerPkgPrefix());
-
 	} // __________________________________
 
 	/**
@@ -155,12 +148,14 @@
 	 */
 	public void release ()
 	{
-    	mPool.closeSession(m_oSess);
-        if (m_oCtx!=null) {
-            try {
-                m_oCtx.close();
-            } catch (NamingException ne) {
-                log.error(ne.getMessage(), ne);
+        for (int i=0; i<mPool.length; i++) {
+        	mPool[i].closeSession(m_oSess[i]);
+            if (m_oCtx[i]!=null) {
+                try {
+                    m_oCtx[i].close();
+                } catch (NamingException ne) {
+                    log.error(ne.getMessage(), ne);
+                }
             }
         }
 	}
@@ -182,7 +177,7 @@
 	
 			if (MessageType.JAVA_SERIALIZED.equals(message.getType()))
 			{
-				oMsg = m_oSess.createObjectMessage(message.getBody().getContents());
+				oMsg = m_oSess[0].createObjectMessage(message.getBody().getContents());
 			}
 			else
 			{
@@ -190,7 +185,7 @@
                 if (message.getBody().getContents()!=null) {
                     content = new String(message.getBody().getContents());
                 }
-				oMsg = m_oSess.createTextMessage(content);
+				oMsg = m_oSess[0].createTextMessage(content);
 			}
             if (message.getBody().get("MessageId")!=null) {
                 oMsg.setJMSCorrelationID((String)message.getBody().get("MessageId"));

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-03-22 15:55:42 UTC (rev 10436)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java	2007-03-22 16:10:52 UTC (rev 10437)
@@ -28,13 +28,17 @@
 import javax.jms.Queue;
 import javax.jms.QueueSender;
 import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.Context;
 import javax.naming.NamingException;
 
 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.eprs.JMSEpr;
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.NamingContext;
 
 ;
 
@@ -76,17 +80,31 @@
 	{
 		try
 		{
-            mPool = JmsConnectionPoolContainer.getPool(null, null, null, CONNECTION_FACTORY, JMSEpr.QUEUE_TYPE);
+            
 			m_oaMssProd = new MessageProducer[p_oaP.length];
-			for (int i1 = 0; i1 < p_oaP.length; i1++)
+            mPool = new JmsConnectionPool[p_oaP.length];
+            m_oCtx = new Context[p_oaP.length];
+            m_oSess = new Session[p_oaP.length];
+            
+			for (int i = 0; i < p_oaP.length; i++)
 			{
-				String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
+				String sAtt = p_oaP[i].getAttribute(ATT_DEST_NAME);
 				if (null == sAtt) 
 					throw new ConfigurationException("Missing queue jndiName");
-				Queue oQ = (Queue) m_oCtx.lookup(sAtt);
-                QueueSession queueSession = mPool.getQueueSession();
-				m_oaMssProd[i1] = queueSession.createSender(oQ);
-                m_oSess = queueSession;
+                
+                String jndiURL = p_oaP[i].getAttribute(JMSEpr.JNDI_URL_TAG);
+                String contextFactory = p_oaP[i].getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG);
+                String prefix = p_oaP[i].getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG);
+                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);
+                QueueSession queueSession = mPool[i].getQueueSession();
+				m_oaMssProd[i] = queueSession.createSender(oQ);
+                m_oSess[i] = queueSession;
 			}
 		}
 		catch (NamingException ex)

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-03-22 15:55:42 UTC (rev 10436)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java	2007-03-22 16:10:52 UTC (rev 10437)
@@ -25,16 +25,20 @@
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageProducer;
+import javax.jms.Session;
 import javax.jms.Topic;
 import javax.jms.TopicPublisher;
 import javax.jms.TopicSession;
+import javax.naming.Context;
 import javax.naming.NamingException;
 
 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.eprs.JMSEpr;
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.NamingContext;
 /**
  * 
  * KS: It is silly we open and close the jms connection with eash request.
@@ -57,19 +61,30 @@
 	{
 		// REVIEW: The connection factory name is hardcoded and is the same as
 		// that of the queue connection factory.
-        mPool = JmsConnectionPoolContainer.getPool(null, null, null, CONNECTION_FACTORY, JMSEpr.TOPIC_TYPE);
 		m_oaMssProd = new MessageProducer[p_oaP.length];
-		
+        mPool = new JmsConnectionPool[p_oaP.length];
+        m_oCtx = new Context[p_oaP.length];
+        m_oSess = new Session[p_oaP.length];
+        
 		try
 		{
-			for (int i1 = 0; i1 < p_oaP.length; i1++)
+			for (int i = 0; i < p_oaP.length; i++)
 			{
-				String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
+				String sAtt = p_oaP[i].getAttribute(ATT_DEST_NAME);
 				if (null == sAtt) throw new ConfigurationException("Missing topic jndiName");
-				Topic oT = (Topic) m_oCtx.lookup(sAtt);
-                TopicSession topicSession = mPool.getTopicSession();
-				m_oaMssProd[i1] = topicSession.createPublisher(oT);
-                m_oSess = topicSession;
+                String jndiURL = p_oaP[i].getAttribute(JMSEpr.JNDI_URL_TAG);
+                String contextFactory = p_oaP[i].getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG);
+                String prefix = p_oaP[i].getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG);
+                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);
+                TopicSession topicSession = mPool[i].getTopicSession();
+				m_oaMssProd[i] = topicSession.createPublisher(oT);
+                m_oSess[i] = topicSession;
 			}
 		}
 		catch (NamingException ex)

Modified: labs/jbossesb/trunk/product/docs/AdministrationGuide.odt
===================================================================
(Binary files differ)

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld/base-build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld/base-build.xml	2007-03-22 15:55:42 UTC (rev 10436)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld/base-build.xml	2007-03-22 16:10:52 UTC (rev 10437)
@@ -56,7 +56,6 @@
            <fileset dir="src" excludes="**/*.java" />
            <fileset dir="build" includes="META-INF/**" />
            <fileset dir="${basedir}" includes="jbm-queue-service.xml"/>
-           <fileset dir="./" includes="${additional.deploys}" />
         </jar>
 
         <copy file="build/${ant.project.name}.esb" overwrite="true" todir="${jbosshome.dir}/server/default/deploy/" />

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/base-build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/base-build.xml	2007-03-22 15:55:42 UTC (rev 10436)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/base-build.xml	2007-03-22 16:10:52 UTC (rev 10437)
@@ -55,7 +55,6 @@
            <fileset dir="src" excludes="**/*.java" />
            <fileset dir="build" includes="META-INF/**" />
            <fileset dir="${basedir}" includes="jbm-queue-service.xml"/>
-           <fileset dir="./" includes="${additional.deploys}" />
         </jar>
 
         <copy file="build/${ant.project.name}.esb" overwrite="true" todir="${jbosshome.dir}/server/default/deploy/" />

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml	2007-03-22 15:55:42 UTC (rev 10436)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_action/jboss-esb.xml	2007-03-22 16:10:52 UTC (rev 10437)
@@ -55,9 +55,8 @@
    	 				   <NotificationList type="OK"> 
       				     <target class="NotifyConsole" />
 				    	 <target class="NotifyQueues">
-				   	       <queue jndiName="queue/quickstart_helloworld_action_Response">
-					         	<messageProp name="quickstart" value="hello_world_action" />
-					       </queue> 
+				    	       <messageProp name="quickstart" value="hello_world_action" />
+				   	       <queue jndiName="queue/quickstart_helloworld_action_Response"/>
 			 	     	 </target>
 	    		   	   </NotificationList> 
 	    		   </property>




More information about the jboss-svn-commits mailing list