Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0B7C017884 for ; Thu, 18 Jun 2015 19:15:54 +0000 (UTC) Received: (qmail 58660 invoked by uid 500); 18 Jun 2015 19:15:53 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 58613 invoked by uid 500); 18 Jun 2015 19:15:53 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 58604 invoked by uid 99); 18 Jun 2015 19:15:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2015 19:15:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AC9BEE3CA8; Thu, 18 Jun 2015 19:15:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: camel git commit: Component docs Date: Thu, 18 Jun 2015 19:15:53 +0000 (UTC) Repository: camel Updated Branches: refs/heads/master fa9b2032f -> 0ef7d443c Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0ef7d443 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0ef7d443 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0ef7d443 Branch: refs/heads/master Commit: 0ef7d443c4045b411a525c670d8b8838f069dfee Parents: fa9b203 Author: Claus Ibsen Authored: Thu Jun 18 21:16:19 2015 +0200 Committer: Claus Ibsen Committed: Thu Jun 18 21:21:17 2015 +0200 ---------------------------------------------------------------------- .../camel/component/cxf/CxfComponent.java | 29 ++- .../apache/camel/component/cxf/CxfEndpoint.java | 221 +++++++++++++------ .../cxf/util/CxfEndpointUtilsTest.java | 2 +- .../component/cxf/util/CxfEndpointBeans.xml | 2 +- 4 files changed, 178 insertions(+), 76 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/0ef7d443/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java index 9fa8e00..e5af409 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java @@ -25,12 +25,17 @@ import org.apache.camel.impl.HeaderFilterStrategyComponent; import org.apache.camel.util.CamelContextHelper; import org.apache.camel.util.IntrospectionSupport; import org.apache.cxf.message.Message; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Defines the CXF Component */ public class CxfComponent extends HeaderFilterStrategyComponent { - Boolean allowStreaming; + + private static final Logger LOG = LoggerFactory.getLogger(CxfComponent.class); + + private Boolean allowStreaming; public CxfComponent() { super(CxfEndpoint.class); @@ -39,12 +44,16 @@ public class CxfComponent extends HeaderFilterStrategyComponent { public CxfComponent(CamelContext context) { super(context, CxfEndpoint.class); } - - public void setAllowStreaming(Boolean b) { - allowStreaming = b; + + /** + * This option controls whether the CXF component, when running in PAYLOAD mode, will DOM parse the incoming messages + * into DOM Elements or keep the payload as a javax.xml.transform.Source object that would allow streaming in some cases. + */ + public void setAllowStreaming(Boolean allowStreaming) { + this.allowStreaming = allowStreaming; } - public Boolean getAllowStreaming() { + public Boolean isAllowStreaming() { return allowStreaming; } @@ -56,7 +65,15 @@ public class CxfComponent extends HeaderFilterStrategyComponent { @Override protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { - CxfEndpoint result = null; + CxfEndpoint result; + + Object value = parameters.remove("setDefaultBus"); + if (value != null) { + LOG.warn("The option setDefaultBus is @deprecated, use name defaultBus instead"); + if (!parameters.containsKey("defaultBus")) { + parameters.put("defaultBus", value); + } + } if (allowStreaming != null && !parameters.containsKey("allowStreaming")) { parameters.put("allowStreaming", Boolean.toString(allowStreaming)); http://git-wip-us.apache.org/repos/asf/camel/blob/0ef7d443/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java index e2ae980..396bc78 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java @@ -24,7 +24,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; - import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; @@ -38,10 +37,6 @@ import javax.xml.ws.Provider; import javax.xml.ws.WebServiceProvider; import javax.xml.ws.handler.Handler; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - import org.apache.camel.CamelContext; import org.apache.camel.CamelException; import org.apache.camel.Consumer; @@ -83,6 +78,7 @@ import org.apache.cxf.feature.LoggingFeature; import org.apache.cxf.frontend.ClientFactoryBean; import org.apache.cxf.frontend.ServerFactoryBean; import org.apache.cxf.headers.Header; +import org.apache.cxf.interceptor.AbstractLoggingInterceptor; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.jaxws.JaxWsClientFactoryBean; import org.apache.cxf.jaxws.JaxWsServerFactoryBean; @@ -103,6 +99,9 @@ import org.apache.cxf.staxutils.StaxSource; import org.apache.cxf.staxutils.StaxUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; /** @@ -116,32 +115,42 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy private static final Logger LOG = LoggerFactory.getLogger(CxfEndpoint.class); - protected Bus bus; + private AtomicBoolean getBusHasBeenCalled = new AtomicBoolean(false); + private volatile boolean createBus; + + private BindingConfiguration bindingConfig; + private DataBinding dataBinding; + private Object serviceFactoryBean; + private Map properties; + private List> in = new ModCountCopyOnWriteArrayList>(); + private List> out = new ModCountCopyOnWriteArrayList>(); + private List> outFault = new ModCountCopyOnWriteArrayList>(); + private List> inFault = new ModCountCopyOnWriteArrayList>(); + private List features = new ModCountCopyOnWriteArrayList(); + private List handlers; + private List schemaLocations; @UriPath(description = "To lookup an existing configured CxfEndpoint. Must used bean: as prefix.") private String beanId; @UriPath private String address; - - @UriParam - private boolean createBus; + @UriPath + protected Bus bus; @UriParam private String wsdlURL; private Class serviceClass; - private QName portName; - private QName serviceName; - @UriParam + @UriParam(name = "portName") private String portNameString; - @UriParam + private QName portName; + @UriParam(name = "serviceName") private String serviceNameString; - @UriParam + private QName serviceName; + @UriParam(label = "producer") private String defaultOperationName; - @UriParam + @UriParam(label = "producer") private String defaultOperationNamespace; - // This is for invoking the CXFClient with wrapped parameters of unwrapped parameters @UriParam - private boolean isWrapped; - // This is for marshal or unmarshal message with the document-literal wrapped or unwrapped style + private boolean wrapped; @UriParam private Boolean wrappedStyle; @UriParam @@ -150,16 +159,15 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy private DataFormat dataFormat = DataFormat.POJO; @UriParam private String publishedEndpointUrl; - @UriParam(defaultValue = "true") - private boolean inOut = true; + @UriParam private CxfBinding cxfBinding; + @UriParam private HeaderFilterStrategy headerFilterStrategy; - private AtomicBoolean getBusHasBeenCalled = new AtomicBoolean(false); @UriParam - private boolean isSetDefaultBus; + private boolean defaultBus; @UriParam private boolean loggingFeatureEnabled; - @UriParam + @UriParam(defaultValue = "" + AbstractLoggingInterceptor.DEFAULT_LIMIT) private int loggingSizeLimit; @UriParam private boolean mtomEnabled; @@ -169,31 +177,14 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy private boolean skipFaultLogging; @UriParam private boolean mergeProtocolHeaders; - private Map properties; - private List> in = new ModCountCopyOnWriteArrayList>(); - private List> out = new ModCountCopyOnWriteArrayList>(); - private List> outFault = new ModCountCopyOnWriteArrayList>(); - private List> inFault = new ModCountCopyOnWriteArrayList>(); - private List features = new ModCountCopyOnWriteArrayList(); - - @SuppressWarnings("rawtypes") - private List handlers; - private List schemaLocations; @UriParam private String transportId; @UriParam private String bindingId; - - private BindingConfiguration bindingConfig; - private DataBinding dataBinding; - private Object serviceFactoryBean; - private CxfEndpointConfigurer configurer; - - // The continuation timeout value for CXF continuation to use + @UriParam + private CxfEndpointConfigurer cxfEndpointConfigurer; @UriParam(defaultValue = "30000") private long continuationTimeout = 30000; - - // basic authentication option for the CXF client @UriParam private String username; @UriParam @@ -715,6 +706,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return dataFormat; } + /** + * The data type messages supported by the CXF endpoint. + */ public void setDataFormat(DataFormat format) { dataFormat = format; } @@ -723,6 +717,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return resolvePropertyPlaceholders(publishedEndpointUrl); } + /** + * This option can override the endpointUrl that published from the WSDL which can be accessed with service address url plus ?wsd + */ public void setPublishedEndpointUrl(String url) { publishedEndpointUrl = url; } @@ -731,6 +728,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return resolvePropertyPlaceholders(wsdlURL); } + /** + * The location of the WSDL. Can be on the classpath, file system, or be hosted remotely. + */ public void setWsdlURL(String url) { wsdlURL = url; } @@ -739,14 +739,23 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return serviceClass; } + /** + * The class name of the SEI (Service Endpoint Interface) class which could have JSR181 annotation or not. + */ public void setServiceClass(Class cls) { serviceClass = cls; } + /** + * The class name of the SEI (Service Endpoint Interface) class which could have JSR181 annotation or not. + */ public void setServiceClass(Object instance) { serviceClass = ClassHelper.getRealClass(instance); } - + + /** + * The class name of the SEI (Service Endpoint Interface) class which could have JSR181 annotation or not. + */ public void setServiceClass(String type) throws ClassNotFoundException { if (ObjectHelper.isEmpty(type)) { throw new IllegalArgumentException("The serviceClass option can neither be null nor an empty String."); @@ -754,14 +763,27 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy serviceClass = ClassLoaderUtils.loadClass(resolvePropertyPlaceholders(type), getClass()); } + /** + * The service name this service is implementing, it maps to the wsdl:service@name. + */ public void setServiceNameString(String service) { serviceNameString = service; } + /** + * The service name this service is implementing, it maps to the wsdl:service@name. + */ public void setServiceName(QName service) { serviceName = service; } + /** + * The service name this service is implementing, it maps to the wsdl:service@name. + */ + public void setService(String service) { + serviceNameString = service; + } + public QName getServiceName() { if (serviceName == null && serviceNameString != null) { serviceName = QName.valueOf(resolvePropertyPlaceholders(serviceNameString)); @@ -776,14 +798,34 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return portName; } + /** + * The endpoint name this service is implementing, it maps to the wsdl:port@name. In the format of ns:PORT_NAME where ns is a namespace prefix valid at this scope. + */ public void setPortName(QName port) { portName = port; } + /** + * The endpoint name this service is implementing, it maps to the wsdl:port@name. In the format of ns:PORT_NAME where ns is a namespace prefix valid at this scope. + */ + public void setPortNameString(String portNameString) { + this.portNameString = portNameString; + } + + public void setPortName(String portName) { + portNameString = portName; + } + + /** + * The port name this service is implementing, it maps to the wsdl:port@name. + */ public void setEndpointNameString(String port) { portNameString = port; } + /** + * The port name this service is implementing, it maps to the wsdl:port@name. + */ public void setEndpointName(QName port) { portName = port; } @@ -792,6 +834,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return resolvePropertyPlaceholders(defaultOperationName); } + /** + * This option will set the default operationName that will be used by the CxfProducer which invokes the remote service. + */ public void setDefaultOperationName(String name) { defaultOperationName = name; } @@ -800,42 +845,52 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return resolvePropertyPlaceholders(defaultOperationNamespace); } + /** + * This option will set the default operationNamespace that will be used by the CxfProducer which invokes the remote service. + */ public void setDefaultOperationNamespace(String namespace) { defaultOperationNamespace = namespace; } - public boolean isInOut() { - return inOut; - } - - public void setInOut(boolean inOut) { - this.inOut = inOut; - } - public boolean isWrapped() { - return isWrapped; + return wrapped; } + /** + * Which kind of operation that CXF endpoint producer will invoke + */ public void setWrapped(boolean wrapped) { - isWrapped = wrapped; + this.wrapped = wrapped; } public Boolean getWrappedStyle() { return wrappedStyle; } + /** + * The WSDL style that describes how parameters are represented in the SOAP body. + * If the value is false, CXF will chose the document-literal unwrapped style, + * If the value is true, CXF will chose the document-literal wrapped style + */ public void setWrappedStyle(Boolean wrapped) { wrappedStyle = wrapped; } - - public void setAllowStreaming(Boolean b) { - allowStreaming = b; + + /** + * This option controls whether the CXF component, when running in PAYLOAD mode, will DOM parse the incoming messages + * into DOM Elements or keep the payload as a javax.xml.transform.Source object that would allow streaming in some cases. + */ + public void setAllowStreaming(Boolean allowStreaming) { + this.allowStreaming = allowStreaming; } public Boolean getAllowStreaming() { return allowStreaming; } + /** + * To use a custom CxfBinding to control the binding between Camel Message and CXF Message. + */ public void setCxfBinding(CxfBinding cxfBinding) { this.cxfBinding = cxfBinding; } @@ -855,6 +910,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return headerFilterStrategy; } + /** + * To use a custom configured CXF Bus. + */ public void setBus(Bus bus) { this.bus = bus; this.createBus = false; @@ -867,21 +925,27 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy LOG.debug("Using DefaultBus {}", bus); } - if (!getBusHasBeenCalled.getAndSet(true) && isSetDefaultBus) { + if (!getBusHasBeenCalled.getAndSet(true) && defaultBus) { BusFactory.setDefaultBus(bus); LOG.debug("Set bus {} as thread default bus", bus); } return bus; } - public void setSetDefaultBus(boolean isSetDefaultBus) { - this.isSetDefaultBus = isSetDefaultBus; + /** + * Will set the default bus when CXF endpoint create a bus by itself + */ + public void setDefaultBus(boolean defaultBus) { + this.defaultBus = defaultBus; } - public boolean isSetDefaultBus() { - return isSetDefaultBus; + public boolean isDefaultBus() { + return defaultBus; } + /** + * This option enables CXF Logging Feature which writes inbound and outbound SOAP messages to log. + */ public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) { this.loggingFeatureEnabled = loggingFeatureEnabled; } @@ -894,15 +958,21 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return loggingSizeLimit; } + /** + * To limit the total size of number of bytes the logger will output when logging feature has been enabled. + */ public void setLoggingSizeLimit(int loggingSizeLimit) { this.loggingSizeLimit = loggingSizeLimit; } - protected boolean isSkipPayloadMessagePartCheck() { + public boolean isSkipPayloadMessagePartCheck() { return skipPayloadMessagePartCheck; } - protected void setSkipPayloadMessagePartCheck(boolean skipPayloadMessagePartCheck) { + /** + * Sets whether SOAP message validation should be disabled. + */ + public void setSkipPayloadMessagePartCheck(boolean skipPayloadMessagePartCheck) { this.skipPayloadMessagePartCheck = skipPayloadMessagePartCheck; } @@ -981,6 +1051,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy return resolvePropertyPlaceholders(address); } + /** + * To enable MTOM (attachments). This requires to use POJO or PAYLOAD data format mode. + */ public void setMtomEnabled(boolean mtomEnabled) { this.mtomEnabled = mtomEnabled; } @@ -992,7 +1065,10 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy public String getPassword() { return password; } - + + /** + * This option is used to set the basic authentication information of password for the CXF client. + */ public void setPassword(String password) { this.password = password; } @@ -1000,7 +1076,10 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy public String getUsername() { return username; } - + + /** + * This option is used to set the basic authentication information of username for the CXF client. + */ public void setUsername(String username) { this.username = username; } @@ -1222,20 +1301,26 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy } public CxfEndpointConfigurer getCxfEndpointConfigurer() { - return configurer; + return cxfEndpointConfigurer; } + /** + * This option could apply the implementation of org.apache.camel.component.cxf.CxfEndpointConfigurer which supports to configure the CXF endpoint + * in programmatic way. User can configure the CXF server and client by implementing configure{Server|Client} method of CxfEndpointConfigurer. + */ public void setCxfEndpointConfigurer(CxfEndpointConfigurer configurer) { - this.configurer = configurer; + this.cxfEndpointConfigurer = configurer; } public long getContinuationTimeout() { return continuationTimeout; } + /** + * This option is used to set the CXF continuation timeout which could be used in CxfConsumer by default when the CXF server is using Jetty or Servlet transport. + */ public void setContinuationTimeout(long continuationTimeout) { this.continuationTimeout = continuationTimeout; } - } http://git-wip-us.apache.org/repos/asf/camel/blob/0ef7d443/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java index 1f867aa..a587619 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java @@ -39,7 +39,7 @@ public class CxfEndpointUtilsTest extends Assert { + "?serviceClass=org.apache.camel.component.cxf.HelloService" + "&portName={http://www.example.com/test}PortName" + "&serviceName={http://www.example.com/test}ServiceName" - + "&setDefaultBus=true"; + + "&defaultBus=true"; private static final String NO_SERVICE_CLASS_URI = "cxf://http://www.example.com/testaddress" + "?portName={http://www.example.com/test}PortName" http://git-wip-us.apache.org/repos/asf/camel/blob/0ef7d443/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml index dd4e71e..1cd5bc9 100644 --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml @@ -31,7 +31,7 @@ xmlns:s="http://www.example.com/test"> - +