Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 38266 invoked from network); 25 Oct 2007 17:14:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Oct 2007 17:14:12 -0000 Received: (qmail 29150 invoked by uid 500); 25 Oct 2007 17:13:59 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 29101 invoked by uid 500); 25 Oct 2007 17:13:59 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 29092 invoked by uid 99); 25 Oct 2007 17:13:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2007 10:13:59 -0700 X-ASF-Spam-Status: No, hits=-96.5 required=10.0 tests=ALL_TRUSTED,URIBL_BLACK,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2007 19:14:36 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id ACAF51A984F; Thu, 25 Oct 2007 10:13:05 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r588283 [6/18] - in /incubator/cxf/branches/jliu: ./ api/ api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/io/ api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/phase/ api/src/main/java... Date: Thu, 25 Oct 2007 17:10:56 -0000 To: cxf-commits@incubator.apache.org From: jliu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071025171305.ACAF51A984F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/cxf/branches/jliu/pom.xml URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/pom.xml?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/pom.xml (original) +++ incubator/cxf/branches/jliu/pom.xml Thu Oct 25 10:09:20 2007 @@ -122,7 +122,7 @@ - Apache Software Foundation + The Apache Software Foundation http://www.apache.org/ @@ -137,8 +137,10 @@ integration systests maven-plugins/codegen-plugin + maven-plugins/java2ws-plugin maven-plugins/archetypes maven-plugins/eclipse-plugin-generator + @@ -271,18 +273,23 @@ + - + + + + + @@ -311,7 +318,7 @@ maven-gpg-plugin - 1.0-alpha-3 + 1.0-alpha-4 Modified: incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java (original) +++ incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java Thu Oct 25 10:09:20 2007 @@ -47,7 +47,7 @@ sf.setBus(getBus()); sf.setServiceClass(CustomerService.class); sf.getServiceFactory().setWrapped(false); - sf.setAddress("http://localhost:9001/foo/"); + sf.setAddress("http://localhost:9002/foo/"); sf.setServiceBean(new CustomerService()); //sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID); Modified: incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb (original) +++ incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb Thu Oct 25 10:09:20 2007 @@ -1,2 +1,18 @@ +# 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. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. GetDataResponse GetData Modified: incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb (original) +++ incubator/cxf/branches/jliu/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb Thu Oct 25 10:09:20 2007 @@ -1 +1,17 @@ +# 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. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. Customer Modified: incubator/cxf/branches/jliu/rt/bindings/jbi/pom.xml URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/jbi/pom.xml?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/jbi/pom.xml (original) +++ incubator/cxf/branches/jliu/rt/bindings/jbi/pom.xml Thu Oct 25 10:09:20 2007 @@ -75,7 +75,7 @@ org.apache.servicemix servicemix-jbi - ${servicemix.version} + provided @@ -118,10 +118,4 @@ http://svn.apache.org/viewvc/incubator/cxf/trunk/cxf-parent/cxf-rt-bindings-jbi - - - apache-incubator - http://people.apache.org/repo/m2-incubating-repository - - Modified: incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java (original) +++ incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapTransportFactory.java Thu Oct 25 10:09:20 2007 @@ -171,7 +171,7 @@ } DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); - if (null != dfm) { + if (null != dfm && activationNamespaces != null) { for (String ns : activationNamespaces) { dfm.registerDestinationFactory(ns, this); } Modified: incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java (original) +++ incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java Thu Oct 25 10:09:20 2007 @@ -91,14 +91,22 @@ Exchange ex = message.getExchange(); Endpoint ep = ex.get(Endpoint.class); + BindingOperationInfo bindingOp = null; + Collection bops = ep.getBinding().getBindingInfo().getOperations(); for (BindingOperationInfo boi : bops) { SoapOperationInfo soi = (SoapOperationInfo) boi.getExtensor(SoapOperationInfo.class); if (soi != null && soi.getAction().equals(action)) { - ex.put(BindingOperationInfo.class, boi); - ex.put(OperationInfo.class, boi.getOperationInfo()); - return; + if (bindingOp != null) { + //more than one op with the same action, will need to parse normally + return; + } + bindingOp = boi; } + } + if (bindingOp != null) { + ex.put(BindingOperationInfo.class, bindingOp); + ex.put(OperationInfo.class, bindingOp.getOperationInfo()); } } Modified: incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java (original) +++ incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java Thu Oct 25 10:09:20 2007 @@ -97,8 +97,9 @@ } } - - parameters.put(mpi, object); + if (object != null && mpi.getTypeClass() != null) { + parameters.put(mpi, object); + } } if (parameters.size() > 0) { message.setContent(List.class, parameters); Modified: incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original) +++ incubator/cxf/branches/jliu/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Thu Oct 25 10:09:20 2007 @@ -98,6 +98,7 @@ xtw.writeNamespace(soapVersion.getPrefix(), soapVersion.getNamespace()); boolean preexistingHeaders = message.hasHeaders(); + if (preexistingHeaders) { xtw.writeStartElement(soapVersion.getPrefix(), soapVersion.getHeader().getLocalPart(), @@ -172,10 +173,13 @@ if (headers == null) { return endedHeader; } - + for (SoapHeaderInfo header : headers) { MessagePartInfo part = header.getPart(); - + if (part.getIndex() >= objs.size()) { + // The optional out of band header is not a part of parameters of the method + continue; + } Object arg = objs.get(part); objs.remove(part); if (!(startedHeader || preexistingHeaders)) { Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java Thu Oct 25 10:09:20 2007 @@ -60,7 +60,7 @@ private PushbackInputStream stream; - private String boundary; + private byte boundary[]; private String contentType; @@ -95,19 +95,20 @@ } if (contentType.toLowerCase().indexOf("multipart/related") != -1) { - boundary = findBoundaryFromContentType(contentType); - if (null == boundary) { - boundary = findBoundaryFromInputStream(); + String boundaryString = findBoundaryFromContentType(contentType); + if (null == boundaryString) { + boundaryString = findBoundaryFromInputStream(); } // If a boundary still wasn't found, throw an exception - if (null == boundary) { + if (null == boundaryString) { throw new IOException("Couldn't determine the boundary from the message!"); } + boundary = boundaryString.getBytes(); stream = new PushbackInputStream(message.getContent(InputStream.class), - boundary.getBytes().length * 2); - if (!readTillFirstBoundary(stream, boundary.getBytes())) { - throw new IOException("Couldn't find MIME boundary: " + boundary); + boundary.length * 2); + if (!readTillFirstBoundary(stream, boundary)) { + throw new IOException("Couldn't find MIME boundary: " + new String(boundary)); } try { @@ -117,7 +118,7 @@ throw new RuntimeException(e); } - body = new DelegatingInputStream(new MimeBodyPartInputStream(stream, boundary.getBytes())); + body = new DelegatingInputStream(new MimeBodyPartInputStream(stream, boundary)); message.setContent(InputStream.class, body); } } @@ -129,17 +130,16 @@ } private String findBoundaryFromInputStream() throws IOException { - CachedOutputStream bos = new CachedOutputStream(); - InputStream is = message.getContent(InputStream.class); - IOUtils.copy(is, bos); - - is.close(); - bos.close(); - String msg = bos.toString(); - + //boundary should definitely be in the first 2K; + PushbackInputStream in = new PushbackInputStream(is, 4096); + byte buf[] = new byte[2048]; + int i = in.read(buf); + String msg = new String(buf, 0, i); + in.unread(buf, 0, i); + // Reset the input stream since we'll need it again later - message.setContent(InputStream.class, bos.getInputStream()); + message.setContent(InputStream.class, in); // Use regex to get the boundary and return null if it's not found Matcher m = INPUT_STREAM_BOUNDARY_PATTERN.matcher(msg); @@ -281,7 +281,7 @@ * @throws IOException */ private void setupAttachment(AttachmentImpl att, InternetHeaders headers) throws IOException { - MimeBodyPartInputStream partStream = new MimeBodyPartInputStream(stream, boundary.getBytes()); + MimeBodyPartInputStream partStream = new MimeBodyPartInputStream(stream, boundary); final String ct = headers.getHeader("Content-Type", null); DataSource source = new AttachmentDataSource(ct, new DelegatingInputStream(partStream)); Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java Thu Oct 25 10:09:20 2007 @@ -30,6 +30,7 @@ import org.apache.cxf.BusException; import org.apache.cxf.common.i18n.BundleUtils; import org.apache.cxf.common.i18n.Message; +import org.apache.cxf.configuration.spring.MapProvider; public final class BindingFactoryManagerImpl implements BindingFactoryManager { @@ -49,7 +50,10 @@ } this.bindingFactories = bindingFactories; } - + public BindingFactoryManagerImpl(MapProvider bindingFactories) { + super(); + this.bindingFactories = bindingFactories.createMap(); + } @Resource public void setBus(Bus b) { Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java Thu Oct 25 10:09:20 2007 @@ -157,6 +157,7 @@ try { injector.inject(obj); + injector.construct(obj); } finally { if (null != namespacesResolver) { resourceManager.removeResourceResolver(namespacesResolver); Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java Thu Oct 25 10:09:20 2007 @@ -19,34 +19,67 @@ package org.apache.cxf.bus.spring; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + import org.apache.cxf.common.injection.ResourceInjector; +import org.apache.cxf.helpers.CastUtils; +import org.apache.cxf.resource.ResourceManager; +import org.apache.cxf.resource.ResourceResolver; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; import org.springframework.core.Ordered; -public class Jsr250BeanPostProcessor implements DestructionAwareBeanPostProcessor, Ordered { +public class Jsr250BeanPostProcessor + implements DestructionAwareBeanPostProcessor, Ordered, ApplicationContextAware { private ResourceInjector injector; - + private ApplicationContext context; + Jsr250BeanPostProcessor() { injector = new ResourceInjector(null, null); } - + + public void setApplicationContext(ApplicationContext arg0) throws BeansException { + context = arg0; + } + public int getOrder() { - return 1002; + return 1010; } public Object postProcessAfterInitialization(Object bean, String beanId) throws BeansException { + if (bean != null + && injector != null) { + injector.construct(bean); + } + if (bean instanceof ResourceManager) { + ResourceManager rm = (ResourceManager)bean; + + Map mp = CastUtils.cast(context.getBeansOfType(ResourceResolver.class)); + Collection resolvs = CastUtils.cast(mp.values()); + List resolvers = new ArrayList(rm.getResourceResolvers()); + resolvers.addAll(resolvs); + injector = new ResourceInjector(rm, resolvers); + } return bean; } public Object postProcessBeforeInitialization(Object bean, String beanId) throws BeansException { - injector.construct(bean); + if (bean != null && injector != null) { + injector.inject(bean); + } return bean; } public void postProcessBeforeDestruction(Object bean, String beanId) { - injector.destroy(bean); + if (bean != null) { + injector.destroy(bean); + } } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java Thu Oct 25 10:09:20 2007 @@ -29,8 +29,6 @@ import org.apache.cxf.buslifecycle.BusLifeCycleListener; import org.apache.cxf.buslifecycle.BusLifeCycleManager; import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.configuration.Configurer; -import org.apache.cxf.configuration.spring.ConfigurerImpl; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; @@ -47,6 +45,10 @@ public SpringBusFactory(ApplicationContext context) { this.context = context; } + + public ApplicationContext getApplicationContext() { + return context; + } public Bus createBus() { return createBus((String)null); @@ -54,11 +56,9 @@ private boolean defaultBusNotExists() { if (null != context) { - context.containsBean(Bus.DEFAULT_BUS_ID); - return false; - } else { - return true; + return !context.containsBean(Bus.DEFAULT_BUS_ID); } + return true; } public Bus createBus(String cfgFile) { @@ -68,7 +68,7 @@ private Bus finishCreatingBus(BusApplicationContext bac) { final Bus bus = (Bus)bac.getBean(Bus.DEFAULT_BUS_ID); - bus.setExtension(new ConfigurerImpl(bac), Configurer.class); + //bus.setExtension(new ConfigurerImpl(bac), Configurer.class); bus.setExtension(bac, BusApplicationContext.class); possiblySetDefaultBus(bus); Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java Thu Oct 25 10:09:20 2007 @@ -39,14 +39,13 @@ private String baseUri; public CatalogWSDLLocator(String wsdlUrl, OASISCatalogManager catalogManager) { - this.wsdlUrl = wsdlUrl; - this.baseUri = this.wsdlUrl; + this.baseUri = wsdlUrl; this.catalogResolver = catalogManager.getCatalog(); this.resolver = new ExtendedURIResolver(); } public InputSource getBaseInputSource() { - InputSource result = resolver.resolve(baseUri, null); + InputSource result = resolver.resolve(baseUri, null); if (result == null) { try { String s = catalogResolver.resolveSystem(baseUri); @@ -59,12 +58,26 @@ //ignore } } + if (wsdlUrl == null + && result != null) { + wsdlUrl = result.getSystemId(); + } baseUri = resolver.getURI(); return result; } public String getBaseURI() { - return getBaseInputSource().getSystemId(); + if (wsdlUrl == null) { + InputSource is = getBaseInputSource(); + if (is.getByteStream() != null) { + try { + is.getByteStream().close(); + } catch (IOException e) { + //ignore + } + } + } + return wsdlUrl; } public String getLatestImportURI() { @@ -77,6 +90,13 @@ String resolvedImportLocation = null; try { resolvedImportLocation = this.catalogResolver.resolveSystem(importLocation); + if (resolvedImportLocation == null) { + resolvedImportLocation = catalogResolver.resolveURI(importLocation); + } + if (resolvedImportLocation == null) { + resolvedImportLocation = catalogResolver.resolvePublic(importLocation, parent); + } + } catch (IOException e) { throw new RuntimeException("Catalog resolution failed", e); } @@ -85,7 +105,7 @@ if (resolvedImportLocation == null) { in = this.resolver.resolve(importLocation, this.baseUri); } else { - in = this.resolver.resolve(resolvedImportLocation, null); + in = this.resolver.resolve(resolvedImportLocation, null); } // XXX: If we return null (as per javadoc), a NPE is raised in WSDL4J code. Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java Thu Oct 25 10:09:20 2007 @@ -19,9 +19,11 @@ package org.apache.cxf.catalog; import java.io.IOException; +import java.io.InputStream; import org.xml.sax.InputSource; +import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.resource.ExtendedURIResolver; import org.apache.ws.commons.schema.XmlSchemaException; import org.apache.ws.commons.schema.resolver.URIResolver; @@ -44,6 +46,13 @@ String resolvedSchemaLocation = null; try { resolvedSchemaLocation = this.catalogResolver.resolveSystem(schemaLocation); + + if (resolvedSchemaLocation == null) { + resolvedSchemaLocation = catalogResolver.resolveURI(schemaLocation); + } + if (resolvedSchemaLocation == null) { + resolvedSchemaLocation = catalogResolver.resolvePublic(schemaLocation, baseUri); + } } catch (IOException e) { throw new RuntimeException("Catalog resolution failed", e); } @@ -64,6 +73,22 @@ + (baseUri == null ? "." : ", relative to '" + baseUri + "'.")); + } else if (in.getByteStream() != null) { + //workaround bug in XmlSchema - XmlSchema is not closing the InputStreams + //that are returned for imports. Thus, with a lot of services starting up + //or a lot of schemas imported or similar, it's easy to run out of + //file handles. We'll just load the file into a byte[] and return that. + try { + InputStream ins = IOUtils.loadIntoBAIS(in.getByteStream()); + in.setByteStream(ins); + } catch (IOException e) { + throw new XmlSchemaException("Unable to load imported document " + + "at '" + schemaLocation + "'" + + (baseUri == null + ? "." + : ", relative to '" + baseUri + "'."), + e); + } } return in; Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java Thu Oct 25 10:09:20 2007 @@ -18,7 +18,10 @@ */ package org.apache.cxf.catalog; +import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; +import java.net.URISyntaxException; import java.net.URL; import java.util.Collections; import java.util.Enumeration; @@ -38,9 +41,13 @@ public class OASISCatalogManager { public static final String DEFAULT_CATALOG_NAME = "META-INF/jax-ws-catalog.xml"; + public static final String CATALOG_DEBUG_KEY = "OASISCatalogManager.catalog.debug.level"; private static final Logger LOG = LogUtils.getL7dLogger(OASISCatalogManager.class); + private static final String DEBUG_LEVEL = System.getProperty(CATALOG_DEBUG_KEY); + + private Catalog resolver; private Set loadedCatalogs = Collections.synchronizedSet(new HashSet()); @@ -51,6 +58,9 @@ catalogManager.setUseStaticCatalog(false); catalogManager.setIgnoreMissingProperties(true); CatalogResolver catalogResolver = new CatalogResolver(catalogManager); + if (DEBUG_LEVEL != null) { + catalogManager.debug.setDebug(Integer.parseInt(DEBUG_LEVEL)); + } this.resolver = catalogResolver.getCatalog(); } @@ -103,7 +113,19 @@ public void loadCatalog(URL catalogURL) throws IOException { if (!loadedCatalogs.contains(catalogURL)) { + if ("file".equals(catalogURL.getProtocol())) { + try { + File file = new File(catalogURL.toURI()); + if (!file.exists()) { + throw new FileNotFoundException(file.getAbsolutePath()); + } + } catch (URISyntaxException e) { + //just process as is + } + } + this.resolver.parseCatalog(catalogURL); + loadedCatalogs.add(catalogURL); } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java Thu Oct 25 10:09:20 2007 @@ -29,6 +29,7 @@ import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.configuration.Configurable; import org.apache.cxf.configuration.Configurer; +import org.apache.cxf.extension.BusExtension; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; @@ -38,9 +39,11 @@ import org.springframework.beans.factory.wiring.BeanWiringInfo; import org.springframework.beans.factory.wiring.BeanWiringInfoResolver; import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; import org.springframework.core.io.ClassPathResource; -public class ConfigurerImpl extends BeanConfigurerSupport implements Configurer { +public class ConfigurerImpl extends BeanConfigurerSupport + implements Configurer, ApplicationContextAware, BusExtension { private static final Logger LOG = LogUtils.getL7dLogger(ConfigurerImpl.class); private static final String DEFAULT_USER_CFG_FILE = "cxf.xml"; @@ -198,9 +201,13 @@ return beanName; } - private void setApplicationContext(ApplicationContext ac) { + public final void setApplicationContext(ApplicationContext ac) { appContext = ac; setBeanFactory(appContext.getAutowireCapableBeanFactory()); initWildcardDefinitionMap(); + } + + public Class getRegistrationType() { + return Configurer.class; } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java Thu Oct 25 10:09:20 2007 @@ -28,6 +28,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.apache.cxf.common.util.FixedExtensionDeserializer; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.service.model.SchemaInfo; import org.apache.cxf.service.model.ServiceInfo; @@ -46,7 +47,7 @@ } - protected void addSchemaDocument(ServiceInfo serviceInfo, + protected XmlSchema addSchemaDocument(ServiceInfo serviceInfo, XmlSchemaCollection col, Document d, String systemId) { @@ -66,12 +67,12 @@ } } } - SchemaInfo schema = new SchemaInfo(serviceInfo, ns); - schema.setElement(d.getDocumentElement()); schema.setSystemId(systemId); + col.getExtReg().setDefaultExtensionDeserializer(new FixedExtensionDeserializer()); XmlSchema xmlSchema = col.read(d.getDocumentElement()); schema.setSchema(xmlSchema); serviceInfo.addSchema(schema); + return xmlSchema; } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java Thu Oct 25 10:09:20 2007 @@ -19,6 +19,7 @@ package org.apache.cxf.databinding.source; import java.io.IOException; +import java.io.InputStream; import java.util.Collection; import java.util.logging.Logger; @@ -63,11 +64,12 @@ } } else if (StreamSource.class.isAssignableFrom(type)) { try { - CachedOutputStream out = new CachedOutputStream(); + CachedOutputStream out = new CachedOutputStream(); DOMUtils.writeXml(input, out); + InputStream is = out.getInputStream(); out.close(); - return new StreamSource(out.getInputStream()); + return new StreamSource(is); } catch (IOException e) { throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e); } catch (TransformerException e) { Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java Thu Oct 25 10:09:20 2007 @@ -24,7 +24,6 @@ import org.w3c.dom.Node; -import org.apache.cxf.databinding.DataBinding; import org.apache.cxf.databinding.DataReader; import org.apache.cxf.databinding.DataWriter; import org.apache.cxf.service.Service; @@ -32,7 +31,7 @@ /** * A simple databinding implementation which reads and writes Source objects. */ -public class SourceDataBinding implements DataBinding { +public class SourceDataBinding extends org.apache.cxf.databinding.AbstractDataBinding { private XMLStreamDataReader xsrReader; private XMLStreamDataWriter xswWriter; Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java Thu Oct 25 10:09:20 2007 @@ -56,12 +56,14 @@ if (SAXSource.class.isAssignableFrom(type)) { try { CachedOutputStream out = new CachedOutputStream(); - XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out); - StaxUtils.copy(input, xsw); - xsw.close(); - out.close(); - - return new SAXSource(new InputSource(out.getInputStream())); + try { + XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out); + StaxUtils.copy(input, xsw); + xsw.close(); + return new SAXSource(new InputSource(out.getInputStream())); + } finally { + out.close(); + } } catch (IOException e) { throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e); } catch (XMLStreamException e) { @@ -70,12 +72,14 @@ } else if (StreamSource.class.isAssignableFrom(type)) { try { CachedOutputStream out = new CachedOutputStream(); - XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out); - StaxUtils.copy(input, xsw); - xsw.close(); - out.close(); - - return new StreamSource(out.getInputStream()); + try { + XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out); + StaxUtils.copy(input, xsw); + xsw.close(); + return new StreamSource(out.getInputStream()); + } finally { + out.close(); + } } catch (IOException e) { throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e); } catch (XMLStreamException e) { Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java Thu Oct 25 10:09:20 2007 @@ -32,7 +32,7 @@ import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.databinding.DataBinding; +import org.apache.cxf.databinding.AbstractDataBinding; import org.apache.cxf.databinding.DataReader; import org.apache.cxf.databinding.DataWriter; import org.apache.cxf.interceptor.Fault; @@ -45,7 +45,7 @@ * A simple databinding implementation which reads and writes Source objects. * This will not work with the standard databinding interceptors. */ -public class StaxDataBinding implements DataBinding { +public class StaxDataBinding extends AbstractDataBinding { private XMLStreamDataReader xsrReader; private XMLStreamDataWriter xswWriter; Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/AbstractEndpointFactory.java Thu Oct 25 10:09:20 2007 @@ -46,6 +46,7 @@ protected BindingFactory bindingFactory; protected DestinationFactory destinationFactory; protected QName endpointName; + protected QName serviceName; protected Map properties; protected List features; protected BindingConfiguration bindingConfig; @@ -116,7 +117,15 @@ public void setEndpointName(QName endpointName) { this.endpointName = endpointName; } - + + public void setServiceName(QName name) { + serviceName = name; + } + + public QName getServiceName() { + return serviceName; + } + public void setEndpointReference(EndpointReferenceType epr) { endpointReference = epr; } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Thu Oct 25 10:09:20 2007 @@ -253,16 +253,22 @@ // execute chain chain.doIntercept(message); - getConduitSelector().complete(exchange); // Check to see if there is a Fault from the outgoing chain Exception ex = message.getContent(Exception.class); - + boolean mepCompleteCalled = false; if (ex != null) { - throw ex; + getConduitSelector().complete(exchange); + mepCompleteCalled = true; + if (message.getContent(Exception.class) != null) { + throw ex; + } } ex = message.getExchange().get(Exception.class); if (ex != null) { + if (!mepCompleteCalled) { + getConduitSelector().complete(exchange); + } throw ex; } @@ -272,6 +278,7 @@ waitResponse(exchange); } } + getConduitSelector().complete(exchange); // Grab the response objects if there are any List resList = null; Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java Thu Oct 25 10:09:20 2007 @@ -88,6 +88,7 @@ } destination = destinationFactory.getDestination(ei); + LOG.info("Setting the server's publish address to be " + ei.getAddress()); serverRegistry = bus.getExtension(ServerRegistry.class); ManagedEndpoint mep = new ManagedEndpoint(bus, endpoint, this); Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/feature/LoggingFeature.java Thu Oct 25 10:09:20 2007 @@ -24,15 +24,34 @@ import org.apache.cxf.interceptor.LoggingOutInterceptor; public class LoggingFeature extends AbstractFeature { - private static final LoggingInInterceptor IN = new LoggingInInterceptor(); - private static final LoggingOutInterceptor OUT = new LoggingOutInterceptor(); + private static final int DEFAULT_LIMIT = 100 * 1024; + private static final LoggingInInterceptor IN = new LoggingInInterceptor(DEFAULT_LIMIT); + private static final LoggingOutInterceptor OUT = new LoggingOutInterceptor(DEFAULT_LIMIT); + + int limit = DEFAULT_LIMIT; @Override protected void initializeProvider(InterceptorProvider provider, Bus bus) { - provider.getInInterceptors().add(IN); - provider.getInFaultInterceptors().add(IN); - provider.getOutInterceptors().add(OUT); - provider.getOutFaultInterceptors().add(OUT); + if (limit == DEFAULT_LIMIT) { + provider.getInInterceptors().add(IN); + provider.getInFaultInterceptors().add(IN); + provider.getOutInterceptors().add(OUT); + provider.getOutFaultInterceptors().add(OUT); + } else { + LoggingInInterceptor in = new LoggingInInterceptor(limit); + LoggingOutInterceptor out = new LoggingOutInterceptor(limit); + provider.getInInterceptors().add(in); + provider.getInFaultInterceptors().add(in); + provider.getOutInterceptors().add(out); + provider.getOutFaultInterceptors().add(out); + } } + public void setLimit(int lim) { + limit = lim; + } + + public int getLimit() { + return limit; + } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java Thu Oct 25 10:09:20 2007 @@ -24,6 +24,8 @@ import java.util.List; import java.util.Map; import java.util.StringTokenizer; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; @@ -33,6 +35,7 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; +import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.databinding.DataBinding; import org.apache.cxf.databinding.DataReader; @@ -53,6 +56,7 @@ * @author Dan Diephouse */ public class ClientFaultConverter extends AbstractPhaseInterceptor { + private static final Logger LOG = LogUtils.getLogger(ClientFaultConverter.class); public ClientFaultConverter() { super(Phase.UNMARSHAL); @@ -118,21 +122,30 @@ } if (!(e instanceof Exception)) { - Class exClass = faultWanted.getProperty(Class.class.getName(), Class.class); - Class beanClass = e.getClass(); + try { - Constructor constructor = exClass.getConstructor(new Class[]{String.class, beanClass}); - e = constructor.newInstance(new Object[]{fault.getMessage(), e}); + Class exClass = faultWanted.getProperty(Class.class.getName(), Class.class); + if (e == null) { + Constructor constructor = exClass.getConstructor(new Class[]{String.class}); + e = constructor.newInstance(new Object[]{fault.getMessage()}); + } else { + Class beanClass = e.getClass(); + Constructor constructor = exClass.getConstructor(new Class[]{String.class, beanClass}); + e = constructor.newInstance(new Object[]{fault.getMessage(), e}); + } + msg.setContent(Exception.class, e); } catch (Exception e1) { - throw new Fault(e1); + LogUtils.log(LOG, Level.INFO, "EXCEPTION_WHILE_CREATING_EXCEPTION", e1, e1.getMessage()); } + } else if (e != null) { + msg.setContent(Exception.class, e); } - msg.setContent(Exception.class, e); + } private boolean isDOMSupported(DataBinding db) { boolean supportsDOM = false; - for (Class c : db.getSupportedWriterFormats()) { + for (Class c : db.getSupportedReaderFormats()) { if (c.equals(Node.class)) { supportsDOM = true; } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java Thu Oct 25 10:09:20 2007 @@ -46,6 +46,7 @@ import org.apache.cxf.service.model.MessagePartInfo; import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.service.model.ServiceInfo; +import org.apache.cxf.service.model.ServiceModelUtil; import org.apache.cxf.staxutils.DepthXMLStreamReader; import org.apache.cxf.staxutils.StaxUtils; import org.apache.ws.commons.schema.XmlSchemaElement; @@ -276,5 +277,18 @@ return msgInfo; } - + + protected BindingOperationInfo getBindingOperationInfo(Exchange exchange, QName name, + boolean client) { + BindingOperationInfo bop = ServiceModelUtil.getOperationForWrapperElement(exchange, name, client); + if (bop == null) { + bop = super.getBindingOperationInfo(exchange, name, client); + } + + if (bop != null) { + exchange.put(BindingOperationInfo.class, bop); + exchange.put(OperationInfo.class, bop.getOperationInfo()); + } + return bop; + } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java Thu Oct 25 10:09:20 2007 @@ -21,13 +21,14 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.xml.stream.XMLStreamWriter; import org.w3c.dom.Node; -import org.apache.cxf.common.i18n.BundleUtils; +import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.databinding.DataBinding; import org.apache.cxf.databinding.DataWriter; import org.apache.cxf.frontend.FaultInfoException; @@ -42,7 +43,7 @@ import org.apache.cxf.staxutils.W3CDOMStreamWriter; public class FaultOutInterceptor extends AbstractPhaseInterceptor { - private static final ResourceBundle BUNDLE = BundleUtils.getBundle(FaultOutInterceptor.class); + private static final Logger LOG = LogUtils.getL7dLogger(FaultOutInterceptor.class); public FaultOutInterceptor() { super(Phase.PRE_PROTOCOL); @@ -67,19 +68,26 @@ MessagePartInfo part = fi.getMessageParts().iterator().next(); DataBinding db = service.getDataBinding(); - if (isDOMSupported(db)) { - DataWriter writer = db.createWriter(Node.class); - - writer.write(bean, part, f.getOrCreateDetail()); - } else { - XMLStreamWriter xsw = new W3CDOMStreamWriter(f.getOrCreateDetail()); - - DataWriter writer = db.createWriter(XMLStreamWriter.class); - - writer.write(bean, part, xsw); + try { + if (isDOMSupported(db)) { + DataWriter writer = db.createWriter(Node.class); + + writer.write(bean, part, f.getOrCreateDetail()); + } else { + XMLStreamWriter xsw = new W3CDOMStreamWriter(f.getOrCreateDetail()); + + DataWriter writer = db.createWriter(XMLStreamWriter.class); + + writer.write(bean, part, xsw); + } + + f.setMessage(ex.getMessage()); + } catch (Exception fex) { + //ignore - if any exceptions occur here, we'll ignore them + //and let the default fault handling of the binding convert + //the fault like it was an unchecked exception. + LOG.log(Level.WARNING, "EXCEPTION_WHILE_WRITING_FAULT", fex); } - - f.setMessage(ex.getMessage()); } } @@ -99,11 +107,11 @@ Method method = cause.getClass().getMethod("getFaultInfo", new Class[0]); return method.invoke(cause, new Object[0]); } catch (InvocationTargetException e) { - throw new Fault(new org.apache.cxf.common.i18n.Message("INVOKE_FAULT_INFO", BUNDLE), e); + throw new Fault(new org.apache.cxf.common.i18n.Message("INVOKE_FAULT_INFO", LOG), e); } catch (NoSuchMethodException e) { - throw new Fault(new org.apache.cxf.common.i18n.Message("NO_FAULT_INFO_METHOD", BUNDLE), e); + throw new Fault(new org.apache.cxf.common.i18n.Message("NO_FAULT_INFO_METHOD", LOG), e); } catch (Exception e) { - throw new Fault(new org.apache.cxf.common.i18n.Message("NO_ACCCESS_FAULT_INFO", BUNDLE), e); + throw new Fault(new org.apache.cxf.common.i18n.Message("NO_ACCCESS_FAULT_INFO", LOG), e); } } return cause; Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Thu Oct 25 10:09:20 2007 @@ -38,15 +38,30 @@ private static final Logger LOG = LogUtils.getL7dLogger(LoggingInInterceptor.class); + private int limit = 100 * 1024; + public LoggingInInterceptor() { super(Phase.RECEIVE); } + public LoggingInInterceptor(int lim) { + super(Phase.RECEIVE); + limit = lim; + } + public void setLimit(int lim) { + limit = lim; + } + + public int getLimit() { + return limit; + } public void handleMessage(Message message) throws Fault { if (LOG.isLoggable(Level.INFO)) { - StringBuffer buffer = new StringBuffer("Inbound Message\n" - + "--------------------------------------"); + StringBuilder buffer = new StringBuilder(2048); + + buffer.append("Inbound Message\n") + .append("--------------------------------------"); String encoding = (String)message.get(Message.ENCODING); if (encoding != null) { @@ -63,13 +78,23 @@ try { IOUtils.copy(is, bos); + bos.flush(); is.close(); - bos.close(); - buffer.append("\nMessage:\n"); - buffer.append(bos.getOut().toString()); - message.setContent(InputStream.class, bos.getInputStream()); + if (bos.getTempFile() != null) { + //large thing on disk... + buffer.append("\nMessage (saved to tmp file):\n"); + buffer.append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n"); + } else { + buffer.append("\nMessage:\n"); + } + if (bos.size() > limit) { + buffer.append("(message truncated to " + limit + " bytes)\n"); + } + bos.writeCacheTo(buffer, limit); + + bos.close(); } catch (IOException e) { throw new Fault(e); } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java Thu Oct 25 10:09:20 2007 @@ -19,7 +19,6 @@ package org.apache.cxf.interceptor; -import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.util.logging.Level; import java.util.logging.Logger; @@ -39,16 +38,35 @@ private static final Logger LOG = LogUtils.getL7dLogger(LoggingOutInterceptor.class); + private int limit = 100 * 1024; + public LoggingOutInterceptor() { super(Phase.PRE_STREAM); addBefore(StaxOutInterceptor.class.getName()); } + public LoggingOutInterceptor(int lim) { + super(Phase.PRE_STREAM); + addBefore(StaxOutInterceptor.class.getName()); + limit = lim; + } + + public void setLimit(int lim) { + limit = lim; + } + + public int getLimit() { + return limit; + } + public void handleMessage(Message message) throws Fault { final OutputStream os = message.getContent(OutputStream.class); if (os == null) { return; } + if (!LOG.isLoggable(Level.INFO)) { + return; + } // Write the output while caching it for the log message final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(os); @@ -63,14 +81,30 @@ } public void onClose(CachedOutputStream cos) { - OutputStream os = cos.getOut(); - if (os instanceof ByteArrayOutputStream && LOG.isLoggable(Level.INFO)) { - // TODO - make this work with large messages - LOG.info("Outbound Message \n" - + "--------------------------------------\n" - + os.toString() - + "\n--------------------------------------"); + + StringBuilder buffer = new StringBuilder(2048); + + if (cos.getTempFile() == null) { + buffer.append("Outbound Message:\n"); + if (cos.size() > limit) { + buffer.append("(message truncated to " + limit + " bytes)\n"); + } + buffer.append("--------------------------------------\n"); + } else { + buffer.append("Outbound Message (saved to tmp file):\n"); + buffer.append("Filename: " + cos.getTempFile().getAbsolutePath() + "\n"); + if (cos.size() > limit) { + buffer.append("(message truncated to " + limit + " bytes)\n"); + } + buffer.append("--------------------------------------\n"); + } + try { + cos.writeCacheTo(buffer, limit); + } catch (Exception ex) { + //ignore } + buffer.append("--------------------------------------\n"); + LOG.info(buffer.toString()); } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/interceptor/Messages.properties Thu Oct 25 10:09:20 2007 @@ -34,4 +34,7 @@ NO_FAULT_INFO_METHOD=Custom faults need a getFaultInfo method. NO_ACCCESS_FAULT_INFO=Couldn't access getFaultInfo method. COULD_NOT_CREATE_ANNOTATION_OBJECT=Could not create annotation object: {0} -COULD_NOT_FIND_SEICLASS=Could not find the class: {0} \ No newline at end of file +COULD_NOT_FIND_SEICLASS=Could not find the class: {0} +EXCEPTION_WHILE_WRITING_FAULT = Exception occurred while writing fault. +EXCEPTION_WHILE_CREATING_EXCEPTION = Exception occurred while creating exception: {0} + Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java Thu Oct 25 10:09:20 2007 @@ -37,12 +37,17 @@ flowThroughStream = stream; } - @Override - protected void doClose() throws IOException { + public void closeFlowthroughStream() throws IOException { flowThroughStream.flush(); flowThroughStream.close(); } - + + protected void postClose() throws IOException { + flowThroughStream.flush(); + flowThroughStream.close(); + } + + @Override protected void onWrite() throws IOException { // does nothing Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/WriteOnCloseOutputStream.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/WriteOnCloseOutputStream.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/WriteOnCloseOutputStream.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/io/WriteOnCloseOutputStream.java Thu Oct 25 10:09:20 2007 @@ -36,10 +36,10 @@ flowThroughStream = stream; } - @Override + protected void doClose() throws IOException { resetOut(flowThroughStream, true); flowThroughStream.flush(); - flowThroughStream.close(); - } + } + } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java Thu Oct 25 10:09:20 2007 @@ -22,8 +22,13 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; +import java.util.Arrays; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.apache.cxf.common.i18n.Message; +import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.frontend.MethodDispatcher; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.interceptor.Fault; @@ -36,11 +41,11 @@ /** * Abstract implementation of Invoker. *

