activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dflo...@apache.org
Subject svn commit: r399195 - in /incubator/activemq/trunk/activemq-jmeter: project.properties project.xml resource/messages.properties src/java/org/activemq/sampler/Consumer.java src/java/org/activemq/util/connection/ServerConnectionFactory.java
Date Wed, 03 May 2006 08:04:34 GMT
Author: dflores
Date: Wed May  3 01:04:31 2006
New Revision: 399195

URL: http://svn.apache.org/viewcvs?rev=399195&view=rev
Log:
Modified the version numbers for jar files with dependency error

Modified:
    incubator/activemq/trunk/activemq-jmeter/project.properties
    incubator/activemq/trunk/activemq-jmeter/project.xml
    incubator/activemq/trunk/activemq-jmeter/resource/messages.properties
    incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/sampler/Consumer.java
    incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/util/connection/ServerConnectionFactory.java

Modified: incubator/activemq/trunk/activemq-jmeter/project.properties
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jmeter/project.properties?rev=399195&r1=399194&r2=399195&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jmeter/project.properties (original)
+++ incubator/activemq/trunk/activemq-jmeter/project.properties Wed May  3 01:04:31 2006
@@ -55,7 +55,7 @@
 ApacheJMeter_version=1.0
 
 avalon_framework_version=4.1.4
-batik_awt_util_version=1.0
+batik_awt_util_version=1.6
 commons_collections_version=2.1
 commons_httpclient_version=2.0
 commons_logging_version=1.0.3
@@ -75,9 +75,9 @@
 soap_version=2.3.1
 Tidy_version=1.0
 velocity_version=1.4-dev
-xalan_version=1.0
+xalan_version=2.7.0
 xercesImpl_version=2.0.0
-xml_apis_version=1.0
+xml_apis_version=2.0.2
 xpp3_min_version=1.1.3.4.I
 xstream_version=1.1
 manta_version=1.0

Modified: incubator/activemq/trunk/activemq-jmeter/project.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jmeter/project.xml?rev=399195&r1=399194&r2=399195&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jmeter/project.xml (original)
+++ incubator/activemq/trunk/activemq-jmeter/project.xml Wed May  3 01:04:31 2006
@@ -482,7 +482,7 @@
 	    	<lib>true</lib>
             </properties>
         </dependency>
-        
+        <!--
         <dependency>
             <groupId>manta</groupId>
             <artifactId>manta</artifactId>
@@ -492,7 +492,7 @@
 	    	<lib>true</lib>
             </properties>
         </dependency> 
-                
+        -->
     </dependencies>
     
    <build>

Modified: incubator/activemq/trunk/activemq-jmeter/resource/messages.properties
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jmeter/resource/messages.properties?rev=399195&r1=399194&r2=399195&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jmeter/resource/messages.properties (original)
+++ incubator/activemq/trunk/activemq-jmeter/resource/messages.properties Wed May  3 01:04:31
2006
@@ -32,6 +32,8 @@
 jbossmq_server=JBossMQ Server
 openjms_server=OpenJMS Server
 joram_server=Joram Server
+swiftmq_server=SwiftMQ Server
+websphere_server=WebsphereMQ Server
 mantaray_server=Mantaray
 form_msg_interval=Message Interval
 form_default_msg_interval=Default

Modified: incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/sampler/Consumer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/sampler/Consumer.java?rev=399195&r1=399194&r2=399195&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/sampler/Consumer.java (original)
+++ incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/sampler/Consumer.java Wed
May  3 01:04:31 2006
@@ -24,7 +24,7 @@
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
-import org.mr.MantaAgent;
+//import org.mr.MantaAgent;
 
 import javax.jms.Connection;
 import javax.jms.Session;
