axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r635703 - in /webservices/axis2/trunk/java/modules: jaxws-integration/test/org/apache/axis2/jaxws/catalog/ jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/ jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ jaxws/sr...
Date Mon, 10 Mar 2008 21:33:43 GMT
Author: scheu
Date: Mon Mar 10 14:33:29 2008
New Revision: 635703

URL: http://svn.apache.org/viewvc?rev=635703&view=rev
Log:
WSCOMMONS-3581
Contributor: Rich Scheuerle
Details of Fix:

1) Added new constructors to WSDL4JWrapper and WSDLDefinitionWrapper to allow the 
caller to pass in the configuration or memory limit parameters.

2) Deprecated the constructors in WSDL4JWrapper and WSDLDefinitionWrapper that
do not pass in configuration or memory limit parameters.  I changed references in the
code to use the new constructors (prefering the ones that pass in the AxisConfiguration).

2a) In the cases where the AxisConfiguration is not available, the code builds a 
WSDL4JWrapper using local information.  For example, if the WSDL4JWrapper is only temporary, then the basic wrapper is used.  For example, if the WSDL4JWrapper is built by JAXWS and
the configuration is not available...then a reload wrapper is sometimes used.

3) Added debug trace information in the WSDLWrapper*Impl constructors that show the call
path for how they were created. 

4) Added debug trace in the Options, AbstractContext and ParameterIncludeImpl classes
to log changes to the properties/parameters.  This can help narrow problems.  (Purely
for support)

Kudos to Vien Tran for working with me on this fix.

Modified:
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/Axis2EndpointReferenceFactoryImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/JavaUtils.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDLWrapper.java

Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java Mon Mar 10 14:33:29 2008
@@ -1,145 +1,145 @@
-/*
- * 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.axis2.jaxws.catalog;
-
-import junit.framework.TestCase;
-import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
-import org.apache.axis2.jaxws.util.WSDL4JWrapper;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Part;
-import javax.wsdl.PortType;
-import javax.wsdl.WSDLException;
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * Tests the use of the Apache Commons Resolver API to resolve URIs.
- */
-public class MultiRedirectionCatalogTest extends TestCase {
-	private static final String ROOT_WSDL = "/test-resources/catalog/root.wsdl";
-	private static final String TEST_RESOURCES = "/test-resources/catalog/";
-	
-	public void testOneCatalogSuccess() {
-		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "basic-catalog.xml");
-	}
-
-	public void testNextCatalogSuccess() {
-		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "root-catalog.xml");
-	}
-	
-	public void testNextCatalogFailure() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/root-catalog.xml");		
-	}
-	
-	public void testNoCatEntryForFirstImport() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/firstImportFail.xml");
-	}
-	
-	public void testNoCatEntryForSecondImport() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/secondImportFail.xml");
-	}
-	
-	public void testNoCatEntryForThirdImport() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/thirdImportFail.xml");
-	}
-	
-	/**
-	 * Ensure that the catalog is used to locate imported resources.
-	 */
-	private void verifySuccess(String wsdlLocation, String catalogFile) {
-	    URL url = getURLFromLocation(wsdlLocation);
-	    
-	    try{
-			OASISCatalogManager catalogManager = new OASISCatalogManager();
-			catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
-            WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager);
-	    	Definition wsdlDef = w4j.getDefinition();
-	    	assertNotNull(wsdlDef);   
-	    	QName portTypeName = new QName("http://www.example.com/test/calculator",
-	    			                       "CalculatorService",
-	    			                       "");
-	    	PortType portType = wsdlDef.getPortType(portTypeName);
-	    	assertNotNull(portType);
-	    	Operation clearOp = portType.getOperation("clear", null, null);
-	    	assertNotNull(clearOp);
-	    	Input clearOpInput = clearOp.getInput();
-	    	assertNotNull(clearOpInput);
-	    	Message msg = clearOpInput.getMessage();
-	    	assertNotNull(msg);
-	    	Part expectedPart = msg.getPart("part1");
-            assertNotNull(expectedPart);
-	    }catch(Exception e){
-	    	e.printStackTrace();
-	    	fail();
-	    }
-	}	
-	
-	/**
-	 * Ensure that the test case is valid by failing in the absence of a needed
-	 * catalog entry.
-	 */
-	private void verifyFailure(String wsdlLocation, String catalogFile) {
-	    URL url = getURLFromLocation(wsdlLocation);
-	    
-	    try{
-			OASISCatalogManager catalogManager = new OASISCatalogManager();
-            catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
-	    	WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager);
-	    	w4j.getDefinition();
-	    	fail("Should have received a WSDLException due to the invalid WSDL location " 
-	        		+ "not redirected by the catalog.");
-	    } catch(WSDLException e) {
-	    	// do nothing - successful test case
-	    } catch(Exception e){
-	    	e.printStackTrace();
-	    	fail();
-	    }
-	}
-	
-	/**
-	 * Given a String representing a file location, return a URL.
-	 * @param wsdlLocation
-	 * @return
-	 */
-	private URL getURLFromLocation(String wsdlLocation) {
-		URL url = null;
-	    try {
-	    	try{
-	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
-	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
-        	}catch(Exception e){
-        		e.printStackTrace();
-        		fail();
-        	}
-	       	File file = new File(wsdlLocation);
-	       	url = file.toURL();
-	    } catch (MalformedURLException e) {
-	        e.printStackTrace();
-	        fail();
-	    }
-	    
-	    return url;
-	}
-}
+/*
+ * 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.axis2.jaxws.catalog;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Tests the use of the Apache Commons Resolver API to resolve URIs.
+ */
+public class MultiRedirectionCatalogTest extends TestCase {
+	private static final String ROOT_WSDL = "/test-resources/catalog/root.wsdl";
+	private static final String TEST_RESOURCES = "/test-resources/catalog/";
+	
+	public void testOneCatalogSuccess() {
+		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "basic-catalog.xml");
+	}
+
+	public void testNextCatalogSuccess() {
+		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "root-catalog.xml");
+	}
+	
+	public void testNextCatalogFailure() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/root-catalog.xml");		
+	}
+	
+	public void testNoCatEntryForFirstImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/firstImportFail.xml");
+	}
+	
+	public void testNoCatEntryForSecondImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/secondImportFail.xml");
+	}
+	
+	public void testNoCatEntryForThirdImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/thirdImportFail.xml");
+	}
+	
+	/**
+	 * Ensure that the catalog is used to locate imported resources.
+	 */
+	private void verifySuccess(String wsdlLocation, String catalogFile) {
+	    URL url = getURLFromLocation(wsdlLocation);
+	    
+	    try{
+			OASISCatalogManager catalogManager = new OASISCatalogManager();
+			catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
+            WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager, false);
+	    	Definition wsdlDef = w4j.getDefinition();
+	    	assertNotNull(wsdlDef);   
+	    	QName portTypeName = new QName("http://www.example.com/test/calculator",
+	    			                       "CalculatorService",
+	    			                       "");
+	    	PortType portType = wsdlDef.getPortType(portTypeName);
+	    	assertNotNull(portType);
+	    	Operation clearOp = portType.getOperation("clear", null, null);
+	    	assertNotNull(clearOp);
+	    	Input clearOpInput = clearOp.getInput();
+	    	assertNotNull(clearOpInput);
+	    	Message msg = clearOpInput.getMessage();
+	    	assertNotNull(msg);
+	    	Part expectedPart = msg.getPart("part1");
+            assertNotNull(expectedPart);
+	    }catch(Exception e){
+	    	e.printStackTrace();
+	    	fail();
+	    }
+	}	
+	
+	/**
+	 * Ensure that the test case is valid by failing in the absence of a needed
+	 * catalog entry.
+	 */
+	private void verifyFailure(String wsdlLocation, String catalogFile) {
+	    URL url = getURLFromLocation(wsdlLocation);
+	    
+	    try{
+			OASISCatalogManager catalogManager = new OASISCatalogManager();
+            catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
+	    	WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager, false);
+	    	w4j.getDefinition();
+	    	fail("Should have received a WSDLException due to the invalid WSDL location " 
+	        		+ "not redirected by the catalog.");
+	    } catch(WSDLException e) {
+	    	// do nothing - successful test case
+	    } catch(Exception e){
+	    	e.printStackTrace();
+	    	fail();
+	    }
+	}
+	
+	/**
+	 * Given a String representing a file location, return a URL.
+	 * @param wsdlLocation
+	 * @return
+	 */
+	private URL getURLFromLocation(String wsdlLocation) {
+		URL url = null;
+	    try {
+	    	try{
+	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        		fail();
+        	}
+	       	File file = new File(wsdlLocation);
+	       	url = file.toURL();
+	    } catch (MalformedURLException e) {
+	        e.printStackTrace();
+	        fail();
+	    }
+	    
+	    return url;
+	}
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/Axis2EndpointReferenceFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/Axis2EndpointReferenceFactoryImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/Axis2EndpointReferenceFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/Axis2EndpointReferenceFactoryImpl.java Mon Mar 10 14:33:29 2008
@@ -97,7 +97,8 @@
 
             if (wsdlDocumentLocation != null) {
             	URL wsdlURL = new URL(wsdlDocumentLocation);
-            	WSDLWrapper wrapper = new WSDL4JWrapper(wsdlURL);
+            	// This is a temporary usage, so use a memory sensitive wrapper
+                WSDLWrapper wrapper = new WSDL4JWrapper(wsdlURL, true, 2);
             	
             	if (serviceName != null) {
             		//TODO NLS

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java Mon Mar 10 14:33:29 2008
@@ -449,7 +449,10 @@
                                 if(log.isDebugEnabled()){
                                     log.debug("Reading WSDL from URL:" +url.toString());
                                 }
-                                WSDLWrapper wsdlWrapper = new WSDL4JWrapper(url);
+                                // This is a temporary wsdl and we use it to dig into the schemas,
+                                // Thus the memory limit is set to false.  It will be discarded after it is used
+                                // by the PackageSetBuilder implementation.
+                                WSDLWrapper wsdlWrapper = new WSDL4JWrapper(url, false, 0);
                                 return wsdlWrapper.getDefinition();
                             }
                         });

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/JavaUtils.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/JavaUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/JavaUtils.java Mon Mar 10 14:33:29 2008
@@ -174,42 +174,6 @@
         return name;
     }
 
