You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/11/13 20:57:19 UTC

svn commit: r713804 - in /cxf/trunk: api/src/main/java/org/apache/cxf/transport/ common/common/src/main/java/org/apache/cxf/resource/ rt/core/src/main/java/org/apache/cxf/catalog/ rt/core/src/main/java/org/apache/cxf/configuration/spring/ rt/core/src/m...

Author: dkulp
Date: Thu Nov 13 11:57:18 2008
New Revision: 713804

URL: http://svn.apache.org/viewvc?rev=713804&view=rev
Log:
Remove some unused code
Wire in conduits into wsdl/schema resolving so configured https conduits can be used to retrieve wsdls/schemas

Added:
    cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java   (with props)
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java   (with props)
Removed:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/XmlSchemaURIResolver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLLocatorImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLResolver.java
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
    cxf/trunk/tools/javato/ws/pom.xml
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java

Added: cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java?rev=713804&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java Thu Nov 13 11:57:18 2008
@@ -0,0 +1,114 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.transport;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.xml.sax.InputSource;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.resource.ExtendedURIResolver;
+import org.apache.cxf.service.model.EndpointInfo;
+
+/**
+ * 
+ */
+public class TransportURIResolver extends ExtendedURIResolver {
+    protected Bus bus;
+    
+    public TransportURIResolver(Bus b) {
+        super();
+        bus = b;
+    }
+    
+    public InputSource resolve(String curUri, String baseUri) {
+        InputSource is = null;
+        URI base;
+        try {
+            if (baseUri == null) {
+                base = new URI(curUri);
+            } else {
+                base = new URI(baseUri);
+                base = base.resolve(curUri);
+            }
+        } catch (URISyntaxException use) {
+            //ignore
+            base = null;
+        }
+        try {
+            if (base == null || !"https".equals(base.getScheme())) {
+                is = super.resolve(curUri, baseUri);
+            }
+        } catch (Exception ex) {
+            //nothing
+        }
+        if (is == null && base != null && base.getScheme() != null) {
+            try {
+                ConduitInitiator ci = bus.getExtension(ConduitInitiatorManager.class)
+                    .getConduitInitiatorForUri(base.toString());
+                EndpointInfo info = new EndpointInfo();
+                info.setAddress(base.toString());
+                final Conduit c = ci.getConduit(info);
+                Message message = new MessageImpl();
+                Exchange exch = new ExchangeImpl();
+                message.setExchange(exch);
+                
+                message.put(Message.HTTP_REQUEST_METHOD, "GET");
+                c.setMessageObserver(new MessageObserver() {
+                    public void onMessage(Message message) {
+                        LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream();
+                        try {
+                            IOUtils.copy(message.getContent(InputStream.class), bout);
+                            message.getExchange().put(InputStream.class, bout.createInputStream());
+                            c.close(message);
+                        } catch (IOException e) {
+                            //ignore
+                        }
+                    }
+                });
+                c.prepare(message);
+                c.close(message);
+                InputStream ins = exch.get(InputStream.class);
+                resourceOpened.addElement(ins);
+                InputSource src = new InputSource(ins);
+                src.setPublicId(base.toString());
+                src.setSystemId(base.toString());
+                lastestImportUri = base.toString();
+                currentResolver.unresolve();
+                return src;
+            } catch (Exception e) {
+                //ignore
+            }
+        }
+        if (is == null && "https".equals(base.getScheme())) {
+            is = super.resolve(curUri, baseUri);            
+        }
+        return is;
+    }
+}

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/transport/TransportURIResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java Thu Nov 13 11:57:18 2008
@@ -28,9 +28,9 @@
 
 public class ExtendedURIResolver {
 
-    private org.apache.cxf.resource.URIResolver currentResolver;
-    private String lastestImportUri;
-    private Stack<InputStream> resourceOpened = new Stack<InputStream>();
+    protected org.apache.cxf.resource.URIResolver currentResolver;
+    protected String lastestImportUri;
+    protected Stack<InputStream> resourceOpened = new Stack<InputStream>();
 
     public ExtendedURIResolver() {
         currentResolver = new org.apache.cxf.resource.URIResolver();        

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java Thu Nov 13 11:57:18 2008
@@ -78,6 +78,11 @@
         }
     }
 
