You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by jo...@apache.org on 2011/06/22 07:07:00 UTC
svn commit: r1138303 - in
/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf:
./ blueprint/
Author: joed
Date: Wed Jun 22 05:06:59 2011
New Revision: 1138303
URL: http://svn.apache.org/viewvc?rev=1138303&view=rev
Log:
This adresses
https://issues.apache.org/jira/browse/CAMEL-4109
https://issues.apache.org/jira/browse/CAMEL-4137
https://issues.apache.org/jira/browse/CAMEL-4135
We still rely a bit too much in spring classes for this to be clean
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBlueprintEndpoint.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointBean.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBlueprintEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBlueprintEndpoint.java?rev=1138303&r1=1138302&r2=1138303&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBlueprintEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBlueprintEndpoint.java Wed Jun 22 05:06:59 2011
@@ -51,9 +51,9 @@ public class CxfBlueprintEndpoint extend
private BundleContext bundleContext;
private BlueprintCamelContext blueprintCamelContext;
- public CxfBlueprintEndpoint(String address, BlueprintCamelContext context) {
- super(address, context);
- this.blueprintCamelContext = context;
+ public CxfBlueprintEndpoint(String address) {
+ super(address);
+
}
public List<Handler> getHandlers() {
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java?rev=1138303&r1=1138302&r2=1138303&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java Wed Jun 22 05:06:59 2011
@@ -28,30 +28,27 @@ import org.apache.camel.util.Introspecti
import org.apache.cxf.message.Message;
/**
- * Defines the <a href="http://camel.apache.org/cxf.html">CXF Component</a>
- *
- * @version
+ * Defines the <a href="http://camel.apache.org/cxf.html">CXF Component</a>
*/
public class CxfComponent extends HeaderFilterStrategyComponent {
-
+
public CxfComponent() {
}
public CxfComponent(CamelContext context) {
super(context);
}
-
+
/**
- * Create a {@link CxfEndpoint} which, can be a Spring bean endpoint having
+ * Create a {@link CxfEndpoint} which, can be a Spring bean endpoint having
* URI format cxf:bean:<i>beanId</i> or transport address endpoint having URI format
- * cxf://<i>transportAddress</i>.
+ * cxf://<i>transportAddress</i>.
*/
@Override
- protected Endpoint createEndpoint(String uri, String remaining,
- Map<String, Object> parameters) throws Exception {
-
- CxfEndpoint result;
-
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+
+ CxfEndpoint result = null;
+
if (remaining.startsWith(CxfConstants.SPRING_CONTEXT_ENDPOINT)) {
// Get the bean from the Spring context
String beanId = remaining.substring(CxfConstants.SPRING_CONTEXT_ENDPOINT.length());
@@ -59,27 +56,29 @@ public class CxfComponent extends Header
beanId = beanId.substring(2);
}
- CxfEndpointBean bean = CamelContextHelper.mandatoryLookup(getCamelContext(), beanId,
- CxfEndpointBean.class);
-
- result = new CxfSpringEndpoint(this, bean);
-
- // Apply Spring bean properties (including # notation referenced bean). Note that the
- // Spring bean properties values can be overridden by property defined in URI query.
- // The super class (DefaultComponent) will invoke "setProperties" after this method
- // with to apply properties defined by URI query.
- if (bean.getProperties() != null) {
- Map<String, Object> copy = new HashMap<String, Object>();
- copy.putAll(bean.getProperties());
- setProperties(result, copy);
- result.setMtomEnabled(Boolean.valueOf((String)copy.get(Message.MTOM_ENABLED)));
+ Object bean = CamelContextHelper.mandatoryLookup(getCamelContext(), beanId, Object.class);
+ if (bean instanceof CxfEndpointBean) {
+ CxfEndpointBean configBean = (CxfEndpointBean) bean;
+ result = new CxfSpringEndpoint(this, configBean);
+
+ // Apply Spring bean properties (including # notation referenced bean). Note that the
+ // Spring bean properties values can be overridden by property defined in URI query.
+ // The super class (DefaultComponent) will invoke "setProperties" after this method
+ // with to apply properties defined by URI query.
+ if (configBean.getProperties() != null) {
+ Map<String, Object> copy = new HashMap<String, Object>();
+ copy.putAll(configBean.getProperties());
+ setProperties(result, copy);
+ result.setMtomEnabled(Boolean.valueOf((String) copy.get(Message.MTOM_ENABLED)));
+ }
+ } else if (bean instanceof CxfBlueprintEndpoint) {
+ result = (CxfBlueprintEndpoint) bean;
}
-
} else {
// endpoint URI does not specify a bean
result = new CxfEndpoint(remaining, this);
}
-
+
setEndpointHeaderFilterStrategy(result);
setProperties(result, parameters);
@@ -88,16 +87,15 @@ public class CxfComponent extends Header
if (properties != null) {
result.setProperties(properties);
// set the properties of MTOM
- result.setMtomEnabled(Boolean.valueOf((String)properties.get(Message.MTOM_ENABLED)));
+ result.setMtomEnabled(Boolean.valueOf((String) properties.get(Message.MTOM_ENABLED)));
}
return result;
}
-
+
@Override
protected void afterConfiguration(String uri, String remaining, Endpoint endpoint, Map<String, Object> parameters) throws Exception {
CxfEndpoint cxfEndpoint = (CxfEndpoint) endpoint;
cxfEndpoint.updateEndpointUri(uri);
}
-
}
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1138303&r1=1138302&r2=1138303&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Wed Jun 22 05:06:59 2011
@@ -21,9 +21,9 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
-
import javax.xml.ws.WebServiceProvider;
import org.w3c.dom.Element;
+
import org.apache.camel.CamelContext;
import org.apache.camel.CamelException;
import org.apache.camel.Consumer;
@@ -65,17 +65,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
-
/**
* Defines the <a href="http://camel.apache.org/cxf.html">CXF Endpoint</a>.
- * It contains a list of properties for CXF endpoint including {@link DataFormat},
- * {@link CxfBinding}, and {@link HeaderFilterStrategy}. The default DataFormat
- * mode is {@link DataFormat#POJO}.
- *
- * @version
+ * It contains a list of properties for CXF endpoint including {@link DataFormat},
+ * {@link CxfBinding}, and {@link HeaderFilterStrategy}. The default DataFormat
+ * mode is {@link DataFormat#POJO}.
*/
public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, Service {
-
+
private static final Logger LOG = LoggerFactory.getLogger(CxfEndpoint.class);
private String wsdlURL;
@@ -104,19 +101,24 @@ public class CxfEndpoint extends Default
public CxfEndpoint(String remaining, CxfComponent cxfComponent) {
super(remaining, cxfComponent);
- setAddress(remaining);
+ setAddress(remaining);
}
-
+
public CxfEndpoint(String remaining, CamelContext context) {
super(remaining, context);
setAddress(remaining);
}
-
+
+ public CxfEndpoint(String remaining) {
+ super(remaining);
+ setAddress(remaining);
+ }
+
// This method is for CxfComponent setting the EndpointUri
protected void updateEndpointUri(String endpointUri) {
super.setEndpointUri(endpointUri);
}
-
+
public Producer createProducer() throws Exception {
Producer answer = new CxfProducer(this);
if (isSynchronous()) {
@@ -129,32 +131,32 @@ public class CxfEndpoint extends Default
public Consumer createConsumer(Processor processor) throws Exception {
return new CxfConsumer(this, processor);
}
-
+
public boolean isSingleton() {
return true;
}
-
+
/**
* Populate server factory bean
*/
protected void setupServerFactoryBean(ServerFactoryBean sfb, Class<?> cls) {
-
+
// address
sfb.setAddress(getAddress());
-
+
// service class
- sfb.setServiceClass(cls);
+ sfb.setServiceClass(cls);
// wsdl url
if (getWsdlURL() != null) {
sfb.setWsdlURL(getWsdlURL());
}
-
+
// service name qname
if (getServiceName() != null) {
sfb.setServiceName(CxfEndpointUtils.getQName(getServiceName()));
}
-
+
// port qname
if (getPortName() != null) {
sfb.setEndpointName(CxfEndpointUtils.getQName(getPortName()));
@@ -170,7 +172,7 @@ public class CxfEndpoint extends Default
} else {
LOG.debug("Ignore DataFormat mode {} since SEI class is annotated with WebServiceProvider", getDataFormat());
}
-
+
if (loggingFeatureEnabled) {
sfb.getFeatures().add(new LoggingFeature());
}
@@ -178,7 +180,7 @@ public class CxfEndpoint extends Default
if (getDataFormat() == DataFormat.PAYLOAD) {
sfb.setDataBinding(new HybridSourceDataBinding());
}
-
+
// set the document-literal wrapped style
if (getWrappedStyle() != null) {
sfb.getServiceFactory().setWrapped(getWrappedStyle());
@@ -198,7 +200,7 @@ public class CxfEndpoint extends Default
sfb.setBus(getBus());
sfb.setStart(false);
}
-
+
/**
* Create a client factory bean object. Notice that the serviceClass <b>must</b> be
* an interface.
@@ -211,7 +213,6 @@ public class CxfEndpoint extends Default
return new CamelCxfClientImpl(getBus(), ep);
}
});
-
} else {
return new ClientProxyFactoryBean(new ClientFactoryBean() {
@Override
@@ -221,23 +222,22 @@ public class CxfEndpoint extends Default
});
}
}
-
+
/**
* Create a client factory bean object without serviceClass interface.
*/
protected ClientFactoryBean createClientFactoryBean() {
return new ClientFactoryBean(new WSDLServiceFactoryBean()) {
-
+
@Override
protected Client createClient(Endpoint ep) {
return new CamelCxfClientImpl(getBus(), ep);
}
-
+
@Override
protected void initializeAnnotationInterceptors(Endpoint ep, Class<?> cls) {
// Do nothing here
}
-
};
}
@@ -247,20 +247,20 @@ public class CxfEndpoint extends Default
// update the bus configuration with the applicationContext
// which SpringCamelContext holds
if (getCamelContext() instanceof SpringCamelContext) {
- SpringCamelContext springCamelContext = (SpringCamelContext)getCamelContext();
+ SpringCamelContext springCamelContext = (SpringCamelContext) getCamelContext();
ApplicationContext applicationContext = springCamelContext.getApplicationContext();
busFactory = new org.apache.cxf.bus.spring.SpringBusFactory(applicationContext);
}
return busFactory.createBus();
}
-
+
/**
* Populate a client factory bean
*/
- protected void setupClientFactoryBean(ClientProxyFactoryBean factoryBean, Class<?> cls) {
+ protected void setupClientFactoryBean(ClientProxyFactoryBean factoryBean, Class<?> cls) {
// service class
factoryBean.setServiceClass(cls);
-
+
// address
factoryBean.setAddress(getAddress());
@@ -268,12 +268,12 @@ public class CxfEndpoint extends Default
if (getWsdlURL() != null) {
factoryBean.setWsdlURL(getWsdlURL());
}
-
+
// service name qname
if (getServiceName() != null) {
factoryBean.setServiceName(CxfEndpointUtils.getQName(getServiceName()));
}
-
+
// port name qname
if (getPortName() != null) {
factoryBean.setEndpointName(CxfEndpointUtils.getQName(getPortName()));
@@ -286,16 +286,16 @@ public class CxfEndpoint extends Default
factoryBean.getFeatures().add(new PayLoadDataFormatFeature());
factoryBean.setDataBinding(new HybridSourceDataBinding());
}
-
+
if (loggingFeatureEnabled) {
factoryBean.getFeatures().add(new LoggingFeature());
}
-
+
// set the document-literal wrapped style
if (getWrappedStyle() != null) {
factoryBean.getServiceFactory().setWrapped(getWrappedStyle());
}
-
+
// set the properties on CxfProxyFactoryBean
if (getProperties() != null) {
if (factoryBean.getProperties() != null) {
@@ -306,12 +306,11 @@ public class CxfEndpoint extends Default
}
LOG.debug("ClientProxyFactoryBean: {} added properties: {}", factoryBean, properties);
}
-
+
factoryBean.setBus(getBus());
-
}
- protected void setupClientFactoryBean(ClientFactoryBean factoryBean) {
+ protected void setupClientFactoryBean(ClientFactoryBean factoryBean) {
// address
factoryBean.setAddress(getAddress());
@@ -319,12 +318,12 @@ public class CxfEndpoint extends Default
if (getWsdlURL() != null) {
factoryBean.setWsdlURL(getWsdlURL());
}
-
+
// service name qname
if (getServiceName() != null) {
factoryBean.setServiceName(CxfEndpointUtils.getQName(getServiceName()));
}
-
+
// port name qname
if (getPortName() != null) {
factoryBean.setEndpointName(CxfEndpointUtils.getQName(getPortName()));
@@ -337,42 +336,42 @@ public class CxfEndpoint extends Default
factoryBean.getFeatures().add(new PayLoadDataFormatFeature());
factoryBean.setDataBinding(new HybridSourceDataBinding());
}
-
+
if (loggingFeatureEnabled) {
factoryBean.getFeatures().add(new LoggingFeature());
}
-
+
// set the document-literal wrapped style
if (getWrappedStyle() != null) {
factoryBean.getServiceFactory().setWrapped(getWrappedStyle());
}
-
- factoryBean.setBus(getBus());
+
+ factoryBean.setBus(getBus());
}
-
+
// Package private methods
// -------------------------------------------------------------------------
-
+
/**
* Create a CXF client object
*/
Client createClient() throws Exception {
// get service class
- if (getDataFormat().equals(DataFormat.POJO)) {
- ObjectHelper.notEmpty(getServiceClass(), CxfConstants.SERVICE_CLASS);
+ if (getDataFormat().equals(DataFormat.POJO)) {
+ ObjectHelper.notEmpty(getServiceClass(), CxfConstants.SERVICE_CLASS);
}
-
+
if (getWsdlURL() == null && getServiceClass() == null) {
// no WSDL and serviceClass specified, set our default serviceClass
setServiceClass(org.apache.camel.component.cxf.DefaultSEI.class.getName());
setDefaultOperationNamespace(CxfConstants.DISPATCH_NAMESPACE);
- setDefaultOperationName(CxfConstants.DISPATCH_DEFAULT_OPERATION_NAMESPACE);
- if (getDataFormat().equals(DataFormat.PAYLOAD)) {
+ setDefaultOperationName(CxfConstants.DISPATCH_DEFAULT_OPERATION_NAMESPACE);
+ if (getDataFormat().equals(DataFormat.PAYLOAD)) {
setSkipPayloadMessagePartCheck(true);
}
}
-
+
Class<?> cls = null;
if (getServiceClass() != null) {
cls = ClassLoaderUtils.loadClass(getServiceClass(), getClass());
@@ -380,19 +379,18 @@ public class CxfEndpoint extends Default
ClientProxyFactoryBean factoryBean = createClientFactoryBean(cls);
// setup client factory bean
setupClientFactoryBean(factoryBean, cls);
- return ((ClientProxy)Proxy.getInvocationHandler(factoryBean.create())).getClient();
- } else {
+ return ((ClientProxy) Proxy.getInvocationHandler(factoryBean.create())).getClient();
+ } else {
checkName(portName, "endpoint/port name");
checkName(serviceName, "service name");
-
+
ClientFactoryBean factoryBean = createClientFactoryBean();
// setup client factory bean
setupClientFactoryBean(factoryBean);
return factoryBean.create();
}
-
}
-
+
void checkName(Object value, String name) {
if (ObjectHelper.isEmpty(value)) {
LOG.warn("The " + name + " of " + this.getEndpointUri() + " is empty, cxf will try to load the first one in wsdl for you.");
@@ -405,17 +403,17 @@ public class CxfEndpoint extends Default
ServerFactoryBean createServerFactoryBean() throws Exception {
Class<?> cls = null;
- if (getDataFormat() == DataFormat.POJO || getServiceClass() != null) {
+ if (getDataFormat() == DataFormat.POJO || getServiceClass() != null) {
// get service class
- ObjectHelper.notEmpty(getServiceClass(), CxfConstants.SERVICE_CLASS);
+ ObjectHelper.notEmpty(getServiceClass(), CxfConstants.SERVICE_CLASS);
cls = ClassLoaderUtils.loadClass(getServiceClass(), getClass());
}
-
+
// create server factory bean
// Shouldn't use CxfEndpointUtils.getServerFactoryBean(cls) as it is for
// CxfSoapComponent
ServerFactoryBean answer = null;
-
+
if (cls == null) {
checkName(portName, " endpoint/port name");
checkName(serviceName, " service name");
@@ -425,12 +423,12 @@ public class CxfEndpoint extends Default
} else {
answer = new ServerFactoryBean();
}
-
+
// setup server factory bean
setupServerFactoryBean(answer, cls);
return answer;
}
-
+
// Properties
// -------------------------------------------------------------------------
@@ -441,11 +439,11 @@ public class CxfEndpoint extends Default
public void setDataFormat(DataFormat format) {
dataFormat = format;
}
-
+
public String getPublishedEndpointUrl() {
return publishedEndpointUrl;
}
-
+
public void setPublishedEndpointUrl(String url) {
publishedEndpointUrl = url;
}
@@ -457,15 +455,15 @@ public class CxfEndpoint extends Default
public void setWsdlURL(String url) {
wsdlURL = url;
}
-
- public String getServiceClass() {
+
+ public String getServiceClass() {
return serviceClass;
}
-
+
public void setServiceClass(String className) {
serviceClass = className;
}
-
+
public void setServiceClass(Object instance) {
serviceClass = ClassHelper.getRealClass(instance).getName();
}
@@ -477,27 +475,27 @@ public class CxfEndpoint extends Default
public String getServiceName() {
return serviceName;
}
-
+
public String getPortName() {
return portName;
}
-
+
public void setPortName(String port) {
portName = port;
}
-
+
public String getDefaultOperationName() {
return defaultOperationName;
}
-
+
public void setDefaultOperationName(String name) {
defaultOperationName = name;
}
-
+
public String getDefaultOperationNamespace() {
return defaultOperationNamespace;
}
-
+
public void setDefaultOperationNamespace(String namespace) {
defaultOperationNamespace = namespace;
}
@@ -517,11 +515,11 @@ public class CxfEndpoint extends Default
public void setWrapped(boolean wrapped) {
isWrapped = wrapped;
}
-
+
public Boolean getWrappedStyle() {
return wrappedStyle;
}
-
+
public void setWrappedStyle(Boolean wrapped) {
wrappedStyle = wrapped;
}
@@ -537,8 +535,7 @@ public class CxfEndpoint extends Default
public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy) {
this.headerFilterStrategy = headerFilterStrategy;
if (cxfBinding instanceof HeaderFilterStrategyAware) {
- ((HeaderFilterStrategyAware)cxfBinding)
- .setHeaderFilterStrategy(headerFilterStrategy);
+ ((HeaderFilterStrategyAware) cxfBinding).setHeaderFilterStrategy(headerFilterStrategy);
}
}
@@ -570,7 +567,7 @@ public class CxfEndpoint extends Default
public boolean isSetDefaultBus() {
return isSetDefaultBus;
}
-
+
public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) {
this.loggingFeatureEnabled = loggingFeatureEnabled;
}
@@ -604,7 +601,7 @@ public class CxfEndpoint extends Default
cxfBinding = new DefaultCxfBinding();
}
if (cxfBinding instanceof HeaderFilterStrategyAware) {
- ((HeaderFilterStrategyAware)cxfBinding).setHeaderFilterStrategy(getHeaderFilterStrategy());
+ ((HeaderFilterStrategyAware) cxfBinding).setHeaderFilterStrategy(getHeaderFilterStrategy());
}
}
@@ -634,44 +631,45 @@ public class CxfEndpoint extends Default
* to insert parameters into CXF Message for {@link DataFormat#PAYLOAD} mode.
*/
class CamelCxfClientImpl extends ClientImpl {
-
+
public CamelCxfClientImpl(Bus bus, Endpoint ep) {
super(bus, ep);
}
-
+
public Bus getBus() {
return bus;
}
-
+
@SuppressWarnings("unchecked")
@Override
protected void setParameters(Object[] params, Message message) {
-
+
Object attachements = message.get(CxfConstants.CAMEL_CXF_ATTACHMENTS);
if (attachements != null) {
- message.setAttachments((Collection<Attachment>)attachements);
+ message.setAttachments((Collection<Attachment>) attachements);
message.remove(CxfConstants.CAMEL_CXF_ATTACHMENTS);
}
-
+
if (DataFormat.PAYLOAD == message.get(DataFormat.class)) {
-
- CxfPayload<?> payload = (CxfPayload<?>)params[0];
+
+ CxfPayload<?> payload = (CxfPayload<?>) params[0];
List<Element> elements = payload.getBody();
-
+
BindingOperationInfo boi = message.get(BindingOperationInfo.class);
MessageContentsList content = new MessageContentsList();
int i = 0;
-
+
for (MessagePartInfo partInfo : boi.getInput().getMessageParts()) {
- if (elements.size() > i && (isSkipPayloadMessagePartCheck() || partInfo.getConcreteName().getLocalPart()
- .equals(elements.get(i).getLocalName()))) {
+ if (elements.size() > i && (isSkipPayloadMessagePartCheck() || partInfo.getConcreteName().getLocalPart().equals(elements.get(i)
+ .getLocalName()))) {
content.put(partInfo, elements.get(i++));
}
}
-
+
if (content.size() < elements.size()) {
LOG.warn("Cannot set right payload paremeters. Please check the BindingOperation and PayLoadMessage.");
- throw new IllegalArgumentException("The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.");
+ throw new IllegalArgumentException(
+ "The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.");
}
message.setContent(List.class, content);
@@ -679,9 +677,8 @@ public class CxfEndpoint extends Default
} else {
super.setParameters(params, message);
}
-
+
message.remove(DataFormat.class);
}
}
-
}
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointBean.java?rev=1138303&r1=1138302&r2=1138303&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointBean.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointBean.java Wed Jun 22 05:06:59 2011
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -17,7 +17,6 @@
package org.apache.camel.component.cxf;
import java.util.List;
-
import javax.xml.ws.handler.Handler;
import org.apache.cxf.BusFactory;
@@ -27,9 +26,8 @@ import org.springframework.beans.factory
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.NamedBean;
-public class CxfEndpointBean extends AbstractServiceFactory
- implements DisposableBean, BeanNameAware, NamedBean {
-
+public class CxfEndpointBean extends AbstractServiceFactory implements DisposableBean, BeanNameAware, NamedBean {
+
private List<Handler> handlers;
private List<String> schemaLocations;
private String beanName;
@@ -37,15 +35,15 @@ public class CxfEndpointBean extends Abs
public CxfEndpointBean() {
this(new ReflectionServiceFactoryBean());
}
-
+
public CxfEndpointBean(ReflectionServiceFactoryBean factory) {
setServiceFactory(factory);
}
-
+
public List<Handler> getHandlers() {
return handlers;
}
-
+
public void setHandlers(List<Handler> handlers) {
this.handlers = handlers;
}
@@ -71,5 +69,4 @@ public class CxfEndpointBean extends Abs
public List<String> getSchemaLocations() {
return schemaLocations;
}
-
}
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java?rev=1138303&r1=1138302&r2=1138303&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java Wed Jun 22 05:06:59 2011
@@ -51,7 +51,8 @@ public class CxfNamespaceHandler impleme
answer = new EndpointDefinitionParser().parse(element, context);
}
} finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
+ //TODO https://issues.apache.org/jira/browse/CAMEL-4137
+ //Thread.currentThread().setContextClassLoader(oldClassLoader);
}
return answer;
}
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java?rev=1138303&r1=1138302&r2=1138303&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java Wed Jun 22 05:06:59 2011
@@ -17,30 +17,21 @@
package org.apache.camel.component.cxf.blueprint;
-import java.util.Set;
import java.util.StringTokenizer;
import java.util.concurrent.Callable;
-
import javax.xml.namespace.QName;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
-import org.apache.aries.blueprint.ComponentDefinitionRegistry;
-import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor;
+
import org.apache.aries.blueprint.ParserContext;
import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
-import org.apache.aries.blueprint.mutable.MutablePassThroughMetadata;
-import org.apache.aries.blueprint.reflect.BeanMetadataImpl;
-import org.apache.camel.blueprint.BlueprintCamelContext;
import org.apache.camel.component.cxf.CxfBlueprintEndpoint;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser;
import org.apache.cxf.helpers.DOMUtils;
-import org.osgi.service.blueprint.container.BlueprintContainer;
-import org.osgi.service.blueprint.reflect.ComponentMetadata;
import org.osgi.service.blueprint.reflect.Metadata;
-
public class EndpointDefinitionParser extends AbstractBPBeanDefinitionParser {
public static String getIdOrName(Element elem) {
@@ -69,7 +60,7 @@ public class EndpointDefinitionParser ex
} else {
endpointConfig.setId("camel.cxf.endpoint." + context.generateId());
}
-
+
NamedNodeMap atts = element.getAttributes();
String bus = null;
@@ -123,20 +114,6 @@ public class EndpointDefinitionParser ex
endpointConfig.setDestroyMethod("destroy");
endpointConfig.addArgument(AbstractBPBeanDefinitionParser.createValue(context, address), String.class.getName(), 0);
- //Register a bean that will post-process and pick the first available camelContext to attach our endpoint to.
- MutablePassThroughMetadata regProcessorFactory = context.createMetadata(MutablePassThroughMetadata.class);
- regProcessorFactory.setId(context.generateId());
- regProcessorFactory.setObject(new PassThroughCallable<Object>(new CxfCamelContextFinder(endpointConfig.getId(), context)));
-
- MutableBeanMetadata regProcessor = context.createMetadata(MutableBeanMetadata.class);
- regProcessor.setId(context.generateId());
- regProcessor.setRuntimeClass(CxfCamelContextFinder.class);
- regProcessor.setFactoryComponent(regProcessorFactory);
- regProcessor.setFactoryMethod("call");
- regProcessor.setProcessor(true);
- regProcessor.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
- context.getComponentDefinitionRegistry().registerComponentDefinition(regProcessor);
-
return endpointConfig;
}
@@ -152,37 +129,4 @@ public class EndpointDefinitionParser ex
return value;
}
}
-
- public static class CxfCamelContextFinder implements ComponentDefinitionRegistryProcessor {
-
- private final String cxfEndpointName;
- private final ParserContext context;
- private BlueprintContainer blueprintContainer;
-
- public CxfCamelContextFinder(String cxfEndpointName, ParserContext context) {
- this.cxfEndpointName = cxfEndpointName;
- this.context = context;
- }
-
- public void setBlueprintContainer(BlueprintContainer blueprintContainer) {
- this.blueprintContainer = blueprintContainer;
- }
-
- @SuppressWarnings("unchecked")
- public void process(ComponentDefinitionRegistry componentDefinitionRegistry) {
- MutableBeanMetadata bean = (MutableBeanMetadata) blueprintContainer.getComponentMetadata(cxfEndpointName);
-
- Set<String> components = componentDefinitionRegistry.getComponentDefinitionNames();
- for (String componentName : components) {
- ComponentMetadata metaData = context.getComponentDefinitionRegistry().getComponentDefinition(componentName);
- if (metaData instanceof BeanMetadataImpl) {
- BeanMetadataImpl bim = (BeanMetadataImpl) metaData;
- if (bim.getRuntimeClass().isAssignableFrom(BlueprintCamelContext.class)) {
- //Found a CamelContext
- bean.addArgument(createRef(context, metaData.getId()), BlueprintCamelContext.class.getName(), 1);
- }
- }
- }
- }
- }
}