-    /**
-     * replace: Like String.replace except that the old new items are strings.
-     *
-     * @param name string
-     * @param oldT old text to replace
-     * @param newT new text to use
-     * @return replacement string
-     */
-    public static final String replace(String name,
-                                       String oldT, String newT) {
-
-        if (name == null) return "";
-
-        // Create a string buffer that is twice initial length.
-        // This is a good starting point.
-        StringBuffer sb = new StringBuffer(name.length() * 2);
-
-        int len = oldT.length();
-        try {
-            int start = 0;
-            int i = name.indexOf(oldT, start);
-
-            while (i >= 0) {
-                sb.append(name.substring(start, i));
-                sb.append(newT);
-                start = i + len;
-                i = name.indexOf(oldT, start);
-            }
-            if (start < name.length())
-                sb.append(name.substring(start));
-        } catch (NullPointerException e) {
-            // No FFDC code needed
-        }
-
-        return new String(sb);
-    }
 
     /**
      * Get a string containing the stack of the current location

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java Mon Mar 10 14:33:29 2008
@@ -1,147 +1,147 @@
-/*
- * 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.axis2.jaxws.catalog;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Part;
-import javax.wsdl.PortType;
-import javax.wsdl.WSDLException;
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
-import org.apache.axis2.jaxws.util.WSDL4JWrapper;
-
-import junit.framework.TestCase;
-
-/**
- * Tests the use of the Apache Commons Resolver API to resolve URIs.
- */
-public class MultiRedirectionCatalogTest extends TestCase {
-	private static final String ROOT_WSDL = "/test-resources/catalog/root.wsdl";
-	private static final String TEST_RESOURCES = "/test-resources/catalog/";
-	
-	public void testOneCatalogSuccess() {
-		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "basic-catalog.xml");
-	}
-
-	public void testNextCatalogSuccess() {
-		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "root-catalog.xml");
-	}
-	
-	public void testNextCatalogFailure() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/root-catalog.xml");		
-	}
-	
-	public void testNoCatEntryForFirstImport() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/firstImportFail.xml");
-	}
-	
-	public void testNoCatEntryForSecondImport() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/secondImportFail.xml");
-	}
-	
-	public void testNoCatEntryForThirdImport() {
-		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/thirdImportFail.xml");
-	}
-	
-	/**
-	 * Ensure that the catalog is used to locate imported resources.
-	 */
-	private void verifySuccess(String wsdlLocation, String catalogFile) {
-	    URL url = getURLFromLocation(wsdlLocation);
-	    
-	    try{
-			OASISCatalogManager catalogManager = new OASISCatalogManager();
-			catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
-            WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager);
-	    	Definition wsdlDef = w4j.getDefinition();
-	    	assertNotNull(wsdlDef);   
-	    	QName portTypeName = new QName("http://www.example.com/test/calculator",
-	    			                       "CalculatorService",
-	    			                       "");
-	    	PortType portType = wsdlDef.getPortType(portTypeName);
-	    	assertNotNull(portType);
-	    	Operation clearOp = portType.getOperation("clear", null, null);
-	    	assertNotNull(clearOp);
-	    	Input clearOpInput = clearOp.getInput();
-	    	assertNotNull(clearOpInput);
-	    	Message msg = clearOpInput.getMessage();
-	    	assertNotNull(msg);
-	    	Part expectedPart = msg.getPart("part1");
-            assertNotNull(expectedPart);
-	    }catch(Exception e){
-	    	e.printStackTrace();
-	    	fail();
-	    }
-	}	
-	
-	/**
-	 * Ensure that the test case is valid by failing in the absence of a needed
-	 * catalog entry.
-	 */
-	private void verifyFailure(String wsdlLocation, String catalogFile) {
-	    URL url = getURLFromLocation(wsdlLocation);
-	    
-	    try{
-			OASISCatalogManager catalogManager = new OASISCatalogManager();
-            catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
-	    	WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager);
-	    	w4j.getDefinition();
-	    	fail("Should have received a WSDLException due to the invalid WSDL location " 
-	        		+ "not redirected by the catalog.");
-	    } catch(WSDLException e) {
-	    	// do nothing - successful test case
-	    } catch(Exception e){
-	    	e.printStackTrace();
-	    	fail();
-	    }
-	}
-	
-	/**
-	 * Given a String representing a file location, return a URL.
-	 * @param wsdlLocation
-	 * @return
-	 */
-	private URL getURLFromLocation(String wsdlLocation) {
-		URL url = null;
-	    try {
-	    	try{
-	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
-	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
-        	}catch(Exception e){
-        		e.printStackTrace();
-        		fail();
-        	}
-	       	File file = new File(wsdlLocation);
-	       	url = file.toURL();
-	    } catch (MalformedURLException e) {
-	        e.printStackTrace();
-	        fail();
-	    }
-	    
-	    return url;
-	}
-}
+/*
+ * 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.axis2.jaxws.catalog;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the use of the Apache Commons Resolver API to resolve URIs.
+ */
+public class MultiRedirectionCatalogTest extends TestCase {
+	private static final String ROOT_WSDL = "/test-resources/catalog/root.wsdl";
+	private static final String TEST_RESOURCES = "/test-resources/catalog/";
+	
+	public void testOneCatalogSuccess() {
+		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "basic-catalog.xml");
+	}
+
+	public void testNextCatalogSuccess() {
+		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "root-catalog.xml");
+	}
+	
+	public void testNextCatalogFailure() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/root-catalog.xml");		
+	}
+	
+	public void testNoCatEntryForFirstImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/firstImportFail.xml");
+	}
+	
+	public void testNoCatEntryForSecondImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/secondImportFail.xml");
+	}
+	
+	public void testNoCatEntryForThirdImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/thirdImportFail.xml");
+	}
+	
+	/**
+	 * Ensure that the catalog is used to locate imported resources.
+	 */
+	private void verifySuccess(String wsdlLocation, String catalogFile) {
+	    URL url = getURLFromLocation(wsdlLocation);
+	    
+	    try{
+			OASISCatalogManager catalogManager = new OASISCatalogManager();
+			catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
+            WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager, false, 0);
+	    	Definition wsdlDef = w4j.getDefinition();
+	    	assertNotNull(wsdlDef);   
+	    	QName portTypeName = new QName("http://www.example.com/test/calculator",
+	    			                       "CalculatorService",
+	    			                       "");
+	    	PortType portType = wsdlDef.getPortType(portTypeName);
+	    	assertNotNull(portType);
+	    	Operation clearOp = portType.getOperation("clear", null, null);
+	    	assertNotNull(clearOp);
+	    	Input clearOpInput = clearOp.getInput();
+	    	assertNotNull(clearOpInput);
+	    	Message msg = clearOpInput.getMessage();
+	    	assertNotNull(msg);
+	    	Part expectedPart = msg.getPart("part1");
+            assertNotNull(expectedPart);
+	    }catch(Exception e){
+	    	e.printStackTrace();
+	    	fail();
+	    }
+	}	
+	
+	/**
+	 * Ensure that the test case is valid by failing in the absence of a needed
+	 * catalog entry.
+	 */
+	private void verifyFailure(String wsdlLocation, String catalogFile) {
+	    URL url = getURLFromLocation(wsdlLocation);
+	    
+	    try{
+			OASISCatalogManager catalogManager = new OASISCatalogManager();
+            catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
+	    	WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager, false, 0);
+	    	w4j.getDefinition();
+	    	fail("Should have received a WSDLException due to the invalid WSDL location " 
+	        		+ "not redirected by the catalog.");
+	    } catch(WSDLException e) {
+	    	// do nothing - successful test case
+	    } catch(Exception e){
+	    	e.printStackTrace();
+	    	fail();
+	    }
+	}
+	
+	/**
+	 * Given a String representing a file location, return a URL.
+	 * @param wsdlLocation
+	 * @return
+	 */
+	private URL getURLFromLocation(String wsdlLocation) {
+		URL url = null;
+	    try {
+	    	try{
+	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        		fail();
+        	}
+	       	File file = new File(wsdlLocation);
+	       	url = file.toURL();
+	    } catch (MalformedURLException e) {
+	        e.printStackTrace();
+	        fail();
+	    }
+	    
+	    return url;
+	}
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/Options.java Mon Mar 10 14:33:29 2008
@@ -36,6 +36,7 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.TransportListener;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.MetaDataEntry;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -48,8 +49,10 @@
 import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 
 /**
@@ -68,6 +71,8 @@
      * setup for logging
      */
     private static final Log log = LogFactory.getLog(Options.class);
