Author: blin
Date: Thu Aug 16 20:45:20 2007
New Revision: 566910
URL: http://svn.apache.org/viewvc?view=rev&rev=566910
Log:
[CXF-902] Apply Jeff's patch for java first sample - Thanks, Jeff.
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/README.txt
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/build.xml
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorld.java
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorldImpl.java
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/Server.java
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/wsdl/
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/wsdl/cxf-servlet.xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/README.txt
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/README.txt?view=auto&rev=566910
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/README.txt
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/README.txt
Thu Aug 16 20:45:20 2007
@@ -0,0 +1,161 @@
+Java First POJO DEMO
+=============================================
+
+This demo illustrates how to develop a service use the "code first", pojo
based.
+This demo uses the JAXB Data binding by default, but you can use Aegis Data
binding by
+uncomment below four lines:
+
+(Client.java)
+//import org.apache.cxf.aegis.databinding.AegisDatabinding;
+//factory.getServiceFactory().setDataBinding(new AegisDatabinding());
+
+(Server.java)
+//import org.apache.cxf.aegis.databinding.AegisDatabinding;
+//svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
+
+Prerequisite
+------------
+
+If your environment already includes cxf-manifest-incubator.jar on the
+CLASSPATH, and the JDK and ant bin directories on the PATH
+it is not necessary to set the environment as described in
+the samples directory README. If your environment is not
+properly configured, or if you are planning on using wsdl2java,
+javac, and java to build and run the demos, you must set the
+environment.
+
+
+
+Building and running the demo using Ant
+---------------------------------------
+From the base directory of this sample (i.e., where this README file is
+located), the Ant build.xml file can be used to build and run the demo.
+The server and client targets automatically build the demo.
+
+Using either UNIX or Windows:
+
+ ant server (from one command line window)
+ ant client (from a second command line window)
+
+
+To remove the code generated from the WSDL file and the .class
+files, run "ant clean"
+
+
+
+Building the demo using javac
+-------------------------------------------
+
+From the samples/java_first_pojo directory, first create the target
+directory build/classes.
+
+For UNIX:
+ mkdir -p build/classes
+
+For Windows:
+ mkdir build\classes
+ Must use back slashes.
+
+Now compile the provided client and server applications with the commands:
+
+For UNIX:
+
+ export
CLASSPATH=$CLASSPATH:$CXF_HOME/lib/cxf-manifest-incubator.jar:./build/classes
+ javac -d build/classes src/demo/hw/client/*.java
+ javac -d build/classes src/demo/hw/server/*.java
+
+For Windows:
+ set
classpath=%classpath%;%CXF_HOME%\lib\cxf-manifest-incubator.jar;.\build\classes
+ javac -d build\classes src\demo\hw\client\*.java
+ javac -d build\classes src\demo\hw\server\*.java
+
+
+
+Running the demo using java
+---------------------------
+
+From the samples/java_first_pojo directory run the commands, entered on a
+single command line:
+
+For UNIX (must use forward slashes):
+ java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+ demo.hw.server.Server &
+
+ java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+ demo.hw.client.Client
+
+The server process starts in the background. After running the client,
+use the kill command to terminate the server process.
+
+For Windows (may use either forward or back slashes):
+ start
+ java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+ demo.hw.server.Server
+
+ java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+ demo.hw.client.Client
+
+A new command windows opens for the server process. After running the
+client, terminate the server process by issuing Ctrl-C in its command window.
+
+To remove the code generated from the WSDL file and the .class
+files, either delete the build directory and its contents or run:
+
+ ant clean
+
+
+
+Building and running the demo in a servlet container
+----------------------------------------------------
+
+From the samples/java_first_pojo directory, the ant build script
+can be used to create the war file that is deployed into the
+servlet container.
+
+Build the war file with the command:
+
+ ant war
+
+Preparing deploy to APACHE TOMCAT
+
+* set CATALINA_HOME environment to your TOMCAT home directory
+
+Deploy the application into APACHE TOMCAT with the commond:
+[NOTE] This step will check if the cxf jars present in Tomcat,
+ if not, it will automatically copy all the jars into
CATALINA_HOME/shared/lib
+
+ ant deploy -Dtomcat=true
+
+The servlet container will extract the war and deploy the application.
+
+
+Using ant, run the client application with the command:
+
+ ant client-servlet -Dbase.url=http://localhost:#
+
+Where # is the TCP/IP port used by the servlet container,
+e.g., 8080.
+
+Or
+ ant client-servlet -Dhost=localhost -Dport=8080
+
+You can ignore the -Dhost and -Dport if your tomcat setup is same, i.e ant
client-servlet
+
+Using java, run the client application with the command:
+
+ For UNIX:
+
+ java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+ demo.hw.client.Client
http://localhost:#/helloworld/services/hello_world
+
+ For Windows:
+
+ java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+ demo.hw.client.Client http://localhost:#/helloworld/services/hello_world
+
+Where # is the TCP/IP port used by the servlet container,
+e.g., 8080.
+
+Undeploy the application from the APACHE TOMCAT with the command:
+
+ ant undeploy -Dtomcat=true
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/build.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/build.xml?view=auto&rev=566910
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/build.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/build.xml
Thu Aug 16 20:45:20 2007
@@ -0,0 +1,42 @@
+<?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.
+-->
+<project name="java first pojo demo" default="build" basedir=".">
+
+ <import file="../common_build.xml"/>
+
+ <target name="client" description="run demo client" depends="build">
+ <property name="param" value=""/>
+ <cxfrun classname="demo.hw.client.Client"/>
+ </target>
+
+ <target name="server" description="run demo server" depends="build">
+ <cxfrun classname="demo.hw.server.Server"/>
+ </target>
+
+ <property name="cxf.war.file.name" value="helloworld"/>
+ <target name="war" depends="build">
+ <cxfwar wsdl="hello_world.wsdl" filename="${cxf.war.file.name}.war"/>
+ </target>
+
+ <target name="client-servlet" description="run demo client hitting
servlet" depends="build">
+ <property name="param" value=""/>
+ <cxfrun classname="demo.hw.client.Client"
param1="${base.url}/helloworld/services/hello_world" param2="${op}"
param3="${param}"/>
+ </target>
+</project>
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java?view=auto&rev=566910
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java
Thu Aug 16 20:45:20 2007
@@ -0,0 +1,46 @@
+/**
+ * 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.hw.client;
+
+import demo.hw.server.HelloWorld;
+//import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+
+public final class Client {
+
+ private Client() {
+ }
+
+ public static void main(String args[]) throws Exception {
+ ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
+ factory.setServiceClass(HelloWorld.class);
+ if (args != null && args.length > 0) {
+ factory.setAddress(args[0]);
+ } else {
+ factory.setAddress("http://localhost:9000/Hello");
+ }
+ //factory.getServiceFactory().setDataBinding(new AegisDatabinding());
+ HelloWorld client = (HelloWorld)factory.create();
+ System.out.println("Invoke sayHi()....");
+ System.out.println(client.sayHi("user"));
+ System.exit(0);
+ }
+
+}
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorld.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorld.java?view=auto&rev=566910
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorld.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorld.java
Thu Aug 16 20:45:20 2007
@@ -0,0 +1,26 @@
+/**
+ * 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.hw.server;
+
+public interface HelloWorld {
+
+ String sayHi(String text);
+
+}
+
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorldImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorldImpl.java?view=auto&rev=566910
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorldImpl.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/HelloWorldImpl.java
Thu Aug 16 20:45:20 2007
@@ -0,0 +1,27 @@
+/**
+ * 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.hw.server;
+
+public class HelloWorldImpl implements HelloWorld {
+
+ public String sayHi(String text) {
+ return "Hello " + text;
+ }
+}
+
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/Server.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/Server.java?view=auto&rev=566910
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/Server.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/server/Server.java
Thu Aug 16 20:45:20 2007
@@ -0,0 +1,45 @@
+/**
+ * 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.hw.server;
+
+//import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.frontend.ServerFactoryBean;
+
+public class Server {
+
+ protected Server() throws Exception {
+ HelloWorldImpl helloworldImpl = new HelloWorldImpl();
+ ServerFactoryBean svrFactory = new ServerFactoryBean();
+ svrFactory.setServiceClass(HelloWorld.class);
+ svrFactory.setAddress("http://localhost:9000/Hello");
+ svrFactory.setServiceBean(helloworldImpl);
+ //svrFactory.getServiceFactory().setDataBinding(new
AegisDatabinding());
+ svrFactory.create();
+ }
+
+ public static void main(String args[]) throws Exception {
+ new Server();
+ System.out.println("Server ready...");
+
+ Thread.sleep(5 * 60 * 1000);
+ System.out.println("Server exiting");
+ System.exit(0);
+ }
+}
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/wsdl/cxf-servlet.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/wsdl/cxf-servlet.xml?view=auto&rev=566910
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/wsdl/cxf-servlet.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/wsdl/cxf-servlet.xml
Thu Aug 16 20:45:20 2007
@@ -0,0 +1,34 @@
+<?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.
+-->
+<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:soap="http://cxf.apache.org/bindings/soap"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
+http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">
+
+ <simple:server id="pojoservice" serviceClass="demo.hw.server.HelloWorld"
address="/hello_world">
+ <simple:serviceBean>
+ <bean class="demo.hw.server.HelloWorldImpl" />
+ </simple:serviceBean>
+ </simple:server>
+</beans>