Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 35172 invoked from network); 12 Oct 2007 21:59:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Oct 2007 21:59:12 -0000 Received: (qmail 44480 invoked by uid 500); 12 Oct 2007 20:12:19 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 44347 invoked by uid 500); 12 Oct 2007 20:12:18 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 44336 invoked by uid 500); 12 Oct 2007 20:12:18 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 44333 invoked by uid 99); 12 Oct 2007 20:12:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Oct 2007 13:12:18 -0700 X-ASF-Spam-Status: No, hits=-99.3 required=10.0 tests=ALL_TRUSTED,FRT_LEVITRA X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Oct 2007 20:12:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5E09A1A9832; Fri, 12 Oct 2007 13:12:00 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r584248 [1/4] - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/ kernel/conf/ kernel/src/org/apache/axis2/ kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/deployment/repository/util/ k... Date: Fri, 12 Oct 2007 19:55:02 -0000 To: axis2-cvs@ws.apache.org From: robinsona@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071012201200.5E09A1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: robinsona Date: Fri Oct 12 12:53:43 2007 New Revision: 584248 URL: http://svn.apache.org/viewvc?rev=584248&view=rev Log: axis2-2968 handle out-of-memory stemming from keeping wsdl4j's wsdl definition around Added: 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/WSDLWrapperImpl.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/kernel/test-resources/deployment/axis2_a.xml webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.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/Counter.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/util/WSDL4JWrapper.java webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/WSDLWrapper.java webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=584248&r1=584247&r2=584248&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Fri Oct 12 12:53:43 2007 @@ -46,6 +46,9 @@ import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; @@ -293,7 +296,15 @@ Document doc; try { doc = XMLUtils.newDocument(uri); - return reader.readWSDL(getBaseURI(uri), doc); + + // Set the URI of the base document for the Definition. + // This identifies the origin of the Definition + // Note that this is the URI of the base document, not the imports. + Definition def = reader.readWSDL(getBaseURI(uri), doc); + def.setDocumentBaseURI(getURI(uri)); + + return def; + } catch (ParserConfigurationException e) { throw new WSDLException(WSDLException.PARSER_ERROR, "Parser Configuration Error", @@ -350,5 +361,17 @@ } String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/")); return uriFragment + (uriFragment.endsWith("/") ? "" : "/"); + } + + /** + * calculates the URI + * needs improvement + * + * @param currentURI + */ + private String getURI(String currentURI) throws URISyntaxException, IOException { + + File file = new File(currentURI); + return file.getCanonicalFile().toURI().toString(); } } Modified: webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml?rev=584248&r1=584247&r2=584248&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml (original) +++ webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml Fri Oct 12 12:53:43 2007 @@ -31,6 +31,12 @@ 4000 + + + + + + 30000 Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=584248&r1=584247&r2=584248&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Fri Oct 12 12:53:43 2007 @@ -268,6 +268,9 @@ public static final String MM7_PART_CID = "MM7PartCID"; + public static final String REDUCE_WSDL_MEMORY_CACHE = "reduceWSDLMemoryCache"; + public static final String REDUCE_WSDL_MEMORY_TYPE = "reduceWSDLMemoryType"; + public static final String HTTP_METHOD_GET = "GET"; public static final String HTTP_METHOD_DELETE = "DELETE"; public static final String HTTP_METHOD_PUT = "PUT"; Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=584248&r1=584247&r2=584248&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Fri Oct 12 12:53:43 2007 @@ -338,10 +338,12 @@ String wsdlLocation = "META-INF/service.wsdl"; InputStream wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation); + URL wsdlURL = serviceClassLoader.getResource(metainf + "/service.wsdl"); if (wsdlStream == null) { wsdlLocation = "META-INF/" + serviceName + ".wsdl"; wsdlStream = serviceClassLoader .getResourceAsStream(wsdlLocation); + wsdlURL = serviceClassLoader.getResource(wsdlLocation); } if (wsdlStream != null) { WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder = @@ -353,6 +355,9 @@ wsdl2AxisServiceBuilder.setCustomResolver( new AARFileBasedURIResolver(file)); } + if (wsdlURL != null) { + wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString()); + } axisService = wsdl2AxisServiceBuilder.populateService(); axisService.setWsdlFound(true); axisService.setCustomWsdl(true); @@ -381,10 +386,13 @@ String wsdlLocation = "META-INF/service.wsdl"; InputStream wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation); + URL wsdlURL = serviceClassLoader.getResource(wsdlLocation); if (wsdlStream == null) { wsdlLocation = "META-INF/" + serviceName + ".wsdl"; wsdlStream = serviceClassLoader .getResourceAsStream(wsdlLocation); + wsdlURL = + serviceClassLoader.getResource(wsdlLocation); } if (wsdlStream != null) { WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder = @@ -395,6 +403,9 @@ new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream)); wsdl2AxisServiceBuilder.setCustomResolver( new AARFileBasedURIResolver(file)); + } + if (wsdlURL != null) { + wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString()); } axisService = wsdl2AxisServiceBuilder.populateService(); axisService.setWsdlFound(true); Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=584248&r1=584247&r2=584248&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Fri Oct 12 12:53:43 2007 @@ -35,7 +35,15 @@ import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver; import org.apache.axis2.deployment.resolver.WarBasedWSDLLocator; import org.apache.axis2.deployment.resolver.WarFileBasedURIResolver; -import org.apache.axis2.description.*; +import org.apache.axis2.description.AxisModule; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.AxisServiceGroup; +import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.description.WSDL2Constants; +import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder; +import org.apache.axis2.description.WSDL20ToAxisServiceBuilder; +import org.apache.axis2.description.WSDLToAxisServiceBuilder; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.axis2.namespace.Constants; @@ -52,6 +60,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -212,8 +222,12 @@ new AARFileBasedURIResolver(serviceArchiveFile)); if (axisServiceBuilder instanceof WSDL11ToAllAxisServicesBuilder) { - ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).setCustomWSLD4JResolver( + ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).setCustomWSDLResolver( new AARBasedWSDLLocator(baseURI, serviceArchiveFile, in)); + + ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).setDocumentBaseUri( + serviceArchiveFile.getCanonicalFile().toURI().toString()); + } else if (axisServiceBuilder instanceof WSDL20ToAllAxisServicesBuilder) { // trying to use the jar scheme as the base URI. I think this can be used to handle // wsdl 1.1 as well without using a custom URI resolver. Need to look at it later. @@ -224,6 +238,11 @@ if (serviceArchiveFile != null) { axisServiceBuilder.setBaseUri( serviceArchiveFile.getParentFile().toURI().toString()); + + if (axisServiceBuilder instanceof WSDL11ToAllAxisServicesBuilder) { + ((WSDL11ToAllAxisServicesBuilder) axisServiceBuilder).setDocumentBaseUri( + serviceArchiveFile.getCanonicalFile().toURI().toString()); + } } } if (axisServiceBuilder instanceof WSDL11ToAllAxisServicesBuilder) { @@ -236,6 +255,11 @@ if (log.isDebugEnabled()) { log.debug(axisFault); } + } catch (IOException ioex) { + log.info("Trouble processing wsdl file :" + ioex.getMessage()); + if (log.isDebugEnabled()) { + log.debug(ioex); + } } return null; } @@ -326,6 +350,7 @@ equals(documentElementNS.getNamespaceURI())) { wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder( new ByteArrayInputStream(out.toByteArray())); + ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setDocumentBaseUri(entryName); } else { throw new DeploymentException(Messages.getMessage("invalidWSDLFound")); } @@ -384,7 +409,7 @@ equals(documentElementNS.getNamespaceURI())) { wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder( new ByteArrayInputStream(out.toByteArray())); - wsdlToAxisServiceBuilder.setCustomWSLD4JResolver(new WarBasedWSDLLocator(wsdlUrl, + wsdlToAxisServiceBuilder.setCustomWSDLResolver(new WarBasedWSDLLocator(wsdlUrl, loader, new ByteArrayInputStream( out.toByteArray()))); @@ -423,6 +448,8 @@ equals(documentElementNS.getNamespaceURI())) { in2 = new FileInputStream(file1); wsdlToAxisServiceBuilder = new WSDL11ToAllAxisServicesBuilder(in2); + ((WSDL11ToAxisServiceBuilder) wsdlToAxisServiceBuilder).setDocumentBaseUri(file1.toURI() + .toString()); } else { throw new DeploymentException(Messages.getMessage("invalidWSDLFound")); } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=584248&r1=584247&r2=584248&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Fri Oct 12 12:53:43 2007 @@ -1626,6 +1626,9 @@ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); reader.setFeature("javax.wsdl.importDocuments", true); Definition wsdlDefinition = reader.readWSDL(getBaseURI(wsdlURL.toString()), doc); + if (wsdlDefinition != null) { + wsdlDefinition.setDocumentBaseURI(getDocumentURI(wsdlURL.toString())); + } return createClientSideAxisService(wsdlDefinition, wsdlServiceName, portName, options); } catch (IOException e) { log.error(e.getMessage(), e); @@ -1650,6 +1653,15 @@ } String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/")); return uriFragment + (uriFragment.endsWith("/") ? "" : "/"); + } catch (IOException e) { + return null; + } + } + + private static String getDocumentURI(String currentURI) { + try { + File file = new File(currentURI); + return file.getCanonicalFile().toURI().toString(); } catch (IOException e) { return null; } 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=584248&r1=584247&r2=584248&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 Fri Oct 12 12:53:43 2007 @@ -31,6 +31,7 @@ import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.wsdl.WSDLUtil; +import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.neethi.Constants; @@ -129,8 +130,9 @@ private static final String BINDING_OPERATION_OUTPUT = "Binding.Operation.Output"; protected Definition wsdl4jDefinition = null; + protected String wsdlBaseDocumentURI = null; - private WSDLLocator customWSLD4JResolver; + private WSDLLocator customWSDLResolver; public static final String RPC_STYLE = "rpc"; @@ -233,31 +235,65 @@ } /** - * sets a custem WSDL4J locator + * @deprecated + * @see setCustomWSDLResolver + */ + public void setCustomWSLD4JResolver(WSDLLocator customResolver) { + setCustomWSDLResolver(customResolver); + } + + + /** + * sets a custom WSDL locator + * + * @param customWSDLResolver + */ + public void setCustomWSDLResolver(WSDLLocator customResolver) { + this.customWSDLResolver = customResolver; + setDocumentBaseUri(this.customWSDLResolver.getBaseURI()); + } + + + /** + * Sets the URI to the base document associated with the WSDL definition. + * This identifies the origin of the Definition and allows the + * Definition to be reloaded. Note that this is the URI of the base + * document, not the imports. + * + * @param baseUri + */ + public void setDocumentBaseUri(String baseUri) { + if (wsdl4jDefinition != null) { + wsdl4jDefinition.setDocumentBaseURI(baseUri); + } + wsdlBaseDocumentURI = baseUri; + } + + /** + * Gets the URI to the base document associated with the WSDL definition. + * This identifies the origin of the Definition and allows the + * Definition to be reloaded. Note that this is the URI of the base + * document, not the imports. * - * @param customWSLD4JResolver */ - public void setCustomWSLD4JResolver(WSDLLocator customWSLD4JResolver) { - this.customWSLD4JResolver = customWSLD4JResolver; + public String getDocumentBaseUri() { + return wsdlBaseDocumentURI; } + + + /** - * populates a given service This is the only publicly accessible method in - * this class + * Populates a given service. * * @throws AxisFault */ public AxisService populateService() throws AxisFault { try { setup(); - // Setting wsdl4jdefintion to axisService , so if some one want - // to play with it he can do that by getting the parameter - Parameter wsdlDefinitionParameter = new Parameter(); - wsdlDefinitionParameter.setName(WSDLConstants.WSDL_4_J_DEFINITION); - wsdlDefinitionParameter.setValue(wsdl4jDefinition); - axisService.addParameter(wsdlDefinitionParameter); - axisService.setWsdlFound(true); - axisService.setCustomWsdl(true); + + // NOTE: set the axisService with the Parameter for the WSDL + // Definition after the rest of the work if (wsdl4jDefinition == null) { return null; @@ -309,6 +345,26 @@ populateEndpoints(binding, wsdl4jService, portType); processPoliciesInDefintion(wsdl4jDefinition); axisService.getPolicyInclude().setPolicyRegistry(registry); + + + // Setting wsdl4jdefintion to the axisService parameter include list, + // so if someone needs to use the definition directly, + // he can do that by getting the parameter + Parameter wsdlDefinitionParameter = new Parameter(); + wsdlDefinitionParameter.setName(WSDLConstants.WSDL_4_J_DEFINITION); + + if (!(wsdl4jDefinition instanceof WSDLDefinitionWrapper)) { + WSDLDefinitionWrapper wrapper = new WSDLDefinitionWrapper(wsdl4jDefinition); + wsdlDefinitionParameter.setValue(wrapper); + } else { + wsdlDefinitionParameter.setValue(wsdl4jDefinition); + } + + axisService.addParameter(wsdlDefinitionParameter); + axisService.setWsdlFound(true); + axisService.setCustomWsdl(true); + + return axisService; } catch (WSDLException e) { @@ -2071,9 +2127,13 @@ // switch off the verbose mode for all usecases reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false); + Definition def; // if the custem resolver is present then use it - if (customWSLD4JResolver != null) { - return reader.readWSDL(customWSLD4JResolver); + if (customWSDLResolver != null) { + // make sure the wsdl definition has the URI for the base document set + def = reader.readWSDL(customWSDLResolver); + def.setDocumentBaseURI(customWSDLResolver.getBaseURI()); + return def; } else { Document doc; try { @@ -2089,7 +2149,9 @@ throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); } - return reader.readWSDL(getBaseUri(), doc); + def = reader.readWSDL(getBaseUri(), doc); + def.setDocumentBaseURI(getDocumentBaseUri()); + return def; } } 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=584248&r1=584247&r2=584248&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 Fri Oct 12 12:53:43 2007 @@ -194,10 +194,24 @@ return "ns" + nsCount++; } + /** + * Gets the URI associated with the base document + * for the WSDL definition. Note that this URI + * is for the base document, not the imports. + * + * @return The URI as a String + */ public String getBaseUri() { return baseUri; } + /** + * Sets the URI associated with the base document + * for the WSDL definition. Note that this URI + * is for the base document, not the imports. + * + * @param baseUri The URI as a String + */ public void setBaseUri(String baseUri) { this.baseUri = baseUri; } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Counter.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Counter.java?rev=584248&r1=584247&r2=584248&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Counter.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Counter.java Fri Oct 12 12:53:43 2007 @@ -22,12 +22,32 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -// Counter uses java.util.concurrent.atomic.AtomicLong if present, -// else falls back to the backport version +/** + * This class provides a simple zero-based counter with synchronized access. + */ public class Counter { + private long value = 0L; public synchronized long incrementAndGet() { return ++value; } + + public synchronized long decrementAndGet() { + if (value > 0L) { + return --value; + } + else { + return value; + } + } + + public synchronized void reset() { + value = 0L; + } + + public synchronized long get() { + return value; + } + } Added: 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=584248&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java (added) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLDefinitionWrapper.java Fri Oct 12 12:53:43 2007 @@ -0,0 +1,508 @@ +/* + * 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.wsdl.util; + + +import org.apache.axis2.Constants; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.description.Parameter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.wsdl.Binding; +import javax.wsdl.BindingFault; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.BindingOutput; +import javax.wsdl.Definition; +import javax.wsdl.Fault; +import javax.wsdl.Import; +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.Output; +import javax.wsdl.Part; +import javax.wsdl.Port; +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; + + +/** + * There are cases where a WSDL definition is kept in memory + * in case it needs to be accessed during runtime. In situations where + * there are lots of WSDL definitions or big WSDLs, the memory footprint can be + * huge. + * + * This class provides support for processing a WSDL4J definition + * with a lower memory footprint. This is useful for certain + * environments. + * + * This class makes the decision on which implementation to use + * to reduce memory footprint. This allows other implementations + * to be used for specific environments without adding lots of extra + * overhead to every environment. + * + */ +public class WSDLDefinitionWrapper implements Definition { + + private static final Log log = LogFactory.getLog(WSDLDefinitionWrapper.class); + private static final boolean isDebugEnabled = log.isDebugEnabled(); + private static final String myClassName = "WSDLDefinitionWrapper"; + + // javax.wsdl.Definition implements java.io.Serializable + static final long serialVersionUID = -2788807375814097409L; + + + // the setting used to indicate whether the in-memory copy of the + // WSDL definition should be manipulated to reduce memory footprint + private boolean reduceWSDLMemoryCache = false; + + // 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; + + + //------------------------------------------------------------------------- + // constructors + //------------------------------------------------------------------------- + + /** + * Constructor + * + * @param def The WSDL Definition + */ + public WSDLDefinitionWrapper(Definition def) { + prepare(def, null); + } + + + /** + * Constructor + * + * @param def The WSDL Definition + * @param wURL The URL for the wsdl + */ + public WSDLDefinitionWrapper(Definition def, URL wURL) { + 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 + */ + public WSDLDefinitionWrapper(Definition def, URL wURL, boolean limitInMemory) { + reduceWSDLMemoryCache = limitInMemory; + prepare(def, wURL); + } + + + /** + * Constructor + * + * @param def The WSDL Definition + * @param wURL The URL for the wsdl + * @param limitType The setting indicating which reduction technique + * to use + */ + public WSDLDefinitionWrapper(Definition def, URL wURL, int limitType) { + reduceWSDLMemoryCache = true; + reduceWSDLMemoryType = limitType; + prepare(def, wURL); + } + + + /** + * Constructor + * + * @param def The WSDL Definition + * @param wURL The URL for the wsdl + * @param axisCfg The AxisConfiguration object, to be used to get configuration settings + */ + public WSDLDefinitionWrapper(Definition def, URL wURL, AxisConfiguration axisCfg) { + + // determine what the setting for the memory optimization is + Parameter param = axisCfg.getParameter(Constants.Configuration.REDUCE_WSDL_MEMORY_CACHE); + + reduceWSDLMemoryCache = + param != null && ((String) param.getValue()).equalsIgnoreCase("true"); + + + param = axisCfg.getParameter(Constants.Configuration.REDUCE_WSDL_MEMORY_TYPE); + + if (param != null) { + String value = (String) param.getValue(); + + if (value != null) { + Integer i = new Integer(value); + reduceWSDLMemoryType = i.intValue(); + } + } + + prepare(def, wURL); + } + + + + /** + * Initialize the wsdl definition wrapper + * + * @param def The WSDL4J definition + * @param wURL The URL where the WSDL is obtained + */ + private void prepare(Definition def, URL wURL) { + + if (reduceWSDLMemoryCache) { + + // if the type is specified, then use it + // otherwise, default to the serialization technique + + if (reduceWSDLMemoryType == 2) { + // a wrapper implementation that uses release & reload on the + // underlying WSDL4J object + // this would be desirable for those environments where + // many of the WSDL definitions are not serializable + wrapperImpl = new WSDLWrapperReloadImpl(def, wURL); + } + else { + // a wrapper implementation that uses serialization to save the + // underlying WSDL4J object + wrapperImpl = new WSDLWrapperSaveImpl(def, wURL); + } + } + else { + // a wrapper implementation that is just a passthrough to the + // underlying WSDL4J object + wrapperImpl = new WSDLWrapperBasicImpl(def, wURL); + } + + wrapperImpl.releaseResources(); + } + + + //------------------------------------------------------------------------- + // public WSDLDefinitionWrapper methods + //------------------------------------------------------------------------- + + /* + * Returns the WSDL4J Definition object that is being wrapped + */ + public Definition getUnwrappedDefinition() { + + return wrapperImpl.getUnwrappedDefinition(); + } + + + //------------------------------------------------------------------------- + // javax.wsdl.Defintion interface methods + //------------------------------------------------------------------------- + + public void setDocumentBaseURI(String d) { + // Set the URI of the base document for the Definition. + // This identifies the origin of the Definition. + // Note that this is the URI of the base document, not the imports. + + wrapperImpl.setDocumentBaseURI(d); + } + + public String getDocumentBaseURI() { + // Get the URI of the base document for the Definition. + // This identifies the origin of the Definition. + // Note that this is the URI of the base document, not the imports. + + return wrapperImpl.getDocumentBaseURI(); + } + + public void setQName(QName n) { + wrapperImpl.setQName(n); + } + + public QName getQName() { + return wrapperImpl.getQName(); + } + + public void setTargetNamespace(String t) { + wrapperImpl.setTargetNamespace(t); + } + + public String getTargetNamespace() { + return wrapperImpl.getTargetNamespace(); + } + + public void addNamespace(String prefix, String namespaceURI) { + wrapperImpl.addNamespace(prefix, namespaceURI); + } + + public String removeNamespace(String prefix) { + return wrapperImpl.removeNamespace(prefix); + } + + public String getNamespace(String prefix) { + return wrapperImpl.getNamespace(prefix); + } + + public String getPrefix(String namespaceURI) { + return wrapperImpl.getPrefix(namespaceURI); + } + + public Map getNamespaces() { + return wrapperImpl.getNamespaces(); + } + + public List getNativeAttributeNames() { + return wrapperImpl.getNativeAttributeNames(); + } + + public void setTypes(Types types) { + wrapperImpl.setTypes(types); + } + + + public Types getTypes() { + return wrapperImpl.getTypes(); + } + + public void addImport(Import importDef) { + wrapperImpl.addImport(importDef); + } + + public Import removeImport(Import importDef) { + return wrapperImpl.removeImport(importDef); + } + + public List getImports(String namespaceURI) { + return wrapperImpl.getImports(namespaceURI); + } + + public Map getImports() { + return wrapperImpl.getImports(); + } + + public void addMessage(Message message) { + wrapperImpl.addMessage(message); + } + + public Message getMessage(QName name) { + return wrapperImpl.getMessage(name); + } + + public Message removeMessage(QName name) { + return wrapperImpl.removeMessage(name); + } + + public Map getMessages() { + return wrapperImpl.getMessages(); + } + + public void addBinding(Binding binding) { + wrapperImpl.addBinding(binding); + } + + public Binding getBinding(QName name) { + return wrapperImpl.getBinding(name); + } + + public Binding removeBinding(QName name) { + return wrapperImpl.removeBinding(name); + } + + public Map getBindings() { + return wrapperImpl.getBindings(); + } + + public Map getAllBindings() { + return wrapperImpl.getAllBindings(); + } + + public void addPortType(PortType portType) { + wrapperImpl.addPortType(portType); + } + + public PortType getPortType(QName name) { + return wrapperImpl.getPortType(name); + } + + public PortType removePortType(QName name) { + return wrapperImpl.removePortType(name); + } + + public Map getPortTypes() { + return wrapperImpl.getPortTypes(); + } + + public Map getAllPortTypes() { + return wrapperImpl.getAllPortTypes(); + } + + public void addService(Service service) { + wrapperImpl.addService(service); + } + + public Service getService(QName name) { + return wrapperImpl.getService(name); + } + + public Service removeService(QName name) { + return wrapperImpl.removeService(name); + } + + public Map getServices() { + return wrapperImpl.getServices(); + } + + public Map getAllServices() { + return wrapperImpl.getAllServices(); + } + + public void setDocumentationElement(org.w3c.dom.Element docEl) { + wrapperImpl.setDocumentationElement(docEl); + } + + public org.w3c.dom.Element getDocumentationElement() { + return wrapperImpl.getDocumentationElement(); + } + + public void addExtensibilityElement(ExtensibilityElement extElement) { + wrapperImpl.addExtensibilityElement(extElement); + } + + public List getExtensibilityElements() { + return wrapperImpl.getExtensibilityElements(); + } + + public Binding createBinding() { + return wrapperImpl.createBinding(); + } + + public BindingFault createBindingFault() { + return wrapperImpl.createBindingFault(); + } + + public BindingInput createBindingInput() { + return wrapperImpl.createBindingInput(); + } + + public BindingOperation createBindingOperation() { + return wrapperImpl.createBindingOperation(); + } + + public BindingOutput createBindingOutput() { + return wrapperImpl.createBindingOutput(); + } + + public Fault createFault() { + return wrapperImpl.createFault(); + } + + public Import createImport() { + return wrapperImpl.createImport(); + } + + public Input createInput() { + return wrapperImpl.createInput(); + } + + public Message createMessage() { + return wrapperImpl.createMessage(); + } + + public Operation createOperation() { + return wrapperImpl.createOperation(); + } + + public Output createOutput() { + return wrapperImpl.createOutput(); + } + + public Part createPart() { + return wrapperImpl.createPart(); + } + + public Port createPort() { + return wrapperImpl.createPort(); + } + + public PortType createPortType() { + return wrapperImpl.createPortType(); + } + + public Service createService() { + return wrapperImpl.createService(); + } + + public Types createTypes() { + return wrapperImpl.createTypes(); + } + + public void setExtensionRegistry(ExtensionRegistry extReg) { + wrapperImpl.setExtensionRegistry(extReg); + } + + public ExtensionRegistry getExtensionRegistry() { + return wrapperImpl.getExtensionRegistry(); + } + + public String toString() { + return wrapperImpl.toString(); + } + + //------------------------------------------------------------------------- + // other AbstractWSDLElement methods + //------------------------------------------------------------------------- + + public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement) { + return wrapperImpl.removeExtensibilityElement(extElement); + } + + public java.lang.Object getExtensionAttribute(QName name) { + return wrapperImpl.getExtensionAttribute(name); + } + + public Map getExtensionAttributes() { + return wrapperImpl.getExtensionAttributes(); + } + + public void setExtensionAttribute(QName name, java.lang.Object value) { + wrapperImpl.setExtensionAttribute(name, value); + } + +} Added: 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=584248&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java (added) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperBasicImpl.java Fri Oct 12 12:53:43 2007 @@ -0,0 +1,841 @@ +/* + * 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.wsdl.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.wsdl.Binding; +import javax.wsdl.BindingFault; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.BindingOutput; +import javax.wsdl.Definition; +import javax.wsdl.Fault; +import javax.wsdl.Import; +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.Output; +import javax.wsdl.Part; +import javax.wsdl.Port; +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; + + +/** + * This class provides support for processing a WSDL4J definition + * with a lower memory footprint. This is useful for certain + * environments. + */ +public class WSDLWrapperBasicImpl implements WSDLWrapperImpl { + + private static final Log log = LogFactory.getLog(WSDLWrapperBasicImpl.class); + private static final boolean isDebugEnabled = log.isDebugEnabled(); + private static final String myClassName = "WSDLWrapperBasicImpl"; + + // javax.wsdl.Definition implements java.io.Serializable + static final long serialVersionUID = -2788807375814097409L; + + // the wsdl4j wsdl definition object that is being wrapped + private Definition wsdlDefinition = null; + + // the location of the base document used in the wsdl4j definition + private URL wsdlURL = null; + private String wsdlExplicitURI = null; + private String wsdlDocumentBaseURI = null; + + //------------------------------------------------------------------------- + // constructors + //------------------------------------------------------------------------- + + /** + * Constructor + * + * @param def The WSDL Definition + */ + public WSDLWrapperBasicImpl(Definition def) { + prepare(def, null); + } + + + /** + * Constructor + * + * @param def The WSDL Definition + * @param wURL The URL for the wsdl + */ + public WSDLWrapperBasicImpl(Definition def, URL wURL) { + prepare(def, wURL); + } + + + /** + * Initialize the wsdl definition wrapper + * + * @param def The WSDL4J definition + * @param wURL The URL where the WSDL is obtained + */ + private void prepare(Definition def, URL wURL) { + + wsdlDefinition = def; + wsdlURL = wURL; + } + + + //------------------------------------------------------------------------- + // public WSDLWrapperImpl methods + //------------------------------------------------------------------------- + + /* + * Releases objects to reduce memory footprint. + */ + public void releaseResources() { + // placeholder + } + + + /* + * Returns the WSDL4J Definition object that is being wrapped + */ + public Definition getUnwrappedDefinition() { + Definition def; + + if ((wsdlDefinition != null) && + (wsdlDefinition instanceof WSDLDefinitionWrapper)) { + def = ((WSDLDefinitionWrapper) wsdlDefinition).getUnwrappedDefinition(); + } else { + def = wsdlDefinition; + } + + return def; + } + + + /** + * Sets the WSDL4J Definition object that is being wrapped + * + * @param d the WSDL4J Definition object + */ + public void setDefinitionToWrap(Definition d) { + wsdlDefinition = d; + } + + + /** + * Sets the location for the WSDL4J Definition object that is being wrapped + */ + public void setWSDLLocation(String uriLocation) { + if (uriLocation != null) { + try { + wsdlURL = new URL(uriLocation); + } + catch (Exception e) { + // todo + } + } + } + + + /** + * Gets the location for the WSDL4J Definition object that is being wrapped + */ + public String getWSDLLocation() { + if (wsdlURL != null) { + return wsdlURL.toString(); + } + else { + return null; + } + } + + + /** + * Closes the use of the wrapper implementation and allows + * internal resources to be released. + */ + public void close() { + // nothing to do for this implementation + } + + + //------------------------------------------------------------------------- + // javax.wsdl.Defintion interface methods + //------------------------------------------------------------------------- + + public void setDocumentBaseURI(String d) { + + // Set the URI of the base document for the Definition. + // This identifies the origin of the Definition. + // Note that this is the URI of the base document, not the imports. + + if (isDebugEnabled) { + log.debug(myClassName + ".setDocumentBaseURI(" + d + ")"); + } + + if (wsdlDefinition != null) { + wsdlDefinition.setDocumentBaseURI(d); + } + } + + public String getDocumentBaseURI() { + + // Get the URI of the base document for the Definition. + // This identifies the origin of the Definition. + // Note that this is the URI of the base document, not the imports. + + if (isDebugEnabled) { + log.debug(myClassName + ".getDocumentBaseURI()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getDocumentBaseURI(); + } + return null; + } + + public void setQName(QName n) { + if (isDebugEnabled) { + log.debug(myClassName + ".setQName(" + n + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.setQName(n); + } + } + + public QName getQName() { + if (isDebugEnabled) { + log.debug(myClassName + ".getQName()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getQName(); + } + return null; + } + + public void setTargetNamespace(String t) { + if (isDebugEnabled) { + log.debug(myClassName + ".setTargetNamespace(" + t + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.setTargetNamespace(t); + } + } + + public String getTargetNamespace() { + if (isDebugEnabled) { + log.debug(myClassName + ".getTargetNamespace()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getTargetNamespace(); + } + return null; + } + + public void addNamespace(String prefix, String namespaceURI) { + if (isDebugEnabled) { + log.debug(myClassName + ".addNamespace(" + prefix + ", " + namespaceURI + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.addNamespace(prefix, namespaceURI); + } + } + + public String removeNamespace(String prefix) { + if (isDebugEnabled) { + log.debug(myClassName + ".removeNamespace(" + prefix + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.removeNamespace(prefix); + } + return null; + } + + public String getNamespace(String prefix) { + if (isDebugEnabled) { + log.debug(myClassName + ".getNamespace(" + prefix + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getNamespace(prefix); + } + return null; + } + + public String getPrefix(String namespaceURI) { + if (isDebugEnabled) { + log.debug(myClassName + ".getPrefix(" + namespaceURI + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getPrefix(namespaceURI); + } + return null; + } + + public Map getNamespaces() { + if (isDebugEnabled) { + log.debug(myClassName + ".getNamespaces()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getNamespaces(); + } + return null; + } + + public List getNativeAttributeNames() { + if (isDebugEnabled) { + log.debug(myClassName + ".getNativeAttributeNames()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getNativeAttributeNames(); + } + return null; + } + + public void setTypes(Types types) { + if (isDebugEnabled) { + log.debug(myClassName + ".setTypes()"); + } + if (wsdlDefinition != null) { + wsdlDefinition.setTypes(types); + } + } + + + public Types getTypes() { + if (isDebugEnabled) { + log.debug(myClassName + ".getTypes()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getTypes(); + } + return null; + } + + public void addImport(Import importDef) { + if (isDebugEnabled) { + log.debug(myClassName + ".addImport(" + importDef + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.addImport(importDef); + } + } + + public Import removeImport(Import importDef) { + if (isDebugEnabled) { + log.debug(myClassName + ".removeImport(" + importDef + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.removeImport(importDef); + } + return null; + } + + public List getImports(String namespaceURI) { + if (isDebugEnabled) { + log.debug(myClassName + ".getImports(" + namespaceURI + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getImports(namespaceURI); + } + return null; + } + + public Map getImports() { + if (isDebugEnabled) { + log.debug(myClassName + ".getImports()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getImports(); + } + return null; + } + + public void addMessage(Message message) { + if (isDebugEnabled) { + log.debug(myClassName + ".addMessage(" + message + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.addMessage(message); + } + } + + public Message getMessage(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".getMessage(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getMessage(name); + } + return null; + } + + public Message removeMessage(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".removeMessage(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.removeMessage(name); + } + return null; + } + + public Map getMessages() { + if (isDebugEnabled) { + log.debug(myClassName + ".getMessages()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getMessages(); + } + return null; + } + + public void addBinding(Binding binding) { + if (isDebugEnabled) { + log.debug(myClassName + ".addBinding(" + binding + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.addBinding(binding); + } + } + + public Binding getBinding(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".getBinding(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getBinding(name); + } + return null; + } + + public Binding removeBinding(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".removeBinding(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.removeBinding(name); + } + return null; + } + + public Map getBindings() { + if (isDebugEnabled) { + log.debug(myClassName + ".getBindings()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getBindings(); + } + return null; + } + + public Map getAllBindings() { + if (isDebugEnabled) { + log.debug(myClassName + ".getAllBindings()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getAllBindings(); + } + return null; + } + + public void addPortType(PortType portType) { + if (isDebugEnabled) { + log.debug(myClassName + ".addPortType(" + portType + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.addPortType(portType); + } + } + + public PortType getPortType(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".getPortType(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getPortType(name); + } + return null; + } + + public PortType removePortType(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".removePortType(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.removePortType(name); + } + return null; + } + + public Map getPortTypes() { + if (isDebugEnabled) { + log.debug(myClassName + ".getPortTypes()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getPortTypes(); + } + return null; + } + + public Map getAllPortTypes() { + if (isDebugEnabled) { + log.debug(myClassName + ".getAllPortTypes()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getAllPortTypes(); + } + return null; + } + + public void addService(Service service) { + if (isDebugEnabled) { + log.debug(myClassName + ".addService(" + service + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.addService(service); + } + } + + public Service getService(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".getService(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getService(name); + } + return null; + } + + public Service removeService(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".removeService(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.removeService(name); + } + return null; + } + + public Map getServices() { + if (isDebugEnabled) { + log.debug(myClassName + ".getServices()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getServices(); + } + return null; + } + + public Map getAllServices() { + if (isDebugEnabled) { + log.debug(myClassName + ".getAllServices()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getAllServices(); + } + return null; + } + + public void setDocumentationElement(org.w3c.dom.Element docEl) { + + if (isDebugEnabled) { + log.debug(myClassName + ".setDocumentationElement()"); + } + if (wsdlDefinition != null) { + wsdlDefinition.setDocumentationElement(docEl); + } + } + + public org.w3c.dom.Element getDocumentationElement() { + + if (isDebugEnabled) { + log.debug(myClassName + ".getDocumentationElement()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getDocumentationElement(); + } + return null; + } + + public void addExtensibilityElement(ExtensibilityElement extElement) { + if (isDebugEnabled) { + log.debug(myClassName + ".addExtensibilityElement(" + extElement + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.addExtensibilityElement(extElement); + } + } + + public List getExtensibilityElements() { + if (isDebugEnabled) { + log.debug(myClassName + ".getExtensibilityElements()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getExtensibilityElements(); + } + return null; + } + + public Binding createBinding() { + if (isDebugEnabled) { + log.debug(myClassName + ".createBinding()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createBinding(); + } + return null; + } + + public BindingFault createBindingFault() { + if (isDebugEnabled) { + log.debug(myClassName + ".createBindingFault()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createBindingFault(); + } + return null; + } + + public BindingInput createBindingInput() { + if (isDebugEnabled) { + log.debug(myClassName + ".createBindingInput()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createBindingInput(); + } + return null; + } + + public BindingOperation createBindingOperation() { + if (isDebugEnabled) { + log.debug(myClassName + ".createBindingOperation()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createBindingOperation(); + } + return null; + } + + public BindingOutput createBindingOutput() { + if (isDebugEnabled) { + log.debug(myClassName + ".createBindingOutput()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createBindingOutput(); + } + return null; + } + + public Fault createFault() { + if (isDebugEnabled) { + log.debug(myClassName + ".createFault()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createFault(); + } + return null; + } + + public Import createImport() { + if (isDebugEnabled) { + log.debug(myClassName + ".createImport()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createImport(); + } + return null; + } + + public Input createInput() { + if (isDebugEnabled) { + log.debug(myClassName + ".createInput()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createInput(); + } + return null; + } + + public Message createMessage() { + if (isDebugEnabled) { + log.debug(myClassName + ".createMessage()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createMessage(); + } + return null; + } + + public Operation createOperation() { + if (isDebugEnabled) { + log.debug(myClassName + ".createOperation()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createOperation(); + } + return null; + } + + public Output createOutput() { + if (isDebugEnabled) { + log.debug(myClassName + ".createOutput()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createOutput(); + } + return null; + } + + public Part createPart() { + if (isDebugEnabled) { + log.debug(myClassName + ".createPart()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createPart(); + } + return null; + } + + public Port createPort() { + if (isDebugEnabled) { + log.debug(myClassName + ".createPort()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createPort(); + } + return null; + } + + public PortType createPortType() { + if (isDebugEnabled) { + log.debug(myClassName + ".createPortType()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createPortType(); + } + return null; + } + + public Service createService() { + if (isDebugEnabled) { + log.debug(myClassName + ".createService()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createService(); + } + return null; + } + + public Types createTypes() { + if (isDebugEnabled) { + log.debug(myClassName + ".createTypes()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.createTypes(); + } + return null; + } + + public void setExtensionRegistry(ExtensionRegistry extReg) { + if (isDebugEnabled) { + log.debug(myClassName + ".setExtensionRegistry(" + extReg + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.setExtensionRegistry(extReg); + } + } + + public ExtensionRegistry getExtensionRegistry() { + if (isDebugEnabled) { + log.debug(myClassName + ".getExtensionRegistry()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getExtensionRegistry(); + } + return null; + } + + public String toString() { + if (wsdlDefinition != null) { + return wsdlDefinition.toString(); + } + return ""; + } + + //------------------------------------------------------------------------- + // other AbstractWSDLElement methods + //------------------------------------------------------------------------- + + public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement) { + if (isDebugEnabled) { + log.debug(myClassName + ".removeExtensibilityElement(" + extElement + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.removeExtensibilityElement(extElement); + } + return null; + + } + + public java.lang.Object getExtensionAttribute(QName name) { + if (isDebugEnabled) { + log.debug(myClassName + ".getExtensionAttribute(" + name + ")"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getExtensionAttribute(name); + } + return null; + } + + public Map getExtensionAttributes() { + if (isDebugEnabled) { + log.debug(myClassName + ".getExtensionAttributes()"); + } + if (wsdlDefinition != null) { + return wsdlDefinition.getExtensionAttributes(); + } + return null; + } + + public void setExtensionAttribute(QName name, java.lang.Object value) { + if (isDebugEnabled) { + log.debug(myClassName + ".setExtensionAttribute(" + name + ", " + value + ")"); + } + if (wsdlDefinition != null) { + wsdlDefinition.setExtensionAttribute(name, value); + } + } + + + +} Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperImpl.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperImpl.java?rev=584248&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperImpl.java (added) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperImpl.java Fri Oct 12 12:53:43 2007 @@ -0,0 +1,72 @@ +/* + * 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.wsdl.util; + + +import javax.wsdl.Definition; + + +/** + * This interface provides support for processing a WSDL4J definition + * with a lower memory footprint. This is useful for certain + * environments. + */ +public interface WSDLWrapperImpl extends Definition { + + /** + * Returns the WSDL4J Definition object that is being wrapped + */ + public Definition getUnwrappedDefinition(); + + + /** + * Sets the WSDL4J Definition object that is being wrapped + * + * @param d the WSDL4J Definition object + */ + public void setDefinitionToWrap(Definition d); + + + /** + * Sets the location for the WSDL4J Definition object that is being wrapped + */ + public void setWSDLLocation(String uriLocation); + + + /** + * Gets the location for the WSDL4J Definition object that is being wrapped + */ + public String getWSDLLocation(); + + + /* + * Release resources associated with the WSDL4J Definition object that is + * being wrapped. + */ + public void releaseResources(); + + + /** + * Closes the use of the wrapper implementation and allows + * internal resources to be released. + */ + public void close(); + +} --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org