+    private static boolean DEBUG_ENABLED = log.isDebugEnabled();
+    private static boolean DEBUG_CALLSTACK_ON_SET = log.isDebugEnabled();
 
     private static final String myClassName = "Options";
 
@@ -653,6 +658,17 @@
      * @param properties
      */
     public void setProperties(Map properties) {
+        
+        if (this.properties != properties) {
+            if (DEBUG_ENABLED) {
+                for (Iterator iterator = properties.entrySet().iterator();
+                iterator.hasNext();) {
+                    Entry entry = (Entry) iterator.next();
+                    debugPropertySet((String) entry.getKey(), entry.getValue());
+
+                }
+            }
+        }
         this.properties = properties;
     }
 
@@ -846,6 +862,9 @@
             this.properties = new HashMap();
         }
         properties.put(propertyKey, property);
+        if (DEBUG_ENABLED) {
+            debugPropertySet(propertyKey, property);
+        }
     }
 
     /**
@@ -1611,5 +1630,35 @@
 
     public void setPassword(String password) {
         this.password = password;
+    }
+    
+    /**
+     * Debug for for property key and value.
+     * @param key
+     * @param value
+     */
+    private void debugPropertySet(String key, Object value) {
+        if (DEBUG_ENABLED) {
+            String className = (value == null) ? "null" : value.getClass().getName();
+            String classloader = (value == null || value.getClass().getClassLoader() == null)? "null" : 
+                value.getClass().getClassLoader().toString();
+            String valueText = (value instanceof String) ? value.toString() : null;
+            
+            String identity = getClass().getName() + '@' + 
+                Integer.toHexString(System.identityHashCode(this));
+            
+            log.debug("==================");
+            log.debug(" Property set on object " + identity);
+            log.debug("  Key =" + key);
+            if (valueText != null) {
+                log.debug("  Value =" + valueText);
+            }
+            log.debug("  Value Class = " + className);
+            log.debug("  Value Classloader = " + classloader);
+            if (DEBUG_CALLSTACK_ON_SET) {
+                log.debug(  "Call Stack = " + JavaUtils.callStackToString());
+            }
+            log.debug("==================");
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java Mon Mar 10 14:33:29 2008
@@ -23,16 +23,25 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.clustering.ClusterManager;
 import org.apache.axis2.clustering.context.Replicator;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 
 /**
  * This is the top most level of the Context hierarchy and is a bag of properties.
  */
 public abstract class AbstractContext {
 
+    private static final Log log = LogFactory.getLog(AbstractContext.class);
+    
+    private static boolean DEBUG_ENABLED = log.isDebugEnabled();
+    private static boolean DEBUG_CALLSTACK_ON_SET = log.isDebugEnabled();
+    
     /**
      * Property used to indicate copying of properties is needed by context.
      */
@@ -168,6 +177,9 @@
         }
         properties.put(key, value);
         addPropertyDifference(key, value, false);
+        if (DEBUG_ENABLED) {
+            debugPropertySet(key, value);
+        }
     }
 
     private void addPropertyDifference(String key, Object value,  boolean isRemoved) {
@@ -303,6 +315,17 @@
             if ((copyProperties != null) && copyProperties.booleanValue()) {
                 mergeProperties(properties);
             } else {
+                
+                if (this.properties != properties) {
+                    if (DEBUG_ENABLED) {
+                        for (Iterator iterator = properties.entrySet().iterator();
+                        iterator.hasNext();) {
+                            Entry entry = (Entry) iterator.next();
+                            debugPropertySet((String) entry.getKey(), entry.getValue());
+
+                        }
+                    }
+                }
                 this.properties = properties;
             }
         }
@@ -322,7 +345,11 @@
             for (Iterator iterator = props.keySet().iterator();
                  iterator.hasNext();) {
                 Object key = iterator.next();
-                this.properties.put(key, props.get(key));
+                Object value = props.get(key);
+                this.properties.put(key, value);
+                if (DEBUG_ENABLED) {
+                    debugPropertySet((String) key, value);
+                }
             }
         }
     }
