You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/01/02 08:15:39 UTC

[camel] branch master updated: CAMEL-6747: Polished

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 14486f6  CAMEL-6747: Polished
14486f6 is described below

commit 14486f6f8964d8067d26211d304ebe42033846b9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jan 2 09:15:01 2019 +0100

    CAMEL-6747: Polished
---
 .../README.md                                      |  45 ++--
 .../pom.xml                                        | 239 +++++++++++----------
 .../org/apache/camel/example/cxf/ws/Client.java    |   2 +-
 .../apache/camel/example/cxf/ws/HelloWorld.java    |   2 +
 .../camel/example/cxf/ws/HelloWorldImpl.java       |   1 +
 .../resources/META-INF/spring/camel-context.xml    |  83 ++++---
 6 files changed, 179 insertions(+), 193 deletions(-)

diff --git a/examples/camel-example-cxf-ws-security-signature/README.md b/examples/camel-example-cxf-ws-security-signature/README.md
index 8a3494a..bb187b8 100644
--- a/examples/camel-example-cxf-ws-security-signature/README.md
+++ b/examples/camel-example-cxf-ws-security-signature/README.md
@@ -1,32 +1,15 @@
-/*
- * 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.
- */
-
 CXF WS-SECURITY OSGi HTTP WEB SERVICE
 =========================
 
 ### Introduction
--------
+
 Create a web service with CXF using WS-SECURITY Signature action and expose it through the OSGi HTTP
 Service, the main purpose is to demonstrate how to use signaturePropRefId WSS4J configuration in
 OSGi container.
 
 
-Explanation
------------
+### Explanation
+
 The web service is a simple JAX-WS web service with ws-security Signature and UsernameToken action called HelloWorldSecurity. The 
 interface and the implementation are located in the src/main/java/org/
 apache/camel/example/cxf/ws directory of this example.
@@ -76,7 +59,7 @@ directory:
 ### Build
 You will need to compile this example first:
 
-	mvn install
+    mvn install
 
 ### Run
 
@@ -86,19 +69,21 @@ To run the example on Apache Karaf 4.x or newer
 
 Launch the server
 
-	karaf / karaf.bat
+    karaf / karaf.bat
 
 #### Step 2: Add features
 
 Add features required
 
-	feature:install cxf
-	feature:install camel
-	feature:install camel-cxf
+    feature:install cxf
+    feature:install camel
+    feature:install camel-cxf
 
 #### Step 3: Deploy
+
 Deploy the example
-                 install -s mvn:org.apache.camel.example/camel-example-cxf-ws-security-signature/${version}
+
+    install -s mvn:org.apache.camel.example/camel-example-cxf-ws-security-signature/${version}
 
 To view the service WSDL, open your browser and go to the following
 URL:
@@ -106,9 +91,8 @@ URL:
   http://localhost:8181/cxf/HelloWorldSecurity?wsdl
 
 
+### Running a Client
 
-Running a Client
-----------------
 To run the java code client:
 
 1. Change to the <camel_home>/examples/camel-example-cxf-ws-security-signature
@@ -116,10 +100,9 @@ To run the java code client:
 
 2. Run the following command:
 
-     mvn compile exec:java
+   `mvn compile exec:java`
 
-   If the client request is successful, 
-   it will print out
+   If the client request is successful, it will print out:
        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:sayHelloResponse xmlns:ns2="http://cxf.apache.org/wsse/handler/helloworld"><return>Hello CXF</return></ns2:sayHelloResponse></soap:Body></soap:Envelope>
        
 ### Forum, Help, etc
