Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 22513 invoked from network); 16 Oct 2008 07:31:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Oct 2008 07:31:41 -0000 Received: (qmail 11251 invoked by uid 500); 16 Oct 2008 07:31:42 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 11194 invoked by uid 500); 16 Oct 2008 07:31:42 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 11164 invoked by uid 99); 16 Oct 2008 07:31:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Oct 2008 00:31:41 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Oct 2008 07:30:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D0213238896F; Thu, 16 Oct 2008 00:31:19 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r705156 - in /cxf/branches/2.0.x-fixes: ./ integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java Date: Thu, 16 Oct 2008 07:31:19 -0000 To: commits@cxf.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081016073119.D0213238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Thu Oct 16 00:31:19 2008 New Revision: 705156 URL: http://svn.apache.org/viewvc?rev=705156&view=rev Log: Merged revisions 705153 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes ................ r705153 | ningjiang | 2008-10-16 15:21:11 +0800 (Thu, 16 Oct 2008) | 9 lines 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.0.x-fixes/ (props changed) cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Oct 16 00:31:19 2008 @@ -1,3 +1,3 @@ -/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242 -/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239 +/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242,705153 +/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239,705150 /incubator/cxf/trunk:434594-651668 Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java?rev=705156&r1=705155&r2=705156&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java (original) +++ cxf/branches/2.0.x-fixes/integration/jca/src/main/java/org/apache/cxf/jca/inbound/MDBActivationWork.java Thu Oct 16 00:31:19 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