Author: ningjiang
Date: Thu Oct 16 00:21:11 2008
New Revision: 705153
URL: http://svn.apache.org/viewvc?rev=705153&view=rev
Log:
Merged revisions 705150 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r705150 | ningjiang | 2008-10-16 15:15:46 +0800 (Thu, 16 Oct 2008) | 1 line
CXF-1872 Applied patch with thanks to William
........
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 16 00:21:11 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java?rev=705153&r1=705152&r2=705153&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
(original)
+++
cxf/branches/2.1.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java
Thu Oct 16 00:21:11 2008
@@ -18,9 +18,11 @@
*/
package org.apache.cxf.jca.inbound;
+import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.logging.Level;
import java.util.logging.Logger;
import javax.resource.spi.UnavailableException;
@@ -29,10 +31,13 @@
import javax.resource.spi.work.Work;
import javax.xml.namespace.QName;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.jaxws.EndpointUtils;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
@@ -108,6 +113,38 @@
}
}
+ Bus bus = null;
+ if (spec.getBusConfigLocation() != null) {
+ URL url = classLoader.getResource(spec.getBusConfigLocation());
+ if (url == null) {
+ LOG.warning("Unable to get bus configuration from "
+ + spec.getBusConfigLocation());
+ } else {
+ bus = new SpringBusFactory().createBus(url);
+ }
+ }
+
+ if (bus == null) {
+ bus = BusFactory.getDefaultBus();
+ }
+
+ MDBInvoker invoker = createInvoker(endpoint);
+ Server server = createServer(bus, serviceClass, invoker);
+
+ if (server == null) {
+ LOG.severe("Failed to create CXF facade service endpoint.");
+ return;
+ }
+
+ server.start();
+
+ // save the server for clean up later
+ endpoints.put(spec.getDisplayName(), new InboundEndpoint(server,
invoker));
+ }
+
+
+ private Server createServer(Bus bus, Class<?> serviceClass, MDBInvoker
invoker) {
+
// create server bean factory
ServerFactoryBean factory = null;
if (serviceClass != null &&
EndpointUtils.hasWebServiceAnnotation(serviceClass)) {
@@ -116,6 +153,10 @@
factory = new ServerFactoryBean();
}
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Creating a server using " +
factory.getClass().getName());
+ }
+
if (serviceClass != null) {
factory.setServiceClass(serviceClass);
}
@@ -127,12 +168,9 @@
if (spec.getAddress() != null) {
factory.setAddress(spec.getAddress());
}
-
- if (spec.getBusConfigLocation() != null) {
- factory.setBus(new SpringBusFactory().createBus(classLoader
- .getResource(spec.getBusConfigLocation())));
- }
-
+
+ factory.setBus(bus);
+
if (spec.getEndpointName() != null) {
factory.setEndpointName(QName.valueOf(spec.getEndpointName()));
}
@@ -145,18 +183,37 @@
factory.setServiceName(QName.valueOf(spec.getServiceName()));
}
- MDBInvoker invoker = createInvoker(endpoint);
factory.setInvoker(invoker);
-
- // create and start the server
- factory.setStart(true);
- Server server = factory.create();
-
- // save the server for clean up later
- endpoints.put(spec.getDisplayName(), new InboundEndpoint(server,
invoker));
+ // Don't start the server yet
+ factory.setStart(false);
+
+ Server retval = null;
+ if (factory instanceof JaxWsServerFactoryBean) {
+ retval =
createServerFromJaxwsEndpoint((JaxWsServerFactoryBean)factory);
+ } else {
+ retval = factory.create();
+ }
+
+ return retval;
}
+ /*
+ * Creates a server from EndpointImpl so that jaxws-endpoint config can be
injected.
+ */
+ private Server createServerFromJaxwsEndpoint(JaxWsServerFactoryBean
factory) {
+
+ EndpointImpl endpoint = new EndpointImpl(factory.getBus(), null,
factory);
+
+ endpoint.setWsdlLocation(factory.getWsdlURL());
+ endpoint.setImplementorClass(factory.getServiceClass());
+ endpoint.setEndpointName(factory.getEndpointName());
+ endpoint.setServiceName(factory.getServiceName());
+ endpoint.setInvoker(factory.getInvoker());
+ endpoint.setSchemaLocations(factory.getSchemaLocations());
+
+ return endpoint.getServer(factory.getAddress());
+ }
/**
* @param str