diff --git a/examples/camel-example-cxf-ws-security-signature/pom.xml b/examples/camel-example-cxf-ws-security-signature/pom.xml
index c0508bd..148d271 100644
--- a/examples/camel-example-cxf-ws-security-signature/pom.xml
+++ b/examples/camel-example-cxf-ws-security-signature/pom.xml
@@ -19,128 +19,125 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-	
- <parent>
-   <groupId>org.apache.camel.example</groupId>
-   <artifactId>examples</artifactId>
-   <version>3.0.0-SNAPSHOT</version>
- </parent>
-  
- <artifactId>camel-example-cxf-ws-security-signature</artifactId>
- <packaging>jar</packaging>
- <name>Camel :: Example :: CXF :: WS-Security Signature</name>
- <description>CXF example using WS-Security Signature Action</description>
-	
- <properties>
-   <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-   <version.maven-bundle-plugin>${project.version}</version.maven-bundle-plugin>
-   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-	
- <dependencies>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel.example</groupId>
+    <artifactId>examples</artifactId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-cxf-ws-security-signature</artifactId>
+  <packaging>jar</packaging>
+  <name>Camel :: Example :: CXF :: WS-Security Signature</name>
+  <description>CXF example using WS-Security Signature Action</description>
+
+  <properties>
+    <category>WebService</category>
+    <title>CXF using WS-Security Signature</title>
+  </properties>
+
+  <dependencies>
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
     </dependency>
-	<dependency>
-	  <groupId>org.apache.camel</groupId>
-	  <artifactId>camel-spring</artifactId>
-	</dependency>
-	<dependency>
-	  <groupId>org.apache.camel</groupId>
-	  <artifactId>camel-cxf</artifactId>
-	</dependency>
-	<dependency>
-	  <groupId>org.apache.cxf</groupId>
-	  <artifactId>cxf-rt-ws-security</artifactId>
-	</dependency>
-	<dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cxf</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-ws-security</artifactId>
+    </dependency>
+    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
-	<dependency>
-	  <groupId>org.slf4j</groupId>
-	  <artifactId>slf4j-api</artifactId>
-	</dependency>
-	<dependency>
-	  <groupId>org.slf4j</groupId>
-	  <artifactId>slf4j-log4j12</artifactId>
-	</dependency>
-	<dependency>
-	  <groupId>log4j</groupId>
-	  <artifactId>log4j</artifactId>
-	</dependency>
-	<dependency>
-	  <groupId>org.apache.camel</groupId>
-	  <artifactId>camel-test-spring</artifactId>
-	  <scope>test</scope>
-	</dependency>
-	</dependencies>
-	
-	<build>
-		<defaultGoal>install</defaultGoal>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.felix</groupId>
-				<artifactId>maven-bundle-plugin</artifactId>
-				<!-- <version></version> -->
-				<extensions>true</extensions>
-				<configuration>
-					<instructions>
-						<Bundle-SymbolicName>camel-example-cxf-ws-security-signature</Bundle-SymbolicName>
-						<Bundle-Name>Camel :: Example :: CXF ::WS-Security Signature</Bundle-Name>
-						<Import-Package>
-                            javax.jws,
-                            javax.xml.bind.annotation,
-                            javax.xml.namespace,
-                            javax.wsdl,
-                            org.apache.cxf.bus,
-                            org.apache.cxf.bus.spring,
-                            org.apache.cxf.bus.resource,
-                            org.apache.cxf.configuration.spring,
-                            org.apache.cxf.resource,
-                            org.apache.cxf.transport.http,
-                            org.apache.cxf.ws.security.wss4j,
-                            org.springframework.beans.factory.config,
-                            javax.security.auth.callback,
-                            org.apache.wss4j.common.ext,
-                            org.apache.cxf.binding.soap.saaj,
-			                org.apache.commons.io
-                        </Import-Package>
-					</instructions>
-				</configuration>
-			</plugin>
-			<plugin>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.8</source>
-					<target>1.8</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<artifactId>maven-resources-plugin</artifactId>
-				<configuration>
-					<encoding>UTF-8</encoding>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.camel</groupId>
-				<artifactId>camel-maven-plugin</artifactId>
-				<configuration>
-					<fileApplicationContextUri>src/main/resources/META-INF/spring/camel-context.xml</fileApplicationContextUri>
-				</configuration>
-			</plugin>
-			 <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
-                <configuration>
-                    <mainClass>org.apache.camel.example.cxf.ws.Client</mainClass>
-                    <includePluginDependencies>false</includePluginDependencies>
-                </configuration>
-            </plugin>
-		</plugins>
-	</build>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>camel-example-cxf-ws-security-signature</Bundle-SymbolicName>
+            <Bundle-Name>Camel :: Example :: CXF :: WS-Security Signature</Bundle-Name>
+            <Import-Package>
+              javax.jws,
+              javax.xml.bind.annotation,
+              javax.xml.namespace,
+              javax.wsdl,
+              org.apache.cxf.bus,
+              org.apache.cxf.bus.spring,
+              org.apache.cxf.bus.resource,
+              org.apache.cxf.configuration.spring,
+              org.apache.cxf.resource,
+              org.apache.cxf.transport.http,
+              org.apache.cxf.ws.security.wss4j,
+              org.springframework.beans.factory.config,
+              javax.security.auth.callback,
+              org.apache.wss4j.common.ext,
+              org.apache.cxf.binding.soap.saaj,
+              org.apache.commons.io
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-maven-plugin</artifactId>
+        <configuration>
+          <fileApplicationContextUri>src/main/resources/META-INF/spring/camel-context.xml</fileApplicationContextUri>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <configuration>
+          <mainClass>org.apache.camel.example.cxf.ws.Client</mainClass>
+          <includePluginDependencies>false</includePluginDependencies>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <profiles>
     <profile>
       <id>jdk9+-build</id>
