cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1204987 - in /cxf/trunk/distribution/src/main/release/samples/ruby_spring_support: ./ src/main/java/demo/spring/ src/main/java/demo/spring/client/ src/main/java/demo/spring/service/ src/main/java/demo/spring/servlet/ src/main/resources/ sr...
Date Tue, 22 Nov 2011 13:29:37 GMT
Author: gmazza
Date: Tue Nov 22 13:29:36 2011
New Revision: 1204987

URL: http://svn.apache.org/viewvc?rev=1204987&view=rev
Log:
Better Mavenized Ruby sample, switched to common ../etc/web.xml file

Added:
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/HelloWorld.java
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/Server.java
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/HelloWorldImpl.rb
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/client-beans.xml
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/webapp/
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/webapp/WEB-INF/
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
Removed:
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/HelloWorld.java
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/HelloWorldImpl.rb
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/client/client-beans.xml
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/servlet/
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/webapp/
Modified:
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/README.txt
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/pom.xml
    cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/client/Client.java

Modified: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/README.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/README.txt?rev=1204987&r1=1204986&r2=1204987&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/README.txt (original)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/README.txt Tue Nov
22 13:29:36 2011
@@ -1,6 +1,7 @@
 Ruby script demo
 =================
-This example shows how to create a Ruby web service implemented with Spring. 
+This example shows how to create a Ruby web service implemented with CXF
+using Spring configuration. 
 
 
 Building and running the demo using Maven
@@ -8,7 +9,7 @@ Building and running the demo using Mave
 From the base directory of this example (i.e., where this README file is
 located), the Maven pom.xml file can be used to build and run the demo.
 
-Using either UNIX or Windows:
+Using either Unix or Windows:
 
   mvn -Pserver  (from one command line window)
   mvn -Pclient  (from a second command line window)

Modified: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/pom.xml?rev=1204987&r1=1204986&r2=1204987&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/pom.xml Tue Nov 22
13:29:36 2011
@@ -55,25 +55,8 @@
                     <target>1.5</target>
                 </configuration>
             </plugin>
-            <plugin>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>prepare-transform</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <configuration>
-                            <tasks>
-                                <copy file="${basedir}/src/main/java/demo/spring/HelloWorldImpl.rb"
todir="${basedir}/target/classes/demo/spring" />
-                                <copy file="${basedir}/src/main/java/demo/spring/client/client-beans.xml"
todir="${basedir}/target/classes/demo/spring/client" />
-                            </tasks>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
+        <finalName>RubySpringSupport</finalName>
     </build>
     <profiles>
         <profile>
@@ -91,7 +74,7 @@
                                     <goal>java</goal>
                                 </goals>
                                 <configuration>
-                                    <mainClass>demo.spring.servlet.Server</mainClass>
+                                    <mainClass>demo.spring.service.Server</mainClass>
                                 </configuration>
                             </execution>
                         </executions>

Modified: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/client/Client.java?rev=1204987&r1=1204986&r2=1204987&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/client/Client.java
(original)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/client/Client.java
Tue Nov 22 13:29:36 2011
@@ -18,10 +18,9 @@
  */
 package demo.spring.client;
 
-
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-import demo.spring.HelloWorld;
+import demo.spring.service.HelloWorld;
 
 
 public final class Client {
@@ -32,7 +31,7 @@ public final class Client {
     public static void main(String args[]) throws Exception {
         // START SNIPPET: client
         ClassPathXmlApplicationContext context 
-            = new ClassPathXmlApplicationContext(new String[] {"demo/spring/client/client-beans.xml"});
+            = new ClassPathXmlApplicationContext(new String[] {"client-beans.xml"});
 
         HelloWorld client = (HelloWorld)context.getBean("client");
 

Added: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/HelloWorld.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/HelloWorld.java?rev=1204987&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/HelloWorld.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/HelloWorld.java
Tue Nov 22 13:29:36 2011
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// START SNIPPET: service
+package demo.spring.service;
+
+import javax.jws.WebService;
+
+@WebService
+public interface HelloWorld {
+    String sayHi(String text);
+}
+// END SNIPPET: service

Added: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/Server.java?rev=1204987&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/Server.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/java/demo/spring/service/Server.java
Tue Nov 22 13:29:36 2011
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.spring.service;
+
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.webapp.WebAppContext;
+
+public class Server {
+
+    protected Server() throws Exception {
+        System.out.println("Starting Server");
+
+        /**
+         * Important: This code simply starts up a servlet container and adds
+         * the web application in src/webapp to it. Normally you would be using
+         * Jetty or Tomcat and have the webapp packaged as a WAR. This is simply
+         * as a convenience so you do not need to configure your servlet
+         * container to see CXF in action!
+         */
+        org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server();
+
+        SelectChannelConnector connector = new SelectChannelConnector();
+        connector.setPort(9002);
+        server.setConnectors(new Connector[] {connector});
+
+        WebAppContext webappcontext = new WebAppContext();
+        webappcontext.setContextPath("/");
+
+        webappcontext.setWar("target/RubySpringSupport.war");
+
+        HandlerCollection handlers = new HandlerCollection();
+        handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
+
+        server.setHandler(handlers);
+        server.start();
+        System.out.println("Server ready...");
+        server.join();
+    }
+
+    public static void main(String args[]) throws Exception {
+        new Server();
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/HelloWorldImpl.rb
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/HelloWorldImpl.rb?rev=1204987&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/HelloWorldImpl.rb
(added)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/HelloWorldImpl.rb
Tue Nov 22 13:29:36 2011
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# 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
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+require 'java'
+
+include_class 'demo.spring.service.HelloWorld'
+
+class HelloWorldImpl
+  
+  def sayHi(message)
+    return  "Hello " + message
+  end
+
+end
+
+HelloWorldImpl.new

Added: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/client-beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/client-beans.xml?rev=1204987&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/client-beans.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/resources/client-beans.xml
Tue Nov 22 13:29:36 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one
+	or more contributor license agreements. See the NOTICE file
+	distributed with this work for additional information
+	regarding copyright ownership. The ASF licenses this file
+	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
+	KIND, either express or implied. See the License for the
+	specific language governing permissions and limitations
+	under the License.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:simple="http://cxf.apache.org/simple"
+	xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">
+
+    <bean id="client" class="demo.spring.service.HelloWorld" 
+      factory-bean="clientFactory" factory-method="create"/>
+    
+	<bean id="clientFactory" class="org.apache.cxf.frontend.ClientProxyFactoryBean">
+	  <property name="serviceClass" value="demo.spring.service.HelloWorld"/>
+	  <property name="address" value="http://localhost:9002/services/HelloWorld"/>
+	</bean>
+	  
+</beans>
+<!-- END SNIPPET: beans -->

Added: cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml?rev=1204987&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/ruby_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
Tue Nov 22 13:29:36 2011
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  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
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:simple="http://cxf.apache.org/simple"
+  xmlns:lang="http://www.springframework.org/schema/lang"
+  xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
+http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">
+
+    <import resource="classpath:META-INF/cxf/cxf.xml" />
+    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+    <lang:jruby id="helloworldImpl" script-source="classpath:HelloWorldImpl.rb" script-interfaces="demo.spring.service.HelloWorld"
scope="prototype">
+    </lang:jruby>
+
+    <simple:server id="pojoservice"  serviceClass="demo.spring.service.HelloWorld"  address="/HelloWorld">
+
+        <simple:serviceBean>
+            <ref bean="helloworldImpl" />
+        </simple:serviceBean>
+    </simple:server>
+  
+
+</beans>
+<!-- END SNIPPET: beans -->



Mime
View raw message