@@ -45,6 +45,7 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Properties;
+import java.lang.reflect.Method;
 
 public class Consumer extends Sampler implements MessageListener {
 
@@ -185,10 +186,11 @@
         } else if (ServerConnectionFactory.MANTARAY_SERVER.equals(this.getMQServer())) {
             if (this.getTopic()) {
                 Topic topic = (Topic) destination;
-
+Class s = mantaAgent();
+System.out.println("CLASS = " + s);
                 if (this.getDurable()) {
-                    consumer = ((TopicSession) session).createDurableSubscriber(topic,
-                                   MantaAgent.getInstance().getAgentName());
+//                    consumer = ((TopicSession) session).createDurableSubscriber(topic,
+//                                   s.getInstance().getAgentName());
                 } else {
                     consumer = ((TopicSession) session).createSubscriber(topic);
                 }
@@ -224,6 +226,34 @@
         consumer.setMessageListener(this);
         addResource(consumer);
     }
+
+    public static Class mantaAgent() {
+        String name = "org.mr.api.MantaAgent";
+
+        Class type = loadClass(name, ServerConnectionFactory.class.getClassLoader());
+System.out.println("cons TYPE = " + type);
+        if (type != null) {
+            return (Class) type;
+        } else {
+            System.out.println("Class not found: " + name);
+        }
+        return null;
+    }
+
+    private static Class loadClass(String name, ClassLoader loader) {
+        try {
+            return loader.loadClass(name);
+        }
+        catch (ClassNotFoundException e) {
+            try {
+                return Thread.currentThread().getContextClassLoader().loadClass(name);
+            }
+            catch (ClassNotFoundException e1) {
+                return null;
+            }
+        }
+    }
+
 
     /**
      *  Processes the received message.

Modified: incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/util/connection/ServerConnectionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/util/connection/ServerConnectionFactory.java?rev=399195&r1=399194&r2=399195&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/util/connection/ServerConnectionFactory.java
(original)
+++ incubator/activemq/trunk/activemq-jmeter/src/java/org/activemq/util/connection/ServerConnectionFactory.java
Wed May  3 01:04:31 2006
@@ -18,6 +18,7 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.Properties;
 
 import javax.jms.Connection;
@@ -41,8 +42,8 @@
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jmeter.testelement.TestElement;
-import org.mr.api.jms.MantaQueueConnectionFactory;
-import org.mr.api.jms.MantaTopicConnectionFactory;
+//import org.mr.api.jms.MantaQueueConnectionFactory;
+//import org.mr.api.jms.MantaTopicConnectionFactory;
 
 /**
  * Provides static methods for creating Session and Destination objects.
@@ -60,6 +61,7 @@
     public static final String JORAM_NAMING_PORT = JMeterUtils.getResString("joram_naming_port");
     public static final String MANTARAY_SERVER = JMeterUtils.getResString("mantaray_server");
     public static final String SWIFTMQ_SERVER = JMeterUtils.getResString("swiftmq_server");
+    public static final String WEBSPHEREMQ_SERVER = JMeterUtils.getResString("webspheremq_server");
 
     // For testing within IntelliJ running main()
     /*
@@ -93,6 +95,11 @@
     public static final String SMQP = "com.swiftmq.jms.smqp";
     public static final String NAMING_HOST = "java.naming.factory.host";
     public static final String NAMING_PORT = "java.naming.factory.post";
+    //public static final String WEBSPHEREMQ_CONTEXT = "com.sun.jndi.ldap.LdapCtxFactory";
+    //public static final String WEBSPHEREMQ_CONTEXT = "com.sun.jndi.fscontext.RefFSContextFactory";
+    //public static final String WEBSPHEREMQ_CONTEXT = "com.ibm.ejs.ns.jndi.CNInitialContextFactory";
+    public static final String WEBSPHEREMQ_CONTEXT = "com.ibm.websphere.naming.WsnInitialContextFactory";
+    public static final String WEBSPHEREMQ_CONNECTION_FACTORY = "com.ibm.mq.jms.MQConnectionFactory";
 
     public static Topic topicContext;
 
@@ -129,7 +136,7 @@
                                                      String mqServer,
                                                      boolean isTopic,
                                                      boolean isAsync) throws JMSException
{
-
+System.out.println("PARAM = " + url + "/" + mqServer + "/" + isTopic + "/" + isAsync);
        if (SONICMQ_SERVER.equals(mqServer)) {
             //Creates a Connection object for a SONIC MQ server.
             if (isTopic) {
@@ -192,14 +199,14 @@
         } else if (MANTARAY_SERVER.equals(mqServer)) {
             //Creates a Connection object for a Mantaray.
             System.setProperty("mantaHome",url);
-
+            ConnectionFactory cf = findMantaCF(isTopic);
             if (isTopic) {
-                TopicConnectionFactory factory = (TopicConnectionFactory) new MantaTopicConnectionFactory();
+                TopicConnectionFactory factory = (TopicConnectionFactory) cf;
 
                 return factory.createTopicConnection();
 
             } else {
-                QueueConnectionFactory factory = (QueueConnectionFactory) new MantaQueueConnectionFactory();
+                QueueConnectionFactory factory = (QueueConnectionFactory) cf;
 
                 return factory.createQueueConnection();
 
@@ -210,13 +217,11 @@
                 Context ictx = getInitialContext(url, SWIFTMQ_SERVER);
                 if (isTopic){
                     TopicConnectionFactory tcf = (TopicConnectionFactory) ictx.lookup("TopicConnectionFactory");
-//                    Topic topic = (Topic) ictx.lookup("testtopic");
                     ictx.close();
                     TopicConnection connection = tcf.createTopicConnection();
                     return connection;
                 } else {
                     QueueConnectionFactory qcf = (QueueConnectionFactory) ictx.lookup("QueueConnectionFactory");
-//                    Queue queue = (Queue) ictx.lookup("testqueue");
                     ictx.close();
                     QueueConnection connection = qcf.createQueueConnection();
                     return connection;
@@ -224,6 +229,29 @@
             } catch (NamingException e) {
                 throw new JMSException("Error creating InitialContext ", e.toString());
             }
+        }else if (WEBSPHEREMQ_SERVER.equals(mqServer)) {
+            //Creates a Connection object for a SwiftMQ server.
+System.out.println("SERVER IS WEBSPHERE");
+            try {
+                Context ictx = getInitialContext(url, WEBSPHEREMQ_SERVER);
+System.out.println("CONTEXT = " + ictx);
+/*                if (isTopic){
+                    TopicConnectionFactory tcf = (TopicConnectionFactory) ictx.lookup("MQConnectionFactory");
+                    ictx.close();
+                    TopicConnection connection = tcf.createTopicConnection();
+System.out.println("CONN = " + connection);
+                    return connection;
+                } else {
+                    QueueConnectionFactory qcf = (QueueConnectionFactory) ictx.lookup("MQConnectionFactory");
+                    ictx.close();
+                    QueueConnection connection = qcf.createQueueConnection();
+                    return connection;
+                }  */
+                return null;//temp return val only
+            } catch (Exception e) { //orig is NamingException
+e.printStackTrace();
+                throw new JMSException("Error creating InitialContext ", e.toString());
+            }
         } else {
             //Used to create a session from the default MQ server ActiveMQConnectionFactory.
             ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);
