camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: Component docs
Date Thu, 21 May 2015 06:21:51 GMT
Repository: camel
Updated Branches:
  refs/heads/master adc16c38c -> 98ccff721


Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/98ccff72
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/98ccff72
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/98ccff72

Branch: refs/heads/master
Commit: 98ccff721d1bb40849fdcafb4cd68f7fa809e3db
Parents: adc16c3
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu May 21 08:23:29 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu May 21 08:25:23 2015 +0200

----------------------------------------------------------------------
 .../spring/ws/SpringWebserviceComponent.java    |  18 +-
 .../ws/SpringWebserviceConfiguration.java       | 181 +++++++++++++------
 .../spring/ws/SpringWebserviceEndpoint.java     |   2 +-
 .../spring/ws/filter/MessageFilter.java         |  12 +-
 .../spring/ws/type/EndpointMappingKey.java      |  21 ++-
 5 files changed, 159 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/98ccff72/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
index 0bf52a9..554668a 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceComponent.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.spring.ws;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Map;
-
 import javax.xml.transform.TransformerFactory;
 
 import org.apache.camel.CamelContext;
@@ -31,7 +30,6 @@ import org.apache.camel.component.spring.ws.filter.MessageFilter;
 import org.apache.camel.component.spring.ws.type.EndpointMappingKey;
 import org.apache.camel.component.spring.ws.type.EndpointMappingType;
 import org.apache.camel.converter.jaxp.XmlConverter;
-import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.EndpointHelper;
@@ -85,8 +83,13 @@ public class SpringWebserviceComponent extends UriEndpointComponent {
             } else {
                 addEndpointMappingToConfiguration(parameters, configuration);
             }
-            configuration.setEndpointMappingKey(new EndpointMappingKey(type, lookupKey, 
-                type.equals(EndpointMappingType.XPATHRESULT) ? getXPathExpressionFromParameters(parameters)
: null));
+            XPathExpression xPathExpression = null;
+            if (type.equals(EndpointMappingType.XPATHRESULT)) {
+                String expression = getAndRemoveParameter(parameters, "expression", String.class);
+                configuration.setExpression(expression);
+                xPathExpression = createXPathExpression(expression);
+            }
+            configuration.setEndpointMappingKey(new EndpointMappingKey(type, lookupKey, xPathExpression));
         }
     }
 
