cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [4/5] cxf git commit: CXF-6187 Adding jndiURL
Date Mon, 26 Jan 2015 10:23:20 GMT
CXF-6187 Adding jndiURL


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1d9eda92
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1d9eda92
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1d9eda92

Branch: refs/heads/3.0.x-fixes
Commit: 1d9eda92abf428ba55fffdb6c13b19df2c57d82e
Parents: 592cd43
Author: Christian Schneider <chris@die-schneider.net>
Authored: Fri Jan 23 18:12:47 2015 +0100
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Mon Jan 26 10:42:23 2015 +0100

----------------------------------------------------------------------
 .../src/main/java/demo/client/ClientJMS.java    |  3 +-
 .../src/main/java/demo/server/ServerJMS.java    | 43 ++++++++++++--------
 2 files changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1d9eda92/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java
b/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java
index 43ecb89..86b16b9 100644
--- a/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java
+++ b/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java
@@ -30,7 +30,8 @@ import demo.service.HelloWorld;
 public final class ClientJMS {
     private static final String JMS_ENDPOINT_URI = "jms:queue:test.cxf.jmstransport.queue?timeToLive=1000"
                                + "&jndiConnectionFactoryName=ConnectionFactory" + "&jndiInitialContextFactory"
-                               + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory";
+                               + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+                               + "&jndiURL=tcp://localhost:61616";
 
     private static final QName SERVICE_QNAME =
         new QName("http://impl.service.demo/", "HelloWorldImplService");

http://git-wip-us.apache.org/repos/asf/cxf/blob/1d9eda92/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/server/ServerJMS.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/server/ServerJMS.java
b/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/server/ServerJMS.java
index 6d03861..8da3b9f 100644
--- a/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/server/ServerJMS.java
+++ b/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/server/ServerJMS.java
@@ -19,6 +19,7 @@
 
 package demo.server;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import javax.xml.ws.Endpoint;
@@ -34,7 +35,8 @@ public final class ServerJMS {
     private static final String JMS_ENDPOINT_URI = "jms:queue:test.cxf.jmstransport.queue?timeToLive=1000"
                                   + "&jndiConnectionFactoryName=ConnectionFactory"
                                   + "&jndiInitialContextFactory"
-                                  + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory";
+                                  + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+                                  + "&jndiURL=tcp://localhost:61616";
 
     private ServerJMS() {
         //
@@ -55,23 +57,7 @@ public final class ServerJMS {
         }
 
         if (launchAmqBroker) {
-            /*
-             * The following make it easier to run this against something other than ActiveMQ.
You will have
-             * to get a JMS broker onto the right port of localhost.
-             */
-            Class<?> brokerClass = ServerJMS.class.getClassLoader()
-                .loadClass("org.apache.activemq.broker.BrokerService");
-            if (brokerClass == null) {
-                System.err.println("ActiveMQ is not in the classpath, cannot launch broker.");
-                return;
-            }
-            Object broker = brokerClass.newInstance();
-            Method addConnectorMethod = brokerClass.getMethod("addConnector", String.class);
-            addConnectorMethod.invoke(broker, "tcp://localhost:61616");
-            Method setDataDirectory = brokerClass.getMethod("setDataDirectory", String.class);
-            setDataDirectory.invoke(broker, "target/activemq-data");
-            Method startMethod = brokerClass.getMethod("start");
-            startMethod.invoke(broker);
+            launchAMQBroker();
         }
 
         if (jaxws) {
@@ -86,6 +72,27 @@ public final class ServerJMS {
         System.exit(0);
     }
 
+    private static void launchAMQBroker() throws ClassNotFoundException, InstantiationException,
+        IllegalAccessException, NoSuchMethodException, InvocationTargetException {
+        /*
+         * The following make it easier to run this against something other than ActiveMQ.
You will have
+         * to get a JMS broker onto the right port of localhost.
+         */
+        Class<?> brokerClass = ServerJMS.class.getClassLoader()
+            .loadClass("org.apache.activemq.broker.BrokerService");
+        if (brokerClass == null) {
+            System.err.println("ActiveMQ is not in the classpath, cannot launch broker.");
+            return;
+        }
+        Object broker = brokerClass.newInstance();
+        Method addConnectorMethod = brokerClass.getMethod("addConnector", String.class);
+        addConnectorMethod.invoke(broker, "tcp://localhost:61616");
+        Method setDataDirectory = brokerClass.getMethod("setDataDirectory", String.class);
+        setDataDirectory.invoke(broker, "target/activemq-data");
+        Method startMethod = brokerClass.getMethod("start");
+        startMethod.invoke(broker);
+    }
+
     private static void launchCxfApi() {
         Object implementor = new HelloWorldImpl();
         JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();


Mime
View raw message