@@ -357,4 +384,32 @@
 
     public abstract ConfigurationContext getRootContext();
 
+    /**
+     * Debug for for property key and value.
+     * @param key
+     * @param value
+     */
+    private void debugPropertySet(String key, Object value) {
+        if (DEBUG_ENABLED) {
+            String className = (value == null) ? "null" : value.getClass().getName();
+            String classloader = (value == null || value.getClass().getClassLoader() == null) ? "null" : 
+                value.getClass().getClassLoader().toString();
+            String valueText = (value instanceof String) ? value.toString() : null;
+            String identity = getClass().getName() + '@' + 
+                Integer.toHexString(System.identityHashCode(this));
+            
+            log.debug("==================");
+            log.debug(" Property set on object " + identity);
+            log.debug("  Key =" + key);
+            if (valueText != null) {
+                log.debug("  Value =" + valueText);
+            }
+            log.debug("  Value Class = " + className);
+            log.debug("  Value Classloader = " + classloader);
+            if (this.DEBUG_CALLSTACK_ON_SET) {
+                log.debug(  "Call Stack = " + JavaUtils.callStackToString());
+            }
+            log.debug("==================");
+        }
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/ParameterIncludeImpl.java Mon Mar 10 14:33:29 2008
@@ -28,6 +28,7 @@
 import org.apache.axis2.context.externalize.SafeObjectOutputStream;
 import org.apache.axis2.context.externalize.SafeSerializable;
 import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -52,6 +53,8 @@
      * setup for logging
      */
     private static final Log log = LogFactory.getLog(ParameterIncludeImpl.class);
+    private static boolean DEBUG_ENABLED = log.isDebugEnabled();
+    private static boolean DEBUG_CALLSTACK_ON_SET = log.isDebugEnabled();
 
     private static final String myClassName = "ParameterIncludeImpl";
 
@@ -99,6 +102,9 @@
     public void addParameter(Parameter param) {
         if (param != null) {
             parameters.put(param.getName(), param);
+            if (DEBUG_ENABLED) {
+                this.debugParameterAdd(param);
+            }
         }
     }
 
@@ -277,4 +283,34 @@
         //---------------------------------------------------------
     }
 
+    /**
+     * Debug for for property key and value.
+     * @param key
+     * @param value
+     */
+    private void debugParameterAdd(Parameter parameter) {
+        if (DEBUG_ENABLED) {
+            String key = parameter.getName();
+            Object value = parameter.getValue();
+            String className = (value == null) ? "null" : value.getClass().getName();
+            String classloader = (value == null || value.getClass().getClassLoader() == null) ? "null" : 
+                value.getClass().getClassLoader().toString();
+            String valueText = (value instanceof String) ? value.toString() : null;
+            String identity = getClass().getName() + '@' + 
+                Integer.toHexString(System.identityHashCode(this));
+            
+            log.debug("==================");
+            log.debug(" Parameter add on object " + identity);
+            log.debug("  Key =" + key);
+            if (valueText != null) {
+                log.debug("  Value =" + valueText);
+            }
+            log.debug("  Value Class = " + className);
+            log.debug("  Value Classloader = " + classloader);
+            if (this.DEBUG_CALLSTACK_ON_SET) {
+                log.debug(  "Call Stack = " + JavaUtils.callStackToString());
+            }
+            log.debug("==================");
+        }
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Mon Mar 10 14:33:29 2008
@@ -27,7 +27,7 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.EndpointReferenceHelper;
 import org.apache.axis2.addressing.wsdl.WSDL11ActionHelper;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.util.RESTUtil;
 import org.apache.axis2.util.LoggingControl;
@@ -365,7 +365,11 @@
             wsdlDefinitionParameter.setName(WSDLConstants.WSDL_4_J_DEFINITION);
 
             if (!(wsdl4jDefinition instanceof WSDLDefinitionWrapper)) {
-                WSDLDefinitionWrapper wrapper = new WSDLDefinitionWrapper(wsdl4jDefinition);
+                AxisConfiguration ac = axisService.getAxisConfiguration();
+                if (ac == null) {
+                    ac = this.axisConfig;
+                }
+                WSDLDefinitionWrapper wrapper = new WSDLDefinitionWrapper(wsdl4jDefinition, ac);
                 wsdlDefinitionParameter.setValue(wrapper);
             } else {
                 wsdlDefinitionParameter.setValue(wsdl4jDefinition);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java Mon Mar 10 14:33:29 2008
@@ -19,6 +19,7 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.namespace.Constants;
 import org.apache.neethi.PolicyRegistry;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -76,6 +77,8 @@
     protected AxisService axisService;
 
     protected PolicyRegistry registry;
+    
+    protected AxisConfiguration axisConfig;
 
     protected QName serviceName;
     protected boolean isServerSide = true;
@@ -294,5 +297,9 @@
         }
 
         return new String(sb);
+    }
+    
+    public void useAxisConfiguration(AxisConfiguration axisConfig) {
+        this.axisConfig = axisConfig;
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java Mon Mar 10 14:33:29 2008
@@ -515,4 +515,70 @@
         }
         return index;
     }