@@ -106,7 +109,9 @@ public class SpringWebserviceComponent extends UriEndpointComponent {
                     "messageFactory", WebServiceMessageFactory.class, null);
 
             if (webServiceTemplate.getDefaultUri() == null) {
-                webServiceTemplate.setDefaultUri(webServiceEndpointUri.toString());
+                String uri = webServiceEndpointUri.toString();
+                webServiceTemplate.setDefaultUri(uri);
+                configuration.setWebServiceEndpointUri(uri);
             }
             if (messageSender != null) {
                 webServiceTemplate.setMessageSender(messageSender);
@@ -124,8 +129,7 @@ public class SpringWebserviceComponent extends UriEndpointComponent {
         return SpringWebserviceConfiguration.decode(lookupKey);
     }
 
-    private XPathExpression getXPathExpressionFromParameters(Map<String, Object> parameters)
{
-        String xpathExpression = getAndRemoveParameter(parameters, "expression", String.class);
+    private XPathExpression createXPathExpression(String xpathExpression) {
         if (xpathExpression == null) {
             throw new RuntimeCamelException("Expression parameter is required when using
XPath endpoint mapping");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/98ccff72/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
index 61fa3d0..1659749 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
@@ -27,6 +27,7 @@ import org.apache.camel.component.spring.ws.type.EndpointMappingKey;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.jsse.SSLContextParameters;
 import org.springframework.util.StringUtils;
 import org.springframework.ws.client.core.WebServiceTemplate;
@@ -37,54 +38,88 @@ import org.springframework.ws.transport.WebServiceMessageSender;
 @UriParams
 public class SpringWebserviceConfiguration {
 
-    @UriParam
+    private XmlConverter xmlConverter;
+    private MessageFilter messageFilter;
+
+    @UriParam(label = "consumer")
     private EndpointMappingKey endpointMappingKey;
+    @UriPath(label = "producer")
+    private String webServiceEndpointUri;
 
     /* Producer configuration */
-    @UriParam
+    @UriParam(label = "producer")
     private WebServiceTemplate webServiceTemplate;
-    @UriParam
+    @UriParam(label = "producer")
     private String soapAction;
-    @UriParam
+    @UriParam(label = "producer")
     private URI wsAddressingAction;
-    @UriParam
+    @UriParam(label = "producer")
     private URI outputAction;
-    @UriParam
+    @UriParam(label = "producer")
     private URI faultAction;
-    @UriParam
+    @UriParam(label = "producer")
     private URI faultTo;
-    @UriParam
+    @UriParam(label = "producer")
     private URI replyTo;
-    @UriParam
-    private WebServiceMessageSender replyToMessageSender;
-    @UriParam
+    @UriParam(label = "producer")
+    private WebServiceMessageSender messageSender;
+    @UriParam(label = "producer")
     private MessageIdStrategy messageIdStrategy;
-    @UriParam
+    @UriParam(label = "producer")
     private int timeout = -1;
 
     /* Consumer configuration */
-    @UriParam
+    @UriParam(label = "consumer")
     private CamelSpringWSEndpointMapping endpointMapping;
-    @UriParam
+    @UriParam(label = "consumer")
     private CamelEndpointDispatcher endpointDispatcher;
-    @UriParam
+    @UriParam(label = "consumer")
     private SSLContextParameters sslContextParameters;
-
-    private XmlConverter xmlConverter;
-    private MessageFilter messageFilter;
+    @UriParam(label = "consumer")
+    private String expression;
 
     public WebServiceTemplate getWebServiceTemplate() {
         return webServiceTemplate;
     }
 
+    /**
+     * Option to provide a custom WebServiceTemplate.
+     * This allows for full control over client-side web services handling; like adding a
custom interceptor
+     * or specifying a fault resolver, message sender or message factory.
+     */
     public void setWebServiceTemplate(WebServiceTemplate webServiceTemplate) {
         this.webServiceTemplate = webServiceTemplate;
     }
 
+    public String getWebServiceEndpointUri() {
+        return webServiceEndpointUri;
+    }
+
+    /**
+     * The default Web Service endpoint uri to use for the producer.
+     */
+    public void setWebServiceEndpointUri(String webServiceEndpointUri) {
+        this.webServiceEndpointUri = webServiceEndpointUri;
+    }
+
+    public String getExpression() {
+        return expression;
+    }
+
+    /**
+     * The XPath expression to use when option type=xpathresult. Then this option is required
to be configured.
+     */
+    public void setExpression(String expression) {
+        this.expression = expression;
+    }
+
     public String getSoapAction() {
         return soapAction;
     }
 
+    /**
+     * SOAP action to include inside a SOAP request when accessing remote web services
+     */
     public void setSoapAction(String soapAction) {
         this.soapAction = soapAction;
     }
@@ -103,6 +138,10 @@ public class SpringWebserviceConfiguration {
         return wsAddressingAction;
     }
 
+    /**
+     * WS-Addressing 1.0 action header to include when accessing web services.
+     * The To header is set to the address of the web service as specified in the endpoint
URI (default Spring-WS behavior).
+     */
     public void setWsAddressingAction(URI wsAddressingAction) {
         this.wsAddressingAction = wsAddressingAction;
     }
@@ -117,6 +156,17 @@ public class SpringWebserviceConfiguration {
         return timeout;
     }
 
+    /**
+     * Sets the socket read timeout (in milliseconds) while invoking a webservice using the
producer,
+     * see URLConnection.setReadTimeout() and CommonsHttpMessageSender.setReadTimeout().
+     * This option works when using the built-in message sender implementations:
+     * CommonsHttpMessageSender and HttpUrlConnectionMessageSender.
+     * One of these implementations will be used by default for HTTP based services unless
you customize the
+     * Spring WS configuration options supplied to the component.
+     * If you are using a non-standard sender, it is assumed that you will handle your own
timeout configuration.
+     * The built-in message sender HttpComponentsMessageSender is considered instead of CommonsHttpMessageSender
+     * which has been deprecated, see HttpComponentsMessageSender.setReadTimeout().
+     */
     public void setTimeout(int timeout) {
         this.timeout = timeout;
     }
@@ -125,6 +175,12 @@ public class SpringWebserviceConfiguration {
         return endpointMapping;
     }
 
+    /**
+     * Reference to an instance of org.apache.camel.component.spring.ws.bean.CamelEndpointMapping
in the Registry/ApplicationContext.
+     * Only one bean is required in the registry to serve all Camel/Spring-WS endpoints.
+     * This bean is auto-discovered by the MessageDispatcher and used to map requests to
Camel endpoints based
+     * on characteristics specified on the endpoint (like root QName, SOAP action, etc)
+     */
     public void setEndpointMapping(CamelSpringWSEndpointMapping endpointMapping) {
         this.endpointMapping = endpointMapping;
     }
@@ -141,6 +197,9 @@ public class SpringWebserviceConfiguration {
         return sslContextParameters;
     }
 
+    /**
+     * To configure security using SSLContextParameters
+     */
     public void setSslContextParameters(SSLContextParameters sslContextParameters) {
         this.sslContextParameters = sslContextParameters;
     }
@@ -149,6 +208,10 @@ public class SpringWebserviceConfiguration {
         return endpointDispatcher;
     }
 
+    /**
+     * Spring {@link org.springframework.ws.server.endpoint.MessageEndpoint} for dispatching
messages received by Spring-WS to a Camel endpoint,
+     * to integrate with existing (legacy) endpoint mappings like PayloadRootQNameEndpointMapping,
SoapActionEndpointMapping, etc.
+     */
     public void setEndpointDispatcher(CamelEndpointDispatcher endpointDispatcher) {
         this.endpointDispatcher = endpointDispatcher;
     }
@@ -172,22 +235,12 @@ public class SpringWebserviceConfiguration {
     }
 
     /**
-     * Default setter to override failsafe message filter.
-     * 
-     * @param messageFilter non-default MessageFilter
+     * Option to provide a custom MessageFilter. For example when you want to process your
headers or attachments by your own.
      */
     public void setMessageFilter(MessageFilter messageFilter) {
         this.messageFilter = messageFilter;
-
     }
 
-    /**
-     * Gets the configured MessageFilter.
-     * 
-     * Note: The only place that sets fail safe strategy.
-     * 
-     * @return instance of MessageFilter that is never null;
-     */
     public MessageFilter getMessageFilter() {
         if (this.messageFilter == null) {
             this.messageFilter = new BasicMessageFilter();
@@ -195,14 +248,18 @@ public class SpringWebserviceConfiguration {
         return this.messageFilter;
     }
 
+    public URI getOutputAction() {
+        return outputAction;
+    }
+
     /**
      * Signifies the value for the response WS-Addressing <code>Action</code>
      * header that is provided by the method.
-     * 
+     *
      * @see {@link Action}
      */
-    public URI getOutputAction() {
-        return outputAction;
+    public void setOutputAction(URI outputAction) {
+        this.outputAction = outputAction;
     }
 
     public void setOutputAction(String output) throws URISyntaxException {
@@ -211,91 +268,101 @@ public class SpringWebserviceConfiguration {
         }
     }
 
-    public void setOutputAction(URI outputAction) {
-        this.outputAction = outputAction;
+    public URI getFaultAction() {
+        return faultAction;
     }
 
     /**
      * Signifies the value for the faultAction response WS-Addressing
      * <code>Fault Action</code> header that is provided by the method.
-     * 
+     *
      * @see {@link Action}
      */
-    public URI getFaultAction() {
-        return faultAction;
-    }
-
     public void setFaultAction(String fault) throws URISyntaxException {
         if (StringUtils.hasText(fault)) {
             setFaultAction(new URI(fault));
         }
     }
 
+    /**
+     * Signifies the value for the faultAction response WS-Addressing
+     * <code>Fault Action</code> header that is provided by the method.
+     *
+     * @see {@link Action}
+     */
     public void setFaultAction(URI fault) {
         this.faultAction = fault;
     }
 
+    public URI getFaultTo() {
+        return faultTo;
+    }
+
     /**
      * Signifies the value for the faultAction response WS-Addressing
      * <code>FaultTo</code> header that is provided by the method.
-     * 
+     *
      * @see {@link Action}
      */
-    public URI getFaultTo() {
-        return faultTo;
-    }
-
     public void setFaultTo(String faultTo) throws URISyntaxException {
         if (StringUtils.hasText(faultTo)) {
             setFaultTo(new URI(faultTo));
         }
     }
 
+    /**
+     * Signifies the value for the faultAction response WS-Addressing
+     * <code>FaultTo</code> header that is provided by the method.
+     *
+     * @see {@link Action}
+     */
     public void setFaultTo(URI faultTo) {
         this.faultTo = faultTo;
     }
 
+    public URI getReplyTo() {
+        return replyTo;
+    }
+
     /**
      * Signifies the value for the replyTo response WS-Addressing
      * <code>ReplyTo</code> header that is provided by the method.
-     * 
+     *
      * @see {@link Action}
      */
-    public URI getReplyTo() {
-        return replyTo;
-    }
-
     public void setReplyTo(String replyToAction) throws URISyntaxException {
         if (StringUtils.hasText(replyToAction)) {
             setReplyTo(new URI(replyToAction));
         }
     }
 
+    /**
+     * Signifies the value for the replyTo response WS-Addressing
+     * <code>ReplyTo</code> header that is provided by the method.
+     *
+     * @see {@link Action}
+     */
     public void setReplyTo(URI replyToAction) {
         this.replyTo = replyToAction;
     }
 
-    /** * @return Returns the replyToMessageSender for wsa:replyTo.
-     */
     public WebServiceMessageSender getMessageSender() {
-        return replyToMessageSender;
+        return messageSender;
     }
 
     /**
-     * @param messageSender The replyToMessageSender for wsa:replyTo to set.
+     * Option to provide a custom WebServiceMessageSender. For example to perform authentication
or use alternative transports
      */
     public void setMessageSender(WebServiceMessageSender messageSender) {
-        this.replyToMessageSender = messageSender;
+        this.messageSender = messageSender;
     }
 
-    /** * @return Returns the messageIdStrategy.
-     */
     public MessageIdStrategy getMessageIdStrategy() {
         return messageIdStrategy;
     }
 
     /**
-     * @param messageIdStrategy The messageIdStrategy to set.
+     * Option to provide a custom MessageIdStrategy to control generation of unique message
ids.
      */
     public void setMessageIdStrategy(MessageIdStrategy messageIdStrategy) {
         this.messageIdStrategy = messageIdStrategy;

http://git-wip-us.apache.org/repos/asf/camel/blob/98ccff72/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceEndpoint.java
b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceEndpoint.java
index 77961b5..741c1ca 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceEndpoint.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceEndpoint.java
@@ -24,7 +24,7 @@ import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 
-@UriEndpoint(scheme = "spring-ws", title = "Spring WebService", syntax = "spring-ws:type:lookupKey",
consumerClass = SpringWebserviceConsumer.class, label = "http,soap,webservice")
+@UriEndpoint(scheme = "spring-ws", title = "Spring WebService", syntax = "spring-ws:type:lookupKey:webServiceEndpointUri",
consumerClass = SpringWebserviceConsumer.class, label = "http,soap,webservice")
 public class SpringWebserviceEndpoint extends DefaultEndpoint {
 
     @UriParam

http://git-wip-us.apache.org/repos/asf/camel/blob/98ccff72/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/MessageFilter.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/MessageFilter.java
b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/MessageFilter.java
index 106a9da..56ac260 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/MessageFilter.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/filter/MessageFilter.java
@@ -23,25 +23,23 @@ import org.springframework.ws.WebServiceMessage;
  * A strategy instance that filters a WebServiceMessage response.
  * 
  * This class provides an additional configuration that can be managed in your Spring's context.
- * 
- * 
  */
 public interface MessageFilter {
 
     /**
      * Calls filter for a producer
-     * 
-     * @param exchange
+     *
+     * @param exchange the exchange
      * @param response provided by the producer
      */
-    void filterProducer(Exchange exchange, WebServiceMessage produceRresponse);
+    void filterProducer(Exchange exchange, WebServiceMessage response);
 
     /**
      * Calls filter for a consumer
      * 
-     * @param exchange
+     * @param exchange the exchange
      * @param response provided by the consumer
      */
-    void filterConsumer(Exchange exchange, WebServiceMessage consumerResponse);
+    void filterConsumer(Exchange exchange, WebServiceMessage response);
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/98ccff72/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingKey.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingKey.java
b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingKey.java
index 158d39e..f85b1e2 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingKey.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/type/EndpointMappingKey.java
@@ -16,16 +16,16 @@
  */
 package org.apache.camel.component.spring.ws.type;
 
-import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import org.apache.camel.spi.UriPath;
 import org.springframework.xml.xpath.XPathExpression;
 
 @UriParams
 public class EndpointMappingKey {
-    @UriPath @Metadata(required = "true")
+    @UriPath(label = "consumer")
     private EndpointMappingType type;
-    @UriPath @Metadata(required = "true")
+    @UriPath(label = "consumer")
     private String lookupKey;
 
     /* expression in case type is 'xpath' */
@@ -41,6 +41,18 @@ public class EndpointMappingKey {
         return type;
     }
 
+    /**
+     * Endpoint mapping type if endpoint mapping is used.
+     * <ul>
+     *     <li>rootqname - Offers the option to map web service requests based on the
qualified name of the root element contained in the message.</li>
+     *     <li>soapaction - Used to map web service requests based on the SOAP action
specified in the header of the message.</li>
+     *     <li>uri - In order to map web service requests that target a specific URI.</li>
+     *     <li>xpathresult - Used to map web service requests based on the evaluation
of an XPath expression against the incoming message.
+     *                       The result of the evaluation should match the XPath result specified
in the endpoint URI.</li>
+     *     <li>beanname - Allows you to reference an org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher
object in order to integrate with
+     *                    existing (legacy) endpoint mappings like PayloadRootQNameEndpointMapping,
SoapActionEndpointMapping, etc</li>
+     * </ul>
+     */
     public void setType(EndpointMappingType type) {
         this.type = type;
     }
@@ -49,6 +61,9 @@ public class EndpointMappingKey {
         return lookupKey;
     }
 
+    /**
+     * Endpoint mapping key if endpoint mapping is used
+     */
     public void setLookupKey(String lookupKey) {
         this.lookupKey = lookupKey;
     }


Mime
View raw message