@@ -445,11 +473,17 @@
             properties.put(Context.INITIAL_CONTEXT_FACTORY, SONICMQ_CONTEXT);
             properties.put(Context.PROVIDER_URL, url);
 
+        } else if (WEBSPHEREMQ_SERVER.equals(mqServer)) {
+            //Creates a Context object for WEBSPHEREMQ server
+            properties.put(Context.INITIAL_CONTEXT_FACTORY, WEBSPHEREMQ_CONTEXT);
+            properties.put(Context.PROVIDER_URL, url);
+System.out.println("PROPS = " + properties);
         }
 
         try {
             return new InitialContext(properties);
         } catch (NamingException e) {
+e.printStackTrace();
             throw new JMSException("Error creating InitialContext ", e.toString());
         }
     }
@@ -462,6 +496,38 @@
      */
     private static String getHost(String url) {
         return url.substring(url.lastIndexOf("/") + 1, url.lastIndexOf(":"));
+    }
+
+    public static ConnectionFactory findMantaCF(boolean isTopic) {
+        String name = null;
+        if (isTopic) {
+            name = "org.mr.api.jms.MantaTopicConnectionFactory";
+        } else {
+            name = "org.mr.api.jms.MantaQueueConnectionFactory";
+        }
+        Class type = loadClass(name, ServerConnectionFactory.class.getClassLoader());
+System.out.println("SCF type = " + type);
+        if (type != null) {
+            Object obj = type;
+            return (ConnectionFactory) obj;
+        } else {
+            System.out.println("Connection Factory not found: " + name);
+        }
+        return null;
+    }
+
+    private static Class loadClass(String name, ClassLoader loader) {
+        try {
+            return loader.loadClass(name);
+        }
+        catch (ClassNotFoundException e) {
+            try {
+                return Thread.currentThread().getContextClassLoader().loadClass(name);
+            }
+            catch (ClassNotFoundException e1) {
+                return null;
+            }
+        }
     }
 
 }



Mime
View raw message