- * - * @author Ben Yu Feb 10, 2006 10:57:23 PM */ public abstract class AbstractInvoker implements Invoker { - + private static final Logger LOG = LogUtils.getL7dLogger(AbstractInvoker.class); + + public Object invoke(Exchange exchange, Object o) { final Object serviceObject = getServiceObject(exchange); @@ -73,7 +78,7 @@ if (params != null) { paramArray = params.toArray(); } - + res = performInvocation(exchange, serviceObject, m, paramArray); if (exchange.isOneWay()) { @@ -87,23 +92,35 @@ t = e; } exchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT); - throw createFault(t); + throw createFault(t, m, params, true); } catch (Fault f) { exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); throw f; } catch (Exception e) { exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); - throw createFault(e); + throw createFault(e, m, params, false); } } - protected Fault createFault(Throwable ex) { - return new Fault(ex); + protected Fault createFault(Throwable ex, Method m, List params, boolean checked) { + if (checked) { + return new Fault(ex); + } else { + return new Fault(new Message("EXCEPTION_INVOKING_OBJECT", + LOG, + ex.getMessage(), m.toString(), params), + ex); + } } protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray) throws Exception { paramArray = insertExchange(m, paramArray, exchange); + if (LOG.isLoggable(Level.FINER)) { + LOG.log(Level.FINER, "INVOKING_METHOD", new Object[] {serviceObject, + m, + Arrays.asList(paramArray)}); + } return m.invoke(serviceObject, paramArray); } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties Thu Oct 25 10:09:20 2007 @@ -22,3 +22,5 @@ SVC_CLASS_IS_ABSTRACT=Could not instantiate service class {0} because it is abstract. COULD_NOT_INSTANTIATE=Couldn't instantiate service object. ILLEGAL_ACCESS=Couldn't access service object. +EXCEPTION_INVOKING_OBJECT={0} while invoking {1} with params {2}. +INVOKING_METHOD=Invoking method {1} on object {0} with params {2}. \ No newline at end of file Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java Thu Oct 25 10:09:20 2007 @@ -19,73 +19,45 @@ package org.apache.cxf.test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; import java.io.Reader; -import java.util.HashMap; import java.util.Map; -import javax.wsdl.Definition; import javax.wsdl.WSDLException; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLWriter; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.xml.sax.SAXParseException; - import org.apache.cxf.Bus; import org.apache.cxf.BusException; import org.apache.cxf.BusFactory; import org.apache.cxf.endpoint.Server; -import org.apache.cxf.helpers.DOMUtils; -import org.apache.cxf.helpers.IOUtils; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageImpl; -import org.apache.cxf.service.Service; -import org.apache.cxf.service.model.EndpointInfo; -import org.apache.cxf.transport.Conduit; -import org.apache.cxf.transport.ConduitInitiator; -import org.apache.cxf.transport.ConduitInitiatorManager; -import org.apache.cxf.transport.MessageObserver; -import org.apache.cxf.wsdl11.ServiceWSDLBuilder; + import org.junit.After; import org.junit.Assert; import org.junit.Before; + /** * A basic test case meant for helping users unit test their services. */ public class AbstractCXFTest extends Assert { - private static String basedirPath; - + protected TestUtilities testUtilities; protected Bus bus; - /** - * Namespaces for the XPath expressions. - */ - private Map namespaces = new HashMap(); - + + protected AbstractCXFTest() { + testUtilities = new TestUtilities(getClass()); + testUtilities.addDefaultNamespaces(); + } @Before public void setUpBus() throws Exception { if (bus == null) { bus = createBus(); - - addNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/"); - addNamespace("xsd", "http://www.w3.org/2001/XMLSchema"); - addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/"); - addNamespace("wsdlsoap", "http://schemas.xmlsoap.org/wsdl/soap/"); - addNamespace("soap", "http://schemas.xmlsoap.org/soap/"); - addNamespace("soap12env", "http://www.w3.org/2003/05/soap-envelope"); - addNamespace("xml", "http://www.w3.org/XML/1998/namespace"); + testUtilities.setBus(bus); } } @@ -110,50 +82,13 @@ protected byte[] invokeBytes(String address, String transport, String message) throws Exception { - EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); - ei.setAddress(address); - - ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class); - ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport); - Conduit conduit = conduitInit.getConduit(ei); - - TestMessageObserver obs = new TestMessageObserver(); - conduit.setMessageObserver(obs); - - Message m = new MessageImpl(); - conduit.prepare(m); - - OutputStream os = m.getContent(OutputStream.class); - InputStream is = getResourceAsStream(message); - if (is == null) { - throw new RuntimeException("Could not find resource " + message); - } - - IOUtils.copy(is, os); - - // TODO: shouldn't have to do this. IO caching needs cleaning - // up or possibly removal... - os.flush(); - is.close(); - os.close(); - - byte[] bs = obs.getResponseStream().toByteArray(); - - return bs; + return testUtilities.invokeBytes(address, transport, message); } protected Node invoke(String address, String transport, String message) throws Exception { - byte[] bs = invokeBytes(address, transport, message); - - ByteArrayInputStream input = new ByteArrayInputStream(bs); - try { - return DOMUtils.readXml(input); - } catch (SAXParseException e) { - throw new IllegalStateException("Could not parse message:\n" - + new String(bs)); - } + return testUtilities.invoke(address, transport, message); } /** @@ -163,7 +98,7 @@ * @throws Exception */ public NodeList assertValid(String xpath, Node node) throws Exception { - return XPathAssert.assertValid(xpath, node, namespaces); + return testUtilities.assertValid(xpath, node); } /** @@ -172,11 +107,11 @@ * @param xpath */ public NodeList assertInvalid(String xpath, Node node) throws Exception { - return XPathAssert.assertInvalid(xpath, node, namespaces); + return testUtilities.assertInvalid(xpath, node); } /** - * Asser that the text of the xpath node retrieved is equal to the value + * Assert that the text of the xpath node retrieved is equal to the value * specified. * * @param xpath @@ -184,11 +119,16 @@ * @param node */ public void assertXPathEquals(String xpath, String value, Node node) throws Exception { - XPathAssert.assertXPathEquals(xpath, value, node, namespaces); + testUtilities.assertXPathEquals(xpath, value, node); } + /** + * Assert that this node is not a SOAP fault part. + * @param node + * @throws Exception + */ public void assertNoFault(Node node) throws Exception { - XPathAssert.assertNoFault(node); + testUtilities.assertNoFault(node); } /** @@ -198,86 +138,37 @@ * @param uri The namespace uri. */ public void addNamespace(String ns, String uri) { - namespaces.put(ns, uri); + testUtilities.addNamespace(ns, uri); } public Map getNamespaces() { - return namespaces; + return testUtilities.getNamespaces(); } protected InputStream getResourceAsStream(String resource) { - return getClass().getResourceAsStream(resource); + return testUtilities.getResourceAsStream(resource); } protected Reader getResourceAsReader(String resource) { - return new InputStreamReader(getResourceAsStream(resource)); + return testUtilities.getResourceAsReader(resource); } public File getTestFile(String relativePath) { - return new File(getBasedir(), relativePath); + return testUtilities.getTestFile(relativePath); } public static String getBasedir() { - if (basedirPath != null) { - return basedirPath; - } - - basedirPath = System.getProperty("basedir"); - - if (basedirPath == null) { - basedirPath = new File("").getAbsolutePath(); - } - - return basedirPath; + return TestUtilities.getBasedir(); } protected Document getWSDLDocument(Server server) throws WSDLException { - Service service = server.getEndpoint().getService(); - - ServiceWSDLBuilder wsdlBuilder = - new ServiceWSDLBuilder(bus, service.getServiceInfos().get(0)); - wsdlBuilder.setUseSchemaImports(false); - Definition definition = wsdlBuilder.build(); - WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter(); - - return writer.getDocument(definition); + return testUtilities.getWSDLDocument(server); } - public static class TestMessageObserver implements MessageObserver { - ByteArrayOutputStream response = new ByteArrayOutputStream(); - boolean written; - String contentType; - - public ByteArrayOutputStream getResponseStream() throws Exception { - synchronized (this) { - if (!written) { - wait(1000000000); - } - } - return response; - } - - public String getResponseContentType() { - return contentType; - } + public static class TestMessageObserver extends TestUtilities.TestMessageObserver { - public void onMessage(Message message) { - try { - contentType = (String) message.get(Message.CONTENT_TYPE); - InputStream is = message.getContent(InputStream.class); - IOUtils.copy(is, response); - - is.close(); - response.close(); - } catch (IOException e) { - e.printStackTrace(); - fail(); - } finally { - synchronized (this) { - written = true; - notifyAll(); - } - } + public TestMessageObserver() { + super(); } } } Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java Thu Oct 25 10:09:20 2007 @@ -27,7 +27,7 @@ /** * Helper methods for {@link DestinationFactory}s and {@link ConduitInitiator}s. */ -public abstract class AbstractTransportFactory implements DestinationFactory { +public abstract class AbstractTransportFactory { private List transportIds; public List getTransportIds() { Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java Thu Oct 25 10:09:20 2007 @@ -31,6 +31,7 @@ import org.apache.cxf.BusException; import org.apache.cxf.common.i18n.BundleUtils; import org.apache.cxf.common.i18n.Message; +import org.apache.cxf.configuration.spring.MapProvider; public final class ConduitInitiatorManagerImpl implements ConduitInitiatorManager { @@ -41,6 +42,11 @@ private Bus bus; public ConduitInitiatorManagerImpl() { conduitInitiators = new ConcurrentHashMap(); + } + + + public ConduitInitiatorManagerImpl(MapProvider conduitInitiators) { + this.conduitInitiators = conduitInitiators.createMap(); } public ConduitInitiatorManagerImpl(Map conduitInitiators) { Modified: incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java?rev=588283&r1=588282&r2=588283&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java (original) +++ incubator/cxf/branches/jliu/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java Thu Oct 25 10:09:20 2007 @@ -33,6 +33,7 @@ import org.apache.cxf.bus.extension.DeferredMap; import org.apache.cxf.common.i18n.BundleUtils; import org.apache.cxf.common.i18n.Message; +import org.apache.cxf.configuration.spring.MapProvider; public final class DestinationFactoryManagerImpl implements DestinationFactoryManager { @@ -50,6 +51,9 @@ public DestinationFactoryManagerImpl(Map destinationFactories) { this.destinationFactories = destinationFactories; } + public DestinationFactoryManagerImpl(MapProvider destinationFactories) { + this.destinationFactories = destinationFactories.createMap(); + } @Resource public void setBus(Bus b) { @@ -111,10 +115,10 @@ public DestinationFactory getDestinationFactoryForUri(String uri) { //first attempt the ones already registered - for (DestinationFactory df : destinationFactories.values()) { - for (String prefix : df.getUriPrefixes()) { + for (Map.Entry df : destinationFactories.entrySet()) { + for (String prefix : df.getValue().getUriPrefixes()) { if (uri.startsWith(prefix)) { - return df; + return df.getValue(); } } }