@@ -152,11 +149,21 @@
           <plugin>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
-              <argLine>--add-modules java.activation,java.xml.bind,java.xml.ws,jdk.xml.bind --add-opens java.base/java.lang=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime.reflect=ALL-UNNAMED --add-exports=java.xml.ws/com.sun.xml.internal.messaging.saaj.soap.impl=ALL-UNNA [...]
+              <argLine>--add-modules java.activation,java.xml.bind,java.xml.ws,jdk.xml.bind --add-opens
+                java.base/java.lang=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED
+                --add-exports=java.xml.bind/com.sun.xml.internal.bind=ALL-UNNAMED
+                --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2=ALL-UNNAMED
+                --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime.reflect=ALL-UNNAMED
+                --add-exports=java.xml.ws/com.sun.xml.internal.messaging.saaj.soap.impl=ALL-UNNAMED
+                --add-exports=java.xml.ws/com.sun.xml.internal.messaging.saaj.soap=ALL-UNNAMED --add-opens
+                java.base/java.net=ALL-UNNAMED
+                --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED
+              </argLine>
             </configuration>
           </plugin>
         </plugins>
       </build>
     </profile>
   </profiles>
+  
 </project>
diff --git a/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/Client.java b/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/Client.java
index 481e708..fbdebf8 100755
--- a/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/Client.java
+++ b/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/Client.java
@@ -24,8 +24,8 @@ import java.net.URLConnection;
 
 import org.apache.commons.io.IOUtils;
 
