You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2010/08/31 01:56:38 UTC

svn commit: r991036 - in /cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms: pom.xml src/main/java/demo/client/ClientJMS.java src/main/java/demo/server/ServerJMS.java src/main/resources/cxf.xml

Author: bimargulies
Date: Mon Aug 30 23:56:38 2010
New Revision: 991036

URL: http://svn.apache.org/viewvc?rev=991036&view=rev
Log:
This version actually works.

Modified:
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/pom.xml
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/client/ClientJMS.java
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/server/ServerJMS.java
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/resources/cxf.xml

Modified: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/pom.xml?rev=991036&r1=991035&r2=991036&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/pom.xml Mon Aug 30 23:56:38 2010
@@ -7,9 +7,9 @@
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License. You may obtain a copy of the License at
- 
+
   http://www.apache.org/licenses/LICENSE-2.0
- 
+
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -62,6 +62,9 @@
                                 </goals>
                                 <configuration>
                                     <mainClass>demo.server.ServerJMS</mainClass>
+                                    <arguments>
+                                    	<argument>-activemqbroker</argument>
+                                    </arguments>
                                 </configuration>
                             </execution>
                         </executions>

Modified: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/client/ClientJMS.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/client/ClientJMS.java?rev=991036&r1=991035&r2=991036&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/client/ClientJMS.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/client/ClientJMS.java Mon Aug 30 23:56:38 2010
@@ -19,7 +19,6 @@
 
 package demo.client;
 
-import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 
 import demo.service.HelloWorld;
@@ -27,10 +26,7 @@ import demo.service.HelloWorld;
 public final class ClientJMS {
 
 	public static void main(String[] args) throws Exception {
-		//Bus bus = new SpringBusFactory().createBus("jms.xml");
 		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
-        factory.getInInterceptors().add(new LoggingInInterceptor());
-        factory.getOutInterceptors().add(new LoggingInInterceptor());
     	factory.setServiceClass(HelloWorld.class);
     	factory.setAddress("jms://");
     	HelloWorld client = (HelloWorld) factory.create();

Modified: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/server/ServerJMS.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/server/ServerJMS.java?rev=991036&r1=991035&r2=991036&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/server/ServerJMS.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/java/demo/server/ServerJMS.java Mon Aug 30 23:56:38 2010
@@ -19,7 +19,8 @@
 
 package demo.server;
 
-import org.apache.cxf.interceptor.LoggingInInterceptor;
+import java.lang.reflect.Method;
+
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 
 import demo.service.HelloWorld;
@@ -28,15 +29,32 @@ import demo.service.impl.HelloWorldImpl;
 public class ServerJMS {
 
     public static void main(String args[]) throws Exception {
+
+    	boolean amqBroker = args.length > 0 && "-activemqbroker".equals(args[0]);
+    	if (amqBroker) {
+    	    /*
+    	     * 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 startMethod = brokerClass.getMethod("start");
+    		startMethod.invoke(broker);
+    	}
+
     	Object implementor = new HelloWorldImpl();
     	JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
         svrFactory.setServiceClass(HelloWorld.class);
         svrFactory.setAddress("jms://");
         svrFactory.setServiceBean(implementor);
-        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
-        svrFactory.getOutInterceptors().add(new LoggingInInterceptor());
         svrFactory.create();
-        
+
         System.out.println("Server ready... Press any key to exit");
         System.in.read();
         System.out.println("Server exiting");

Modified: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/resources/cxf.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/resources/cxf.xml?rev=991036&r1=991035&r2=991036&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/resources/cxf.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_jms/src/main/resources/cxf.xml Mon Aug 30 23:56:38 2010
@@ -17,15 +17,9 @@
 	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
-	
-	<cxf:bus>
-        <cxf:features>
-            <cxf:logging/>
-        </cxf:features>
-    </cxf:bus> 
 
 	<jms:conduit
-		name="{http://service.test/}HelloWorldPort.jms-conduit">
+		name="{http://service.demo/}HelloWorldPort.jms-conduit">
 		<!--
 		<jms:clientConfig clientReceiveTimeout="500"
 			messageTimeToLive="500" />
@@ -42,10 +36,10 @@
 				value="tcp://localhost:61616" />
 		</jms:address>
 	</jms:conduit>
-	
+
 	<jms:destination
-		name="{http://service.test/}HelloWorldPort.jms-destination">
-		<!-- 
+		name="{http://service.demo/}HelloWorldPort.jms-destination">
+		<!--
 		<jms:clientConfig clientReceiveTimeout="500"
 			messageTimeToLive="500" />
 		<jms:runtimePolicy messageType="binary" />