+    public void unresolve() {
+        this.file = null;
+        this.uri = null;
+        this.is = null;
+    }
     
     public void resolve(String baseUriStr, String uriStr, Class callingCls) throws IOException {
         this.calling = (callingCls != null) ? callingCls : getClass();

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java Thu Nov 13 11:57:18 2008
@@ -25,7 +25,9 @@
 
 import org.xml.sax.InputSource;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.resource.ExtendedURIResolver;
+import org.apache.cxf.transport.TransportURIResolver;
 import org.apache.xml.resolver.Catalog;
 
 /**
@@ -38,15 +40,24 @@
     private Catalog catalogResolver;
     private String baseUri;
     
+    public CatalogWSDLLocator(String wsdlUrl) {
+        this.baseUri = wsdlUrl;
+        this.resolver = new ExtendedURIResolver();        
+    }
     public CatalogWSDLLocator(String wsdlUrl, OASISCatalogManager catalogManager) {
         this.baseUri = wsdlUrl;
         this.catalogResolver = catalogManager.getCatalog();
         this.resolver = new ExtendedURIResolver();
     }
+    public CatalogWSDLLocator(String wsdlUrl, Bus b) {
+        this.baseUri = wsdlUrl;
+        this.catalogResolver = OASISCatalogManager.getCatalogManager(b).getCatalog();
+        this.resolver = new TransportURIResolver(b);
+    }
 
     public InputSource getBaseInputSource() {
         InputSource result = resolver.resolve(baseUri, null);
-        if (result == null) {
+        if (result == null && catalogResolver != null) {
             try {
                 String s = catalogResolver.resolveSystem(baseUri);
                 if (s != null) {
@@ -88,17 +99,18 @@
         this.baseUri = parent;
 
         String resolvedImportLocation = null;
-        try {
-            resolvedImportLocation = this.catalogResolver.resolveSystem(importLocation);
-            if (resolvedImportLocation == null) {
-                resolvedImportLocation = catalogResolver.resolveURI(importLocation);
-            }
-            if (resolvedImportLocation == null) {
-                resolvedImportLocation = catalogResolver.resolvePublic(importLocation, parent);
+        if (catalogResolver != 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);
             }
-        
-        } catch (IOException e) {
-            throw new RuntimeException("Catalog resolution failed", e);
         }
 
         InputSource in = null;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java Thu Nov 13 11:57:18 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.catalog;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
@@ -28,6 +29,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.resource.ExtendedURIResolver;
+import org.apache.cxf.transport.TransportURIResolver;
 import org.apache.ws.commons.schema.XmlSchemaException;
 import org.apache.ws.commons.schema.resolver.URIResolver;
 import org.apache.xml.resolver.Catalog;
@@ -43,6 +45,8 @@
 
     public CatalogXmlSchemaURIResolver(Bus bus) {
         this(OASISCatalogManager.getCatalogManager(bus));
+        this.resolver = new TransportURIResolver(bus);
+        this.catalogResolver = OASISCatalogManager.getCatalogManager(bus).getCatalog();
     }
     public CatalogXmlSchemaURIResolver(OASISCatalogManager catalogManager) {
         this.resolver = new ExtendedURIResolver();
@@ -85,7 +89,8 @@
                                          + (baseUri == null
                                             ? "."
                                             : ", relative to '" + baseUri + "'."));
-        } else if (in.getByteStream() != null) {
+        } else if (in.getByteStream() != null
+            && !(in.getByteStream() instanceof ByteArrayInputStream)) {
             //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

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java Thu Nov 13 11:57:18 2008
@@ -104,10 +104,13 @@
     }
 
     public void configureBean(Object beanInstance) {
-        configureBean(null, beanInstance);
+        configureBean(null, beanInstance, true);
     }
     
-    public synchronized void configureBean(String bn, Object beanInstance) {
+    public void configureBean(String bn, Object beanInstance) {
+        configureBean(bn, beanInstance, true);
+    }
+    public synchronized void configureBean(String bn, Object beanInstance, boolean checkWildcards) {
 
         if (null == appContexts) {
             return;
@@ -120,8 +123,9 @@
         if (null == bn) {
             return;
         }
-        
-        configureWithWildCard(bn, beanInstance);
+        if (checkWildcards) {
+            configureWithWildCard(bn, beanInstance);
+        }
         
         final String beanName = bn;
         setBeanWiringInfoResolver(new BeanWiringInfoResolver() {
@@ -155,7 +159,7 @@
     }
     
     private void configureWithWildCard(String bn, Object beanInstance) {
-        if (!wildCardBeanDefinitions.isEmpty() && !isWildcardBeanName(bn)) {
+        if (!wildCardBeanDefinitions.isEmpty()) {
             String className = beanInstance.getClass().getName();
             List<MatcherHolder> matchers = wildCardBeanDefinitions.get(className);
             if (matchers != null) {
@@ -163,7 +167,7 @@
                     synchronized (m.matcher) {
                         m.matcher.reset(bn);
                         if (m.matcher.matches()) {
-                            configureBean(m.wildCardId, beanInstance);
+                            configureBean(m.wildCardId, beanInstance, false);
                             return;
                         }
                     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java Thu Nov 13 11:57:18 2008
@@ -29,6 +29,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
+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;
@@ -119,7 +120,24 @@
     }
 
     public ConduitInitiator getConduitInitiatorForUri(String uri) {
-        // TODO Auto-generated method stub
+        for (ConduitInitiator ci : conduitInitiators.values()) {
+            for (String prefix : ci.getUriPrefixes()) {
+                if (uri.startsWith(prefix)) {
+                    return ci;
+                }
+            }
+        }
+        //looks like we'll need to undefer everything so we can try again.
+        if (conduitInitiators instanceof DeferredMap) {
+            ((DeferredMap)conduitInitiators).undefer();
+            for (ConduitInitiator df : conduitInitiators.values()) {
+                for (String prefix : df.getUriPrefixes()) {
+                    if (uri.startsWith(prefix)) {
+                        return df;
+                    }
+                }
+            }
+        }
         return null;
     }
     

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Thu Nov 13 11:57:18 2008
@@ -136,6 +136,7 @@
             
             if (!mp.containsKey("")) {
                 Definition def = new ServiceWSDLBuilder(bus, endpointInfo.getService()).build();
+
                 mp.put("", def);
                 updateDefinition(def, mp, smp, base, endpointInfo);
             }

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java?rev=713804&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java Thu Nov 13 11:57:18 2008
@@ -0,0 +1,90 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.wsdl11;
+
+import java.io.IOException;
+
+import javax.wsdl.xml.WSDLLocator;
+import org.xml.sax.InputSource;
+
+public abstract class AbstractWrapperWSDLLocator implements WSDLLocator {
+    protected WSDLLocator parent;
+    String wsdlUrl;
+    InputSource last;
+    String baseUri;
+    boolean fromParent;
+    
+    public AbstractWrapperWSDLLocator(String wsdlUrl,
+                                      WSDLLocator parent) {
+        this.wsdlUrl = wsdlUrl;
+        this.parent = parent;
+    }
+
+    public void close() {
+        if (!fromParent) {
+            try {
+                if (last.getByteStream() != null) {
+                    last.getByteStream().close();
+                }
+            } catch (IOException e) {
+                //ignore
+            }
+        }
+        parent.close();
+    }
+
+    public abstract InputSource getInputSource();
+    
+    public InputSource getBaseInputSource() {
+        InputSource is = parent.getBaseInputSource();
+        fromParent = true;
+        if (is == null) {
+            is = getInputSource();
+            fromParent = false;
+        } else {
+            baseUri = is.getSystemId();
+        }
+        last = is;
+        
+        return is;
+    }
+
+    public String getBaseURI() {
+        if (last == null) {
+            getBaseInputSource();
+            try {
+                if (last.getByteStream() != null) {
+                    last.getByteStream().close();
+                }
+            } catch (IOException e) {
+                //ignore
+            }
+        }
+        return baseUri;
+    }
+
+    public InputSource getImportInputSource(String parentLocation, String importLocation) {
+        return parent.getImportInputSource(parentLocation, importLocation);
+    }
+
+    public String getLatestImportURI() {
+        return parent.getLatestImportURI();
+    }
+
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ResourceManagerWSDLLocator.java Thu Nov 13 11:57:18 2008
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.wsdl11;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 
@@ -27,91 +26,39 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.catalog.CatalogWSDLLocator;
-import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.resource.ResourceManager;
 
 
-public class ResourceManagerWSDLLocator implements WSDLLocator {
-    WSDLLocator parent;
+public class ResourceManagerWSDLLocator extends AbstractWrapperWSDLLocator {
     Bus bus;
-    String wsdlUrl;
-    InputSource last;
-    String baseUri;
-    boolean fromParent;
     
     public ResourceManagerWSDLLocator(String wsdlUrl,
                                       WSDLLocator parent,
                                       Bus bus) {
-        this.wsdlUrl = wsdlUrl;
+        super(wsdlUrl, parent);
         this.bus = bus;
-        this.parent = parent;
     }
 
     public ResourceManagerWSDLLocator(String wsdlUrl,
                                       Bus bus) {
-        this.wsdlUrl = wsdlUrl;
+        super(wsdlUrl, new CatalogWSDLLocator(wsdlUrl, bus));
         this.bus = bus;
-        this.parent = new CatalogWSDLLocator(wsdlUrl, OASISCatalogManager.getCatalogManager(bus));
     }
 
 
-    public void close() {
-        if (!fromParent) {
-            try {
-                if (last.getByteStream() != null) {
-                    last.getByteStream().close();
-                }
-            } catch (IOException e) {
-                //ignore
-            }
+    public InputSource getInputSource() {
+        InputStream ins = bus.getExtension(ResourceManager.class).getResourceAsStream(wsdlUrl);
+        InputSource is = new InputSource(ins);
+        is.setSystemId(wsdlUrl);
+        is.setPublicId(wsdlUrl);
+
+        URL url = bus.getExtension(ResourceManager.class).resolveResource(wsdlUrl, URL.class);
+        if (url != null) {
+            is.setSystemId(url.toString());
+            is.setPublicId(url.toString());
         }
-        parent.close();
-    }
-
-    public InputSource getBaseInputSource() {
-        InputSource is = parent.getBaseInputSource();
-        fromParent = true;
-        if (is == null) {
-            InputStream ins = bus.getExtension(ResourceManager.class).getResourceAsStream(wsdlUrl);
-            is = new InputSource(ins);
-            is.setSystemId(wsdlUrl);
-            is.setPublicId(wsdlUrl);
-
-            URL url = bus.getExtension(ResourceManager.class).resolveResource(wsdlUrl, URL.class);
-            if (url != null) {
-                is.setSystemId(url.toString());
-                is.setPublicId(url.toString());
-            }
-            fromParent = false;
-            baseUri = is.getPublicId();
-        } else {
-            baseUri = is.getSystemId();
-        }
-        last = is;
-        
+        baseUri = is.getPublicId();
         return is;
     }
-
-    public String getBaseURI() {
-        if (last == null) {
-            getBaseInputSource();
-            try {
-                if (last.getByteStream() != null) {
-                    last.getByteStream().close();
-                }
-            } catch (IOException e) {
-                //ignore
-            }
-        }
-        return baseUri;
-    }
-
-    public InputSource getImportInputSource(String parentLocation, String importLocation) {
-        return parent.getImportInputSource(parentLocation, importLocation);
-    }
-
-    public String getLatestImportURI() {
-        return parent.getLatestImportURI();
-    }
-
+    
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java Thu Nov 13 11:57:18 2008
@@ -38,7 +38,6 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
-import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.SchemaInfo;
@@ -119,7 +118,7 @@
     
                         schemaCol.setBaseUri(def.getDocumentBaseURI());
                         CatalogXmlSchemaURIResolver schemaResolver =
-                            new CatalogXmlSchemaURIResolver(OASISCatalogManager.getCatalogManager(bus));
+                            new CatalogXmlSchemaURIResolver(bus);
                         schemaCol.setSchemaResolver(schemaResolver);
                         
                         XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java Thu Nov 13 11:57:18 2008
@@ -409,6 +409,12 @@
         
         Map<QName, MessageInfo> messages = serviceInfo.getMessages();
         for (Map.Entry<QName, MessageInfo> mie : messages.entrySet()) {
+            if (!mie.getKey().getNamespaceURI().equals(definition.getTargetNamespace())) {
+                continue;
+            }
+            if (definition.getMessage(mie.getKey()) != null) {
+                continue;
+            }
             Message message = definition.createMessage();
             message.setUndefined(false);
             message.setQName(mie.getKey());

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Thu Nov 13 11:57:18 2008
@@ -51,7 +51,6 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.catalog.CatalogWSDLLocator;
-import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.CacheMap;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
@@ -204,8 +203,7 @@
         reader.setFeature("javax.wsdl.verbose", false);
         reader.setFeature("javax.wsdl.importDocuments", true);
         reader.setExtensionRegistry(registry);
-        CatalogWSDLLocator catLocator = 
-            new CatalogWSDLLocator(url, OASISCatalogManager.getCatalogManager(bus));
+        CatalogWSDLLocator catLocator = new CatalogWSDLLocator(url, bus);
         ResourceManagerWSDLLocator wsdlLocator = new ResourceManagerWSDLLocator(url,
                                                                                 catLocator,
                                                                                 bus);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Thu Nov 13 11:57:18 2008
@@ -103,10 +103,15 @@
     private static final Logger LOG = LogUtils.getL7dLogger(WSDLServiceBuilder.class);
     private Bus bus;
     private Map<String, Element> schemaList = new HashMap<String, Element>();
+    private boolean recordOriginal = true;
 
     public WSDLServiceBuilder(Bus bus) {
         this.bus = bus;
     }
+    public WSDLServiceBuilder(Bus bus, boolean record) {
+        this.bus = bus;
+        recordOriginal = record;
+    }
 
     private void copyExtensors(AbstractPropertiesHolder info, List<?> extList) {
         if (info != null) {
@@ -128,7 +133,9 @@
 
     public List<ServiceInfo> buildServices(Definition d) {
         DescriptionInfo description = new DescriptionInfo();
-        description.setProperty(WSDL_DEFINITION, d);
+        if (recordOriginal) {
+            description.setProperty(WSDL_DEFINITION, d);
+        }
         description.setName(d.getQName());
         description.setBaseURI(d.getDocumentBaseURI());
         copyExtensors(description, d.getExtensibilityElements());
@@ -180,7 +187,9 @@
             if (def.getPortTypes().size() == 0) {
 
                 DescriptionInfo description = new DescriptionInfo();
-                description.setProperty(WSDL_DEFINITION, def);
+                if (recordOriginal) {
+                    description.setProperty(WSDL_DEFINITION, def);
+                }
                 description.setName(def.getQName());
                 description.setBaseURI(def.getDocumentBaseURI());
                 copyExtensors(description, def.getExtensibilityElements());
@@ -188,7 +197,9 @@
 
                 ServiceInfo service = new ServiceInfo();
                 service.setDescription(description);
-                service.setProperty(WSDL_DEFINITION, def);
+                if (recordOriginal) {
+                    service.setProperty(WSDL_DEFINITION, def);
+                }
                 getSchemas(def, service);
 
                 service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
@@ -200,7 +211,9 @@
 
     public ServiceInfo buildMockService(Definition def, PortType p) {
         DescriptionInfo description = new DescriptionInfo();
-        description.setProperty(WSDL_DEFINITION, def);
+        if (recordOriginal) {
+            description.setProperty(WSDL_DEFINITION, def);
+        }
         description.setName(def.getQName());
         description.setBaseURI(def.getDocumentBaseURI());
         copyExtensors(description, def.getExtensibilityElements());
@@ -208,7 +221,9 @@
 
         ServiceInfo service = new ServiceInfo();
         service.setDescription(description);
-        service.setProperty(WSDL_DEFINITION, def);
+        if (recordOriginal) {
+            service.setProperty(WSDL_DEFINITION, def);
+        }
         getSchemas(def, service);
 
         service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
@@ -224,7 +239,9 @@
         DescriptionInfo description = d;
         if (null == description) {
             description = new DescriptionInfo();
-            description.setProperty(WSDL_DEFINITION, def);
+            if (recordOriginal) {
+                description.setProperty(WSDL_DEFINITION, def);
+            }
             description.setName(def.getQName());
             description.setBaseURI(def.getDocumentBaseURI());
             copyExtensors(description, def.getExtensibilityElements());
@@ -259,8 +276,10 @@
                 service = new ServiceInfo();
                 service.setDescription(description);
                 description.getDescribed().add(service);
-                service.setProperty(WSDL_DEFINITION, def);
-                service.setProperty(WSDL_SERVICE, serv);
+                if (recordOriginal) {
+                    service.setProperty(WSDL_DEFINITION, def);
+                    service.setProperty(WSDL_SERVICE, serv);
+                }
                 getSchemas(def, service);
 
                 service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
@@ -492,7 +511,9 @@
         }
         this.copyExtensors(inf, p.getExtensibilityElements());
         this.copyExtensionAttributes(inf, p);
-        inf.setProperty(WSDL_PORTTYPE, p);
+        if (recordOriginal) {
+            inf.setProperty(WSDL_PORTTYPE, p);
+        }
         for (Operation op : cast(p.getOperations(), Operation.class)) {
             buildInterfaceOperation(inf, op);
         }
@@ -501,7 +522,9 @@
 
     private void buildInterfaceOperation(InterfaceInfo inf, Operation op) {
         OperationInfo opInfo = inf.addOperation(new QName(inf.getName().getNamespaceURI(), op.getName()));
-        opInfo.setProperty(WSDL_OPERATION, op);
+        if (recordOriginal) {
+            opInfo.setProperty(WSDL_OPERATION, op);
+        }
         List<String> porderList = CastUtils.cast((List)op.getParameterOrdering());
         opInfo.setParameterOrdering(porderList);
         this.copyExtensors(opInfo, op.getExtensibilityElements());

Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java (original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java Thu Nov 13 11:57:18 2008
@@ -88,7 +88,7 @@
         bindingFactoryManager = control.createMock(BindingFactoryManager.class);
         destinationFactoryManager = control.createMock(DestinationFactoryManager.class);
         destinationFactory = control.createMock(DestinationFactory.class);
-        wsdlServiceBuilder = new WSDLServiceBuilder(bus);
+        wsdlServiceBuilder = new WSDLServiceBuilder(bus, false);
 
         for (Service serv : CastUtils.cast(def.getServices().values(), Service.class)) {
             if (serv != null) {
@@ -109,10 +109,7 @@
         control.replay();
         
         serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
-        serviceInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
-        serviceInfo.setProperty(WSDLServiceBuilder.WSDL_SERVICE, null);
         newDef = new ServiceWSDLBuilder(bus, serviceInfo).build();
-        
     }
     
     @After

Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java (original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java Thu Nov 13 11:57:18 2008
@@ -44,6 +44,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.catalog.CatalogWSDLLocator;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.helpers.CastUtils;
@@ -111,7 +112,7 @@
         WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose", false);
         
-        def = wsdlReader.readWSDL(new WSDLLocatorImpl(wsdlUrl));
+        def = wsdlReader.readWSDL(new CatalogWSDLLocator(wsdlUrl));
 
         int seq = 0;
         for (Service serv : CastUtils.cast(def.getServices().values(), Service.class)) {

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java Thu Nov 13 11:57:18 2008
@@ -34,11 +34,11 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.catalog.CatalogWSDLLocator;
 import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.cxf.wsdl11.WSDLLocatorImpl;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -147,7 +147,7 @@
     private ServiceInfo getMockedServiceModel(String wsdlUrl) throws Exception {
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose", false);
-        Definition def = wsdlReader.readWSDL(new WSDLLocatorImpl(wsdlUrl));
+        Definition def = wsdlReader.readWSDL(new CatalogWSDLLocator(wsdlUrl));
 
         IMocksControl control = EasyMock.createNiceControl();
         Bus bus = control.createMock(Bus.class);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java Thu Nov 13 11:57:18 2008
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.systest.http;
 
+import java.net.URL;
+
 import javax.xml.ws.BindingProvider;
 
 import org.apache.cxf.BusFactory;
@@ -75,12 +77,19 @@
     //
     // tests
     //
-    
-    
-    public final void testSuccessfulCall(String configuration, String address) throws Exception {
+    public final void testSuccessfulCall(String configuration,
+                                         String address) throws Exception {
+        testSuccessfulCall(configuration, address, null);
+    }
+    public final void testSuccessfulCall(String configuration,
+                                         String address,
+                                         URL url) throws Exception {
         setTheConfiguration(configuration);
         startServers();
-        SOAPService service = new SOAPService();
+        if (url == null) {
+            url = SOAPService.WSDL_LOCATION;
+        }
+        SOAPService service = new SOAPService(url, SOAPService.SERVICE);
         assertNotNull("Service is null", service);   
         final Greeter port = service.getHttpsPort();
         assertNotNull("Port is null", port);
@@ -120,6 +129,7 @@
     @Test
     public final void testResourceKeySpecEndpointURL() throws Exception {
         testSuccessfulCall("resources/resource-key-spec-url.xml",
-                           "https://localhost:9005/SoapContext/HttpsPort");
+                           "https://localhost:9005/SoapContext/HttpsPort",
+                           new URL("https://localhost:9005/SoapContext/HttpsPort?wsdl"));
     }
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml Thu Nov 13 11:57:18 2008
@@ -80,7 +80,7 @@
     <!-- -->
     <!-- This test exercises the resource attribute in a keyStore and certStore element -->
     <!-- -->
-    <http:conduit name="https://localhost:9005/SoapContext/HttpsPort">
+    <http:conduit name="https://localhost:9005/SoapContext/HttpsPort.*">
         <http:tlsClientParameters disableCNCheck="true">
             <sec:keyManagers keyPassword="password">
                <sec:keyStore type="pkcs12" password="password" 

Modified: cxf/trunk/tools/javato/ws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/pom.xml?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/pom.xml (original)
+++ cxf/trunk/tools/javato/ws/pom.xml Thu Nov 13 11:57:18 2008
@@ -136,7 +136,12 @@
             <artifactId>cxf-rt-databinding-aegis</artifactId>
             <version>${project.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxws</artifactId>

Modified: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java?rev=713804&r1=713803&r2=713804&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java (original)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java Thu Nov 13 11:57:18 2008
@@ -26,6 +26,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -37,6 +38,7 @@
 import org.apache.cxf.tools.fortest.withannotation.doc.Hello;
 import org.apache.cxf.tools.java2wsdl.generator.wsdl11.WSDL11Generator;
 import org.apache.cxf.tools.util.AnnotationUtil;
+import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.hello_world_rpclit.javato.GreeterRPCLit;
 import org.junit.After;
 import org.junit.Before;
@@ -54,6 +56,10 @@
         builder = new JaxwsServiceBuilder();
         builder.setBus(BusFactory.getDefaultBus());
         generator.setBus(builder.getBus());
+        
+        Bus b = builder.getBus();
+        assertNotNull(b.getExtension(DestinationFactoryManager.class)
+            .getDestinationFactory("http://schemas.xmlsoap.org/soap/http"));
     }
 
     @After