-
 public class Client {
+
     public static void main(String[] args) {
         try {
             new Client().sendRequest();
diff --git a/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorld.java b/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorld.java
index 519a519..4c6b4d5 100644
--- a/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorld.java
+++ b/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorld.java
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 package org.apache.camel.example.cxf.ws;
+
 import javax.jws.WebMethod;
 import javax.jws.WebParam;
 import javax.jws.WebService;
 
 @WebService(name = "HelloWorld", targetNamespace = "http://cxf.apache.org/wsse/handler/helloworld")
 public interface HelloWorld {
+
     @WebMethod
     String sayHello(@WebParam(name = "toWhom") String to);
 
diff --git a/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorldImpl.java b/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorldImpl.java
index 8e7c80e..9f72e8e 100755
--- a/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorldImpl.java
+++ b/examples/camel-example-cxf-ws-security-signature/src/main/java/org/apache/camel/example/cxf/ws/HelloWorldImpl.java
@@ -23,6 +23,7 @@ import javax.jws.WebService;
 @WebService(name = "HelloWorld", targetNamespace = "http://cxf.apache.org/wsse/handler/helloworld", 
             endpointInterface = "org.apache.camel.example.cxf.ws.HelloWorld")
 public class HelloWorldImpl implements HelloWorld {
+
     @WebMethod
     public String sayHello(@WebParam(name = "toWhom") String toWhom) {
         return "Hello " + toWhom;
diff --git a/examples/camel-example-cxf-ws-security-signature/src/main/resources/META-INF/spring/camel-context.xml b/examples/camel-example-cxf-ws-security-signature/src/main/resources/META-INF/spring/camel-context.xml
index 2a90c3a..4feaeb6 100644
--- a/examples/camel-example-cxf-ws-security-signature/src/main/resources/META-INF/spring/camel-context.xml
+++ b/examples/camel-example-cxf-ws-security-signature/src/main/resources/META-INF/spring/camel-context.xml
@@ -19,54 +19,47 @@
 -->
 <!-- Configures the Camel Context-->
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-    xmlns:jaxws="http://cxf.apache.org/jaxws"
-    xmlns:util="http://www.springframework.org/schema/util"
-    xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd       
-     http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
-      http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
-   
-   <bean id="myPasswordCallback" class="org.apache.camel.example.cxf.ws.UserPasswordCallback"/>
-   
-    <jaxws:endpoint id="helloWorld"
-        implementor="org.apache.camel.example.cxf.ws.HelloWorldImpl"
-        address="/HelloWorldSecurity">
-        <jaxws:inInterceptors>
-            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
-                <constructor-arg>
-                    <map>
-                        <entry key="action" value="UsernameToken Signature"/>
-                        <entry key="passwordType" value="PasswordText"/>
-                        <entry key="passwordCallbackRef">
-                            <ref bean="myPasswordCallback"/>
-                        </entry>
-                        <entry key="signaturePropRefId" value="wsCryptoProperties"/>
-                        <entry key="wsCryptoProperties" value-ref="wsCryptoProperties"/>
-                    </map>
-                </constructor-arg>
-            </bean>
-            <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
-        </jaxws:inInterceptors>
-    </jaxws:endpoint>
-    
-    <util:properties id="wsCryptoProperties">
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:jaxws="http://cxf.apache.org/jaxws"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+       http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
 
-       <prop
-            key="org.apache.ws.security.crypto.provider">org.apache.ws.security.components.crypto.Merlin</prop>
+  <bean id="myPasswordCallback" class="org.apache.camel.example.cxf.ws.UserPasswordCallback"/>
 
-       <prop
-            key="org.apache.ws.security.crypto.merlin.keystore.type">jks</prop>
+  <!-- setup CXF endpoint -->
+  <jaxws:endpoint id="helloWorld"
+                  implementor="org.apache.camel.example.cxf.ws.HelloWorldImpl"
+                  address="/HelloWorldSecurity">
+    <jaxws:inInterceptors>
+      <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+        <constructor-arg>
+          <map>
+            <entry key="action" value="UsernameToken Signature"/>
+            <entry key="passwordType" value="PasswordText"/>
+            <entry key="passwordCallbackRef">
+              <ref bean="myPasswordCallback"/>
+            </entry>
+            <entry key="signaturePropRefId" value="wsCryptoProperties"/>
+            <entry key="wsCryptoProperties" value-ref="wsCryptoProperties"/>
+          </map>
+        </constructor-arg>
+      </bean>
+      <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
+    </jaxws:inInterceptors>
+  </jaxws:endpoint>
 
-       <prop
-           key="org.apache.ws.security.crypto.merlin.keystore.password">storepassword</prop>
+  <util:properties id="wsCryptoProperties">
+    <prop key="org.apache.ws.security.crypto.provider">org.apache.ws.security.components.crypto.Merlin</prop>
+    <prop key="org.apache.ws.security.crypto.merlin.keystore.type">jks</prop>
+    <prop key="org.apache.ws.security.crypto.merlin.keystore.password">storepassword</prop>
+    <prop key="org.apache.ws.security.crypto.merlin.keystore.file">server-truststore.jks</prop>
+  </util:properties>
 
-       <prop
-           key="org.apache.ws.security.crypto.merlin.keystore.file">server-truststore.jks</prop>
-    </util:properties>
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <!-- no routes -->
+  </camelContext>
 
-   
-    <camelContext id="test-example-context" xmlns="http://camel.apache.org/schema/spring">
-     
-    </camelContext>
 </beans>