Author: ningjiang
Date: Thu Dec 25 00:44:49 2008
New Revision: 729403
URL: http://svn.apache.org/viewvc?rev=729403&view=rev
Log:
Merged revisions 729401 via svnmerge from
https://svn.apache.org/repos/asf/activemq/camel/trunk
........
r729401 | ningjiang | 2008-12-25 16:28:08 +0800 (Thu, 25 Dec 2008) | 1 line
CAMEL-1204 support to configure the serviceName and endpointName from the
cxfEndpoint's properties
........
Modified:
activemq/camel/branches/camel-1.x/ (props changed)
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 25 00:44:49 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572,725612,725652-725660,725715,725883,726339,726640-726645,726932,727113,727375,727377,727624,727713,727946
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572,725612,725652-725660,725715,725883,726339,726640-726645,726932,727113,727375,727377,727624,727713,727946,729401
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java?rev=729403&r1=729402&r2=729403&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
(original)
+++
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
Thu Dec 25 00:44:49 2008
@@ -30,6 +30,10 @@
String ADDRESS = "address";
String SERVICE_NAME = "serviceName";
String PORT_NAME = "portName";
+ String SERVICE_LOCALNAME = "serviceLocalName";
+ String SERVICE_NAMESPACE = "serviceNamespace";
+ String PORT_LOCALNAME = "endpointLocalName";
+ String PORT_NAMESPACE = "endpointNamespace";
String PROTOCOL_NAME_RES = "res";
String OPERATION_NAME = "operationName";
String OPERATION_NAMESPACE = "operationNameSpace";
Modified:
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=729403&r1=729402&r2=729403&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
(original)
+++
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
Thu Dec 25 00:44:49 2008
@@ -72,17 +72,19 @@
svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);
isWebServiceProvider =
CxfEndpointUtils.hasAnnotation(serviceClass, WebServiceProvider.class);
svrBean.setAddress(endpoint.getAddress());
- svrBean.setServiceClass(serviceClass);
- if (endpoint.getServiceName() != null) {
-
svrBean.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
- }
- if (endpoint.getPortName() != null) {
-
svrBean.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
- }
+ svrBean.setServiceClass(serviceClass);
if (endpoint.getWsdlURL() != null) {
svrBean.setWsdlURL(endpoint.getWsdlURL());
}
}
+
+ if (CxfEndpointUtils.getServiceName(endpoint) != null) {
+ svrBean.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
+ }
+ if (CxfEndpointUtils.getServiceName(endpoint) != null) {
+ svrBean.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
+ }
+
DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
svrBean.setInvoker(new CamelInvoker(this));
Modified:
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=729403&r1=729402&r2=729403&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
(original)
+++
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
Thu Dec 25 00:44:49 2008
@@ -137,19 +137,19 @@
} catch (ClassNotFoundException e) {
throw new CamelException(e);
}
-
- if (endpoint.getServiceName() != null) {
- cfb.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
- }
- if (endpoint.getPortName() != null) {
- cfb.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
-
- }
+
if (endpoint.getWsdlURL() != null) {
cfb.setWsdlURL(endpoint.getWsdlURL());
}
}
+ if (CxfEndpointUtils.getServiceName(endpoint) != null) {
+ cfb.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
+ }
+ if (CxfEndpointUtils.getPortName(endpoint) != null) {
+ cfb.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
+ }
+
if (dataFormat.equals(DataFormat.MESSAGE)) {
cfb.getFeatures().add(new MessageDataFormatFeature());
} else if (dataFormat.equals(DataFormat.PAYLOAD)) {
Modified:
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java?rev=729403&r1=729402&r2=729403&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
(original)
+++
activemq/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
Thu Dec 25 00:44:49 2008
@@ -74,11 +74,31 @@
}
public static QName getPortName(final CxfEndpoint endpoint) {
- return getQName(endpoint.getPortName());
+ if (endpoint.getPortName() != null) {
+ return getQName(endpoint.getPortName());
+ } else {
+ String portLocalName = getCxfEndpointPropertyValue(endpoint,
CxfConstants.PORT_LOCALNAME);
+ String portNamespace = getCxfEndpointPropertyValue(endpoint,
CxfConstants.PORT_NAMESPACE);
+ if (portLocalName != null) {
+ return new QName(portNamespace, portLocalName);
+ } else {
+ return null;
+ }
+ }
}
public static QName getServiceName(final CxfEndpoint endpoint) {
- return getQName(endpoint.getServiceName());
+ if (endpoint.getServiceName() != null) {
+ return getQName(endpoint.getServiceName());
+ } else {
+ String serviceLocalName = getCxfEndpointPropertyValue(endpoint,
CxfConstants.SERVICE_LOCALNAME);
+ String serviceNamespace = getCxfEndpointPropertyValue(endpoint,
CxfConstants.SERVICE_NAMESPACE);
+ if (serviceLocalName != null) {
+ return new QName(serviceNamespace, serviceLocalName);
+ } else {
+ return null;
+ }
+ }
}
public static EndpointInfo getEndpointInfo(final Service service, final
CxfEndpoint endpoint) {
@@ -248,14 +268,20 @@
throw new CamelException("serviceClass is required for CXF
endpoint configuration");
}
}
-
+
+ public static String getCxfEndpointPropertyValue(CxfEndpoint endpoint,
String property) {
+ String result = null;
+ CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
+ if (cxfEndpointBean != null && cxfEndpointBean.getProperties() !=
null) {
+ result = (String) cxfEndpointBean.getProperties().get(property);
+ }
+ return result;
+ }
+
public static DataFormat getDataFormat(CxfEndpoint endpoint) throws
CamelException {
String dataFormatString = endpoint.getDataFormat();
if (dataFormatString == null) {
- CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
- if (cxfEndpointBean != null && cxfEndpointBean.getProperties() !=
null) {
- dataFormatString = (String)
cxfEndpointBean.getProperties().get(CxfConstants.DATA_FORMAT);
- }
+ dataFormatString = getCxfEndpointPropertyValue(endpoint,
CxfConstants.DATA_FORMAT);
}
// return the default value if nothing is set
Modified:
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java?rev=729403&r1=729402&r2=729403&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
(original)
+++
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
Thu Dec 25 00:44:49 2008
@@ -32,7 +32,8 @@
// set up the port name and service name
protected static final QName SERVICE_NAME =
new QName("http://www.example.com/test", "ServiceName");
-
+ protected static final QName PORT_NAME =
+ new QName("http://www.example.com/test", "PortName");
private static final String CXF_BASE_URI =
"cxf://http://www.example.com/testaddress"
+ "?serviceClass=org.apache.camel.component.cxf.HelloService"
Modified:
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java?rev=729403&r1=729402&r2=729403&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
(original)
+++
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
Thu Dec 25 00:44:49 2008
@@ -81,6 +81,12 @@
assertEquals("We should get the setDefaultBus value",
CxfEndpointUtils.getSetDefaultBus(endpoint),
true);
assertEquals("The cxf endpoint's DataFromat should be MESSAGE",
CxfEndpointUtils.getDataFormat(endpoint), DataFormat.MESSAGE);
+
+ endpoint = createEndpoint("cxf:bean:testPropertiesEndpoint");
+ service = CxfEndpointUtils.getServiceName(endpoint);
+ assertEquals("We should get the right service name", service,
SERVICE_NAME);
+ QName port = CxfEndpointUtils.getPortName(endpoint);
+ assertEquals("We should get the right endpoint name", port, PORT_NAME);
}
public void testGetDataFormatFromCxfEndpontProperties() throws Exception {
Modified:
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml?rev=729403&r1=729402&r2=729403&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml
(original)
+++
activemq/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/util/CxfEndpointBeans.xml
Thu Dec 25 00:44:49 2008
@@ -42,6 +42,15 @@
xmlns:s="http://www.example.com/test">
</cxf:cxfEndpoint>
+ <cxf:cxfEndpoint id="testPropertiesEndpoint"
address="http://localhost:9000/router"
+ xmlns:s="http://www.example.com/test">
+ <cxf:properties>
+ <entry key="serviceLocalName" value="ServiceName"/>
+ <entry key="serviceNamespace" value="http://www.example.com/test"/>
+ <entry key="endpointLocalName" value="PortName"/>
+ <entry key="endpointNamespace" value="http://www.example.com/test"/>
+ </cxf:properties>
+ </cxf:cxfEndpoint>
</beans>