+    
+    /**
+     * replace: Like String.replace except that the old new items are strings.
+     *
+     * @param name string
+     * @param oldT old text to replace
+     * @param newT new text to use
+     * @return replacement string
+     */
+    public static final String replace(String name,
+                                       String oldT, String newT) {
+
+        if (name == null) return "";
+
+        // Create a string buffer that is twice initial length.
+        // This is a good starting point.
+        StringBuffer sb = new StringBuffer(name.length() * 2);
+
+        int len = oldT.length();
+        try {
+            int start = 0;
+            int i = name.indexOf(oldT, start);
+
+            while (i >= 0) {
+                sb.append(name.substring(start, i));
+                sb.append(newT);
+                start = i + len;
+                i = name.indexOf(oldT, start);
+            }
+            if (start < name.length())
+                sb.append(name.substring(start));
+        } catch (NullPointerException e) {
+            // No FFDC code needed
+        }
+
+        return new String(sb);
+    }
+    /**
+     * Get a string containing the stack of the current location.
+     * Note This utility is useful in debug scenarios to dump out 
+     * the call stack.
+     *
+     * @return String
+     */
+    public static String callStackToString() {
+        return stackToString(new RuntimeException());
+    }
+
+    /**
+     * Get a string containing the stack of the specified exception
+     *
+     * @param e
+     * @return
+     */
+    public static String stackToString(Throwable e) {
+        java.io.StringWriter sw = new java.io.StringWriter();
+        java.io.BufferedWriter bw = new java.io.BufferedWriter(sw);
+        java.io.PrintWriter pw = new java.io.PrintWriter(bw);
+        e.printStackTrace(pw);
+        pw.close();
+        String text = sw.getBuffer().toString();
+        // Jump past the throwable
+        text = text.substring(text.indexOf("at"));
+        text = replace(text, "at ", "DEBUG_FRAME = ");
+        return text;
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java Mon Mar 10 14:33:29 2008
@@ -21,8 +21,8 @@
 
 
 import org.apache.axis2.Constants;
-import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -43,17 +43,11 @@
 import javax.wsdl.PortType;
 import javax.wsdl.Service;
 import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
-import java.io.IOException;
-import java.net.URI;
 import java.net.URL;
-import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
 
@@ -91,8 +85,6 @@
     // the optional setting used to specify which type of reduction to use
     private int reduceWSDLMemoryType = 0;
 
-
-
     // the wrapper implementation to use 
     private WSDLWrapperImpl wrapperImpl = null;
 
@@ -105,6 +97,8 @@
      * Constructor
      * 
      * @param def    The WSDL Definition
+     * @deprecated because this constructor does not provide any guidance for 
+     * memory usage
      */
     public WSDLDefinitionWrapper(Definition def) {
         if (log.isDebugEnabled() ) {
@@ -112,7 +106,24 @@
         }
         prepare(def, null);
     }
+    
+    /**
+     * @param def
+     * @param limitMemory true if you want to use a memory sensitive wrapper
+     */
+    public WSDLDefinitionWrapper(Definition def, boolean limitMemory, int memoryType) {
+        if (log.isDebugEnabled() ) {
+            log.debug("WSDLDefinitionWrapper(Definition, boolean) entry");
+        }
+        reduceWSDLMemoryCache  = limitMemory;
+        reduceWSDLMemoryType = memoryType;
+        prepare(def, null);
+    }
 
+    /**
+     * @param def WDDL Definition
+     * @param axisConfig Axis Configuration
+     */
     public WSDLDefinitionWrapper(Definition def,AxisConfiguration axisConfig ) {
         if (log.isDebugEnabled() ) {
             log.debug("WSDLDefinitionWrapper(Definition,AxisConfiguration) entry ");
@@ -126,6 +137,7 @@
      * 
      * @param def    The WSDL Definition
      * @param wURL   The URL for the wsdl
+     * @deprecated use a constructor with a AxisConfiguration or memory limit parameter
      */
     public WSDLDefinitionWrapper(Definition def, URL wURL) {
         if (log.isDebugEnabled() ) {
@@ -150,6 +162,24 @@
         }
         prepare(def, wURL);
     }
+    
+    /**
+     * Constructor
+     * 
+     * @param def    The WSDL Definition
+     * @param wURL   The URL for the wsdl
+     * @param limitInMemory  The setting indicating whether the in-memory WSDL copy
+     *                       should be manipulated to reduce memory footprint
+     * @param memoryType
+     */
+    public WSDLDefinitionWrapper(Definition def, URL wURL, boolean limitInMemory, int memoryType) {
+        reduceWSDLMemoryCache = limitInMemory;
+        this.reduceWSDLMemoryType = memoryType;
+        if (log.isDebugEnabled() ) {
+            log.debug("WSDLDefinitionWrapper(Definition,URL,boolean) entry");
+        }
+        prepare(def, wURL);
+    }
 
 
     /**
@@ -215,7 +245,12 @@
             if (log.isDebugEnabled() ) {
                 log.debug("reduceWSDLMemoryCache:"+ reduceWSDLMemoryCache + ", reduceWSDLMemoryType:" + reduceWSDLMemoryType );
             }
+        } else {
+            if (log.isDebugEnabled() ) {
+                log.debug("AxisConfiguration is null.  This is unexpected" );
+            }
         }
+        
     }
 
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java Mon Mar 10 14:33:29 2008
@@ -19,6 +19,7 @@
 
 package org.apache.axis2.wsdl.util;
 
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -39,17 +40,11 @@
 import javax.wsdl.PortType;
 import javax.wsdl.Service;
 import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
-import java.io.IOException;
-import java.net.URI;
 import java.net.URL;
-import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
 
@@ -86,6 +81,10 @@
      * @param def    The WSDL Definition
      */
     public WSDLWrapperBasicImpl(Definition def) {
+        if (log.isDebugEnabled()) {
+            log.debug("WSDLWrapperBasicImpl(Definition def) called");
+            log.debug(JavaUtils.callStackToString());
+        }
         prepare(def, null);
     }
 
@@ -97,6 +96,10 @@
      * @param wURL   The URL for the wsdl
      */
     public WSDLWrapperBasicImpl(Definition def, URL wURL) {
+        if (log.isDebugEnabled()) {
+            log.debug("WSDLWrapperBasicImpl(Definition def, URL wURL) called");
+            log.debug(JavaUtils.callStackToString());
+        }
         prepare(def, wURL);
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java Mon Mar 10 14:33:29 2008
@@ -20,6 +20,7 @@
 package org.apache.axis2.wsdl.util;
 
 import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -92,6 +93,10 @@
      * @param def    The WSDL Definition
      */
     public WSDLWrapperReloadImpl(Definition def) {
+        if (log.isDebugEnabled()) {
+            log.debug("WSDLWrapperReloadImpl(Definition def) called");
+            log.debug(JavaUtils.callStackToString());
+        }
         prepare(def, null);
     }
 
@@ -103,6 +108,10 @@
      * @param wURL   The URL for the wsdl
      */
     public WSDLWrapperReloadImpl(Definition def, URL wURL) {
+        if (log.isDebugEnabled()) {
+            log.debug("WSDLWrapperReloadImpl(Definition def, URL wURL) called");
+            log.debug(JavaUtils.callStackToString());
+        }
         prepare(def, wURL);
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperSaveImpl.java Mon Mar 10 14:33:29 2008
@@ -22,6 +22,7 @@
 
 import org.apache.axis2.Constants;
 import org.apache.axis2.util.Counter;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -126,6 +127,10 @@
      * @param def    The WSDL Definition
      */
     public WSDLWrapperSaveImpl(Definition def) {
+        if (log.isDebugEnabled()) {
+            log.debug("WSDLWrapperSaveImpl(Definition def) called");
+            log.debug(JavaUtils.callStackToString());
+        }
         prepare(def, null);
     }
 
@@ -137,6 +142,10 @@
      * @param wURL   The URL for the wsdl
      */
     public WSDLWrapperSaveImpl(Definition def, URL wURL) {
+        if (log.isDebugEnabled()) {
+            log.debug("WSDLWrapperSaveImpl(Definition def, URL wURL) called");
+            log.debug(JavaUtils.callStackToString());
+        }
         prepare(def, wURL);
     }
 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Mon Mar 10 14:33:29 2008
@@ -608,7 +608,15 @@
                 def = wsdlWrapper.getDefinition();
             } else {
                 try {
-                    wsdlWrapper = new WSDL4JWrapper(wsdlDef);
+                    if (myConfigContext != null) {
+                        // Construct WSDL4JWrapper with configuration information
+                        wsdlWrapper = new WSDL4JWrapper(wsdlDef, 
+                                                        myConfigContext);
+                    } else {
+                        // If there is no configuration, default to using a 
+                        // memory sensitive wrapper
+                        wsdlWrapper = new WSDL4JWrapper(wsdlDef, true, 2);
+                    }
                     def = wsdlWrapper.getDefinition();
                 } catch (Exception ex) {
                     // absorb
@@ -932,5 +940,9 @@
         }
 
         return wsdlDef;
+    }
+
+    public ConfigurationContext getConfigurationContext() {
+        return myConfigContext;
     }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Mon Mar 10 14:33:29 2008
@@ -48,7 +48,9 @@
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.registry.ServerConfiguratorRegistry;
 import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
+import org.apache.axis2.wsdl.util.WSDLWrapperReloadImpl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -399,7 +401,17 @@
                 if (def instanceof WSDLDefinitionWrapper) {
                     wsdlDefParameter.setValue(def);
                 } else {
-                    WSDLDefinitionWrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl);
+                    // Create WSDLDefinitionWrapper
+                    WSDLDefinitionWrapper wrap = null;
+                    ConfigurationContext cc = composite.getConfigurationContext();
+                    if (cc != null && cc.getAxisConfiguration() != null) {
+                        wrap = new WSDLDefinitionWrapper(def, wsdlUrl, 
+                                                         cc.getAxisConfiguration());
+                    } else {
+                        // Probably shouldn't get here.  But if we do, use
+                        // a memory sensitve wsdl wrapper
+                        wrap = new WSDLDefinitionWrapper(def, wsdlUrl, true, 2);
+                    }
                     wsdlDefParameter.setValue(wrap);
                 }
 
@@ -413,7 +425,17 @@
                 if (def instanceof WSDLDefinitionWrapper) {
                     wsdlDefParameter.setValue(def);
                 } else {
-                    WSDLDefinitionWrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl);
+                    // Create WSDLDefinitionWrapper
+                    WSDLDefinitionWrapper wrap = null;
+                    ConfigurationContext cc = composite.getConfigurationContext();
+                    if (cc != null && cc.getAxisConfiguration() != null) {
+                        wrap = new WSDLDefinitionWrapper(def, wsdlUrl, 
+                                                         cc.getAxisConfiguration());
+                    } else {
+                        // Probably shouldn't get here.  But if we do, use
+                        // a memory sensitve wsdl wrapper
+                        wrap = new WSDLDefinitionWrapper(def, wsdlUrl, true, 2);
+                    }
                     wsdlDefParameter.setValue(wrap);
                 }
 
@@ -448,7 +470,17 @@
                 if (def instanceof WSDLDefinitionWrapper) {
                     wsdlDefParameter.setValue(def);
                 } else {
-                    WSDLDefinitionWrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl);
+                    // Create WSDLDefinitionWrapper
+                    WSDLDefinitionWrapper wrap = null;
+                    ConfigurationContext cc = composite.getConfigurationContext();
+                    if (cc != null && cc.getAxisConfiguration() != null) {
+                        wrap = new WSDLDefinitionWrapper(def, wsdlUrl, 
+                                                         cc.getAxisConfiguration());
+                    } else {
+                        // Probably shouldn't get here.  But if we do, use
+                        // a memory sensitve wsdl wrapper
+                        wrap = new WSDLDefinitionWrapper(def, wsdlUrl, true, 2);
+                    }
                     wsdlDefParameter.setValue(wrap);
                 }
             }
@@ -880,7 +912,38 @@
             else
                 serviceBuilder.setServerSide(false);
 
+            // Associate the AxisConfiguration with the ServiceBuilder if it
+            // is available.  This is done so that the serviceBuilder can
+            // use the appropriate WSDL wrapper memory parameters.
+            AxisConfiguration ac = null;
+            if (composite.getConfigurationContext() != null) {
+                ac = composite.getConfigurationContext().getAxisConfiguration();
+                if (ac != null) {
+                    serviceBuilder.useAxisConfiguration(ac);
+                }
+            }
+            // Create and populate the AxisService
             axisService = serviceBuilder.populateService();
+            
+            // If an AxisConfiguration was not available,
+            // default to using a memory efficient wrapper
+            if (ac == null) {
+                Parameter wsdlWrapperParam = 
+                    axisService.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
+                if (wsdlWrapperParam != null &&
+                    wsdlWrapperParam.getValue() instanceof WSDLDefinitionWrapper) {
+                    
+                    WSDLDefinitionWrapper wrapper = 
+                        (WSDLDefinitionWrapper)  wsdlWrapperParam.getValue();
+                    
+                    Definition wsdlDef = wrapper.getUnwrappedDefinition();
+                    
+                    WSDLDefinitionWrapper wrapper2 = 
+                            new WSDLDefinitionWrapper(wsdlDef, true, 2);
+                    
+                    wsdlWrapperParam.setValue(wrapper2);
+                }
+            }
             axisService.setName(createAxisServiceName());
             isBuiltFromWSDL = true;
 
@@ -1797,7 +1860,13 @@
                     Definition wsdlDef = wsdlComposite.getRootWsdlDefinition();
 
                     try {
-                        WSDL4JWrapper wsdl4jWrapper = new WSDL4JWrapper(dbc.getWsdlURL(), wsdlDef);
+                        ConfigurationContext cc = dbc.getConfigurationContext();
+                        WSDL4JWrapper wsdl4jWrapper = null;
+                        if (cc != null) {
+                            wsdl4jWrapper = new WSDL4JWrapper(dbc.getWsdlURL(), wsdlDef, cc);
+                        } else {
+                            wsdl4jWrapper = new WSDL4JWrapper(dbc.getWsdlURL(), wsdlDef, true, 2);
+                        }
                         getServiceDescriptionImpl().setGeneratedWsdlWrapper(wsdl4jWrapper);
                     } catch (Exception e) {
                         throw ExceptionFactory.makeWebServiceException(Messages.getMessage("generateWSDLErr"),e);

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Mon Mar 10 14:33:29 2008
@@ -2006,7 +2006,7 @@
                 try {
                     File file = new File(wsdlLocation);
                     URL url = file.toURL();
-                    wsdl4j = new WSDL4JWrapper(url);
+                    wsdl4j = new WSDL4JWrapper(url, true, 2);  // In this context, limit the wsdl memory
                     def = wsdl4j.getDefinition();
                 } catch (Throwable t) {
                     if (log.isDebugEnabled()) {

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Mon Mar 10 14:33:29 2008
@@ -868,9 +868,17 @@
                             log.debug("new WSDL4JWrapper-ConfigContext null5");
                         }
                     }
-		    URL url = getWSDLURL(wsdlLocation);
-			this.wsdlWrapper = new WSDL4JWrapper(url, this.catalogManager);
-			composite.setWsdlDefinition(wsdlWrapper.getDefinition());
+
+                    URL url = getWSDLURL(wsdlLocation);
+                    ConfigurationContext cc = composite.getConfigurationContext();
+                    if (cc != null) {
+                        this.wsdlWrapper = new WSDL4JWrapper(url, cc, this.catalogManager);
+                    } else {
+                        // Probably shouldn't get here.  But if we do, use a memory sensitive
+                        // wsdl wrapper
+                        this.wsdlWrapper = new WSDL4JWrapper(url, this.catalogManager, true, 2);
+                    }
+                    composite.setWsdlDefinition(wsdlWrapper.getDefinition());
 		}
 		catch(Exception e) {
 			if(log.isDebugEnabled()) {

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java Mon Mar 10 14:33:29 2008
@@ -68,6 +68,12 @@
 import java.util.jar.JarFile;
 
 
+/**
+ * Implementation of WSDLWrapper interface which controls access
+ * to the underlying Definition (WSDLDefinitionWrapper).
+ * The WSDLDefinitionWrapper implementation uses various strategies
+ * to control its in-memory footprint.
+ */
 public class WSDL4JWrapper implements WSDLWrapper {
     private static final Log log = LogFactory.getLog(WSDL4JWrapper.class);
 
@@ -77,21 +83,66 @@
     private String wsdlExplicitURL;
     private ConfigurationContext configContext;
     private JAXWSCatalogManager catalogManager = null;
+    private boolean limitMemory = false;
+    private int memoryType = 0;
+    
    /**
     * Constructor
     *
     * @param URL   The URL for the WSDL
+    * @deprecated Use a constructor that passes in the ConfigContext, or memoryLimit parameter
     */
     public WSDL4JWrapper(URL wsdlURL) throws FileNotFoundException, UnknownHostException,
             ConnectException, IOException, WSDLException {
         super();
         this.commonPartsURLConstructor(wsdlURL, (ConfigurationContext)null);
     }
+    
+    /**
+     * @param wsdlURL
+     * @param limitMemory true if memory should be limited
+     * @throws FileNotFoundException
+     * @throws UnknownHostException
+     * @throws ConnectException
+     * @throws IOException
+     * @throws WSDLException
+     */
+    public WSDL4JWrapper(URL wsdlURL, boolean limitMemory, int memoryType) throws FileNotFoundException, UnknownHostException,
+    ConnectException, IOException, WSDLException {
+        super();
+        this.limitMemory = limitMemory;
+        this.memoryType = memoryType;
+        this.commonPartsURLConstructor(wsdlURL, (ConfigurationContext)null);
+    }
 
+    /**
+     * @param wsdlURL
+     * @param catalogManager
+     * @throws FileNotFoundException
+     * @throws UnknownHostException
+     * @throws ConnectException
+     * @throws IOException
+     * @throws WSDLException
+     * @deprecated use a constructor with a ConfigurationContext or limitMemory parameter
+     */
     public WSDL4JWrapper(URL wsdlURL, JAXWSCatalogManager catalogManager) throws FileNotFoundException, 
     UnknownHostException, ConnectException, IOException, WSDLException {
+        this(wsdlURL, catalogManager, false, 0);
+    }
+    
+    public WSDL4JWrapper(URL wsdlURL, JAXWSCatalogManager catalogManager, boolean limitMemory) throws FileNotFoundException, 
+    UnknownHostException, ConnectException, IOException, WSDLException {
+        super();
+        this.catalogManager = catalogManager;
+        this.limitMemory = limitMemory;
+        this.commonPartsURLConstructor(wsdlURL, (ConfigurationContext)null);
+    }
+    public WSDL4JWrapper(URL wsdlURL, JAXWSCatalogManager catalogManager, boolean limitMemory, int memoryType) throws FileNotFoundException, 
+    UnknownHostException, ConnectException, IOException, WSDLException {
         super();
         this.catalogManager = catalogManager;
+        this.limitMemory = limitMemory;
+        this.memoryType = memoryType;
         this.commonPartsURLConstructor(wsdlURL, (ConfigurationContext)null);
     }
         
@@ -375,10 +426,34 @@
     *
     * @param URL   The URL for the WSDL
     * @param Definition   Definition for the WSDL
+    * @deprecated Use a constructor that has a ConfigContext or memoryLimit parameter
     */
     public WSDL4JWrapper(URL wsdlURL, Definition wsdlDefinition) throws WSDLException {
         this(wsdlURL, wsdlDefinition, null, null);
     }
+    
+    /**
+     * Constructor
+     *
+     * @param URL   The URL for the WSDL
+     * @param Definition   Definition for the WSDL
+     * @param ConfigurationContext
+     */
+     public WSDL4JWrapper(URL wsdlURL, Definition wsdlDefinition, 
+                          ConfigurationContext configContext) throws WSDLException {
+         this(wsdlURL, wsdlDefinition, configContext, null);
+     }
+     
+     /**
+      * Constructor
+      *
+      * @param URL   The URL for the WSDL
+      * @param Definition   Definition for the WSDL
+      * @param limitMemory boolean
+      */
+      public WSDL4JWrapper(URL wsdlURL, Definition wsdlDefinition, boolean limitMemory, int memoryType) throws WSDLException {
+          this(wsdlURL, wsdlDefinition, null, null, limitMemory, memoryType);
+      }
 
     /**
      * Constructor
@@ -387,8 +462,22 @@
      * @param Definition   Definition for the WSDL
      * @param JAXWSCatalogManager Catalog Manager to use for locating external resources
      */
+    public WSDL4JWrapper(URL wsdlURL, Definition wsdlDefinition, 
+                         JAXWSCatalogManager catalogManager, 
+                         boolean limitMemory, int memoryType) throws WSDLException {
+        this(wsdlURL, wsdlDefinition, null, catalogManager, limitMemory, memoryType);
+    }
+    
+    /**
+     * Constructor
+     *
+     * @param URL   The URL for the WSDL
+     * @param Definition   Definition for the WSDL
+     * @param JAXWSCatalogManager Catalog Manager to use for locating external resources
+     * @deprecated Use a constructor with a ConfigurationContext or memory limit setting
+     */
     public WSDL4JWrapper(URL wsdlURL, Definition wsdlDefinition, JAXWSCatalogManager catalogManager) throws WSDLException {
-        this(wsdlURL, wsdlDefinition, null, catalogManager);
+        this(wsdlURL, wsdlDefinition, null, catalogManager, false, 0);
     }
     
     /**
@@ -401,49 +490,102 @@
     */
     public WSDL4JWrapper(URL wsdlURL, Definition wsdlDefinition, ConfigurationContext configContext,
             JAXWSCatalogManager catalogManager) throws WSDLException {
-        super();
-        if (log.isDebugEnabled() ) { log.debug("WSDL4JWrapper(URL,Definition,ConfigContext) entry"); }
-
-        this.configContext = configContext;
-        this.catalogManager = catalogManager;
-        this.wsdlURL = wsdlURL;
-        if ((wsdlDefinition != null) && !(wsdlDefinition instanceof WSDLDefinitionWrapper)) {
-        if (configContext != null) {
-                this.wsdlDefinition = new WSDLDefinitionWrapper(wsdlDefinition, wsdlURL, configContext.getAxisConfiguration() );
-            } else {
-                this.wsdlDefinition = new WSDLDefinitionWrapper(wsdlDefinition, wsdlURL);
-            }
-        } else {
-            this.wsdlDefinition = (WSDLDefinitionWrapper) wsdlDefinition;
-        }
+        this(wsdlURL, wsdlDefinition, configContext, catalogManager, false, 0);
     }
+    
+    /**
+     * Full Constructor
+     */
+     private WSDL4JWrapper(URL wsdlURL, Definition wsdlDefinition, ConfigurationContext configContext,
+             JAXWSCatalogManager catalogManager, boolean limitMemory, int memoryType) throws WSDLException {
+         super();
+         if (log.isDebugEnabled() ) { log.debug("WSDL4JWrapper(...) entry"); }
+
+         this.configContext = configContext;
+         this.catalogManager = catalogManager;
+         this.wsdlURL = wsdlURL;
+         this.limitMemory = limitMemory;  // Only used if configContext is not present
+         this.memoryType = memoryType;
+         if ((wsdlDefinition != null) && !(wsdlDefinition instanceof WSDLDefinitionWrapper)) {
+             if (configContext != null && configContext.getAxisConfiguration() != null) {
+                 this.wsdlDefinition = 
+                     new WSDLDefinitionWrapper(wsdlDefinition, wsdlURL, 
+                                               configContext.getAxisConfiguration() );
+             } else {
+                 this.wsdlDefinition = 
+                     new WSDLDefinitionWrapper(wsdlDefinition, wsdlURL, 
+                                               limitMemory, 2);
+             }
+         } else {
+             this.wsdlDefinition = (WSDLDefinitionWrapper) wsdlDefinition;
+         }
+     }
 
 
    /**
     * Constructor
     *
     * @param Definition   Definition for the WSDL
+    * @deprecated Use WSDL4JWrapper(Definition,ConfigurationContext)
     */
     public WSDL4JWrapper(Definition wsdlDefinition) throws WSDLException {
-        super();
-        if (log.isDebugEnabled() ) { log.debug("WSDL4JWrapper(Definition) entry"); }
-
-        if ((wsdlDefinition != null) && !(wsdlDefinition instanceof WSDLDefinitionWrapper)) {
-            this.wsdlDefinition = new WSDLDefinitionWrapper(wsdlDefinition);
-        } else {
-            this.wsdlDefinition = (WSDLDefinitionWrapper) wsdlDefinition;
-        }
-
-        if (this.wsdlDefinition != null) {
-            String baseURI = wsdlDefinition.getDocumentBaseURI();
-            try {
-                wsdlURL = new URL(baseURI);
-            } catch (Exception ex) {
-                // just absorb the error
-            }
-        }
+        this(wsdlDefinition, false, 0);
+        
     }
+    
+    /**
+     * Constructor
+     *
+     * @param Definition   Definition for the WSDL
+     * @boolean limitMemory
+     */
+     public WSDL4JWrapper(Definition wsdlDefinition, boolean limitMemory, int memoryType) throws WSDLException {
+         if (log.isDebugEnabled() ) { log.debug("WSDL4JWrapper(Definition, boolean) entry"); }
+
+         this.limitMemory = limitMemory;
+         this.memoryType = memoryType;
+         if ((wsdlDefinition != null) && !(wsdlDefinition instanceof WSDLDefinitionWrapper)) {
+             this.wsdlDefinition = new WSDLDefinitionWrapper(wsdlDefinition, null, limitMemory, memoryType);
+         } else {
+             this.wsdlDefinition = (WSDLDefinitionWrapper) wsdlDefinition;
+         }
+
+         if (this.wsdlDefinition != null) {
+             String baseURI = wsdlDefinition.getDocumentBaseURI();
+             try {
+                 wsdlURL = new URL(baseURI);
+             } catch (Exception ex) {
+                 // just absorb the error
+             }
+         }
+     }
 
+    /**
+     * Constructor
+     *
+     * @param Definition   Definition for the WSDL
+     * @param ConfigurationContext
+     */
+     public WSDL4JWrapper(Definition wsdlDefinition, 
+                          ConfigurationContext configContext) throws WSDLException {
+         super();
+         if (log.isDebugEnabled() ) { log.debug("WSDL4JWrapper(Definition) entry"); }
+
+         if ((wsdlDefinition != null) && !(wsdlDefinition instanceof WSDLDefinitionWrapper)) {
+             this.wsdlDefinition = new WSDLDefinitionWrapper(wsdlDefinition, configContext.getAxisConfiguration());
+         } else {
+             this.wsdlDefinition = (WSDLDefinitionWrapper) wsdlDefinition;
+         }
+
+         if (this.wsdlDefinition != null) {
+             String baseURI = wsdlDefinition.getDocumentBaseURI();
+             try {
+                 wsdlURL = new URL(baseURI);
+             } catch (Exception ex) {
+                 // just absorb the error
+             }
+         }
+     }
     //TODO: Perform validations for each method to check for null parameters on QName.
 
     /*
@@ -453,10 +595,10 @@
         if (wsdlDefinition == null) {
             Definition def = loadDefinition();
             if (def != null) {
-            if (configContext != null) {
+                if (configContext != null) {
                     wsdlDefinition = new WSDLDefinitionWrapper(def, configContext.getAxisConfiguration() );
                 } else {
-                    wsdlDefinition = new WSDLDefinitionWrapper(def, (AxisConfiguration)null);
+                    wsdlDefinition = new WSDLDefinitionWrapper(def, wsdlURL, limitMemory, memoryType);
                 }
             }
         }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDLWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDLWrapper.java?rev=635703&r1=635702&r2=635703&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDLWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDLWrapper.java Mon Mar 10 14:33:29 2008
@@ -24,6 +24,10 @@
 import java.net.URL;
 import java.util.ArrayList;
 
+/**
+ * Defines WSDL Access methods
+ *
+ */
 public interface WSDLWrapper {
     public static final QName POLICY = new QName(Constants.POLICY, "Policy");
     public static final QName POLICY_REFERENCE =



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message