You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/11/20 01:12:42 UTC

svn commit: r719137 - in /servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources: META-INF/maven/ archetype-resources/ archetype-resources/src/main/java/client/

Author: ffang
Date: Wed Nov 19 16:12:42 2008
New Revision: 719137

URL: http://svn.apache.org/viewvc?rev=719137&view=rev
Log:
[SMX4-160]Create a default client for the servicemix-osgi-cxf-code-first-archetype so that you can run this against the deployed bundle.

Added:
    servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/
    servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/Client.java   (with props)
Modified:
    servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/META-INF/maven/archetype.xml
    servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/pom.xml

Modified: servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/META-INF/maven/archetype.xml
URL: http://svn.apache.org/viewvc/servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/META-INF/maven/archetype.xml?rev=719137&r1=719136&r2=719137&view=diff
==============================================================================
--- servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/META-INF/maven/archetype.xml (original)
+++ servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/META-INF/maven/archetype.xml Wed Nov 19 16:12:42 2008
@@ -28,8 +28,10 @@
   	<source>src/main/java/types/GetPersonResponse.java</source>
   	<source>src/main/java/types/ObjectFactory.java</source>
   	<source>src/main/java/types/package-info.java</source>
-  	<source>src/main/java/types/UnknownPersonFault.java</source>
+        <source>src/main/java/types/UnknownPersonFault.java</source>
+        <source>src/main/java/client/Client.java</source>
   </sources>
+
   <resources>
     <resource>src/main/resources/META-INF/spring/beans.xml</resource>
   </resources>

Modified: servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/pom.xml?rev=719137&r1=719136&r2=719137&view=diff
==============================================================================
--- servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/pom.xml (original)
+++ servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/pom.xml Wed Nov 19 16:12:42 2008
@@ -37,29 +37,40 @@
             <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
             <version>@{geronimo.wsmetadata.version}</version>
         </dependency>
-		<dependency>
-			<groupId>javax.xml.bind</groupId>
-			<artifactId>jaxb-api</artifactId>
-			<version>@{jaxb.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.xml.ws</groupId>
-			<artifactId>jaxws-api</artifactId>
-			<version>@{jaxws.version}</version>
-		</dependency>
+	<dependency>
+		<groupId>javax.xml.bind</groupId>
+		<artifactId>jaxb-api</artifactId>
+		<version>@{jaxb.version}</version>
+	</dependency>
+	<dependency>
+		<groupId>javax.xml.ws</groupId>
+		<artifactId>jaxws-api</artifactId>
+		<version>@{jaxws.version}</version>
+        </dependency>
+        <!-- Needed for Client -->
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>@{cxf-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>@{cxf-version}</version>
+        </dependency> 
     </dependencies>
 
     <build>
     	<defaultGoal>install</defaultGoal>
         <plugins>
-			<plugin>
-			  <groupId>org.apache.maven.plugins</groupId>
-			  <artifactId>maven-compiler-plugin</artifactId>
-			  <configuration>
-				<source>1.5</source>
-				<target>1.5</target>
-			  </configuration>
-			</plugin>
+ 	    <plugin>
+	        <groupId>org.apache.maven.plugins</groupId>
+	        <artifactId>maven-compiler-plugin</artifactId>
+	        <configuration>
+	 	    <source>1.5</source>
+		    <target>1.5</target>
+	        </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
@@ -72,9 +83,9 @@
                             javax.wsdl,
                             javax.xml.bind,
                             javax.xml.bind.annotation,
-			                javax.xml.namespace,
-			                javax.xml.ws,
-			                META-INF.cxf,
+			    javax.xml.namespace,
+			    javax.xml.ws,
+			    META-INF.cxf,
                             META-INF.cxf.osgi,
                             org.apache.cxf.bus,
                             org.apache.cxf.bus.spring,
@@ -85,6 +96,7 @@
                             org.springframework.beans.factory.config
                         </Import-Package>
                         <Private-Package>
+                            !${packageName}.client,    
                             ${packageName},
                             ${packageName}.types
                         </Private-Package>
@@ -98,4 +110,30 @@
         </plugins>
     </build>
 
+    <profiles>
+        <profile>
+            <id>client</id>
+            <build>
+                <defaultGoal>test</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>${packageName}.client.Client</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>  
+
 </project>

Added: servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/Client.java
URL: http://svn.apache.org/viewvc/servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/Client.java?rev=719137&view=auto
==============================================================================
--- servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/Client.java (added)
+++ servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/Client.java Wed Nov 19 16:12:42 2008
@@ -0,0 +1,55 @@
+/*
+ * 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 ${packageName}.client;
+
+import ${packageName}.*;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+
+public final class Client {
+
+    private Client() {
+    }
+
+    public static void main(String args[]) throws Exception {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(Person.class);
+        if (args != null && args.length > 0 && !"".equals(args[0])) {
+            factory.setAddress(args[0]);
+        } else {
+            factory.setAddress("http://localhost:8080/cxf/PersonServiceCF");
+        }
+       
+        Person client = (Person)factory.create();
+        System.out.println("Invoking getPerson...");
+        java.lang.String _getPerson_personIdVal = "Guillaume";
+        javax.xml.ws.Holder<java.lang.String> _getPerson_personId = new javax.xml.ws.Holder<java.lang.String>(_getPerson_personIdVal);
+        javax.xml.ws.Holder<java.lang.String> _getPerson_ssn = new javax.xml.ws.Holder<java.lang.String>();
+        javax.xml.ws.Holder<java.lang.String> _getPerson_name = new javax.xml.ws.Holder<java.lang.String>();
+        try {
+            client.getPerson(_getPerson_personId, _getPerson_ssn, _getPerson_name);
+
+            System.out.println("getPerson._getPerson_personId=" + _getPerson_personId.value);
+            System.out.println("getPerson._getPerson_ssn=" + _getPerson_ssn.value);
+            System.out.println("getPerson._getPerson_name=" + _getPerson_name.value);
+        } catch (${packageName}.UnknownPersonFault upf) {
+            System.out.println("Expected exception: UnknownPersonFault has occurred.");
+            System.out.println(upf.toString());
+        }
+    }
+}
+
+

Propchange: servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/Client.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/archetypes/trunk/servicemix-osgi-cxf-code-first-archetype/src/main/resources/archetype-resources/src/main/java/client/Client.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date