You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/05/26 06:23:00 UTC
svn commit: r178577 - in /webservices/axis/trunk/java/modules/wsdl:
src/org/apache/axis/wsdl/builder/ src/org/apache/axis/wsdl/builder/wsdl4j/
src/org/apache/axis/wsdl/codegen/emitter/ src/org/apache/wsdl/
src/org/apache/wsdl/impl/ test/org/apache/wsdl/
Author: chathura
Date: Wed May 25 21:22:57 2005
New Revision: 178577
URL: http://svn.apache.org/viewcvs?rev=178577&view=rev
Log:
The ExtensibilityElements added and the WOM builder was altered to handle the the Extensibility Elements. WSDLComponetFactory is added with a new entry to create a ExtensionFactory that is capable of creating the correct ExtensibilityElement given the QName.
Modified:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/Component.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLExtensibilityElement.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLTypes.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/ComponentImpl.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLExtensibilityElementImpl.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLTypesImpl.java
webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java Wed May 25 21:22:57 2005
@@ -1,6 +1,22 @@
package org.apache.axis.wsdl.builder;
-import org.apache.wsdl.*;
+import org.apache.wsdl.MessageReference;
+import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLBindingMessageReference;
+import org.apache.wsdl.WSDLBindingOperation;
+import org.apache.wsdl.WSDLDescription;
+import org.apache.wsdl.WSDLEndpoint;
+import org.apache.wsdl.WSDLExtensibilityAttribute;
+import org.apache.wsdl.WSDLFault;
+import org.apache.wsdl.WSDLFeature;
+import org.apache.wsdl.WSDLImport;
+import org.apache.wsdl.WSDLInclude;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+import org.apache.wsdl.WSDLProperty;
+import org.apache.wsdl.WSDLService;
+import org.apache.wsdl.WSDLTypes;
+import org.apache.wsdl.extensions.ExtensionFactory;
/**
* @author chathura@opensource.lk
@@ -88,17 +104,19 @@
*/
public WSDLBindingOperation createWSDLBindingOperation();
+
/**
*
- * @return A new instance of <code>WSDLExtensibilityElement</code>
+ * @return A new instance of <code>WSDLExtensibilityAttribute</code>
*/
- public WSDLExtensibilityElement createWSDLExtensibilityElement();
+ public WSDLExtensibilityAttribute createWSDLExtensibilityAttribute();
-
/**
*
- * @return A new instance of <code>WSDLExtensibilityAttribute</code>
+ * @return A new Instance of <code>ExtensionFactory</code> that
+ * is capable of creating the correct <code>ExtensibilityElement</code>
+ * given a <code>QName</code>.
*/
- public WSDLExtensibilityAttribute createWSDLExtensibilityAttribute();
+ public ExtensionFactory createExtensionFactory();
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java Wed May 25 21:22:57 2005
@@ -34,6 +34,7 @@
import javax.wsdl.Types;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
import javax.xml.namespace.QName;
import org.apache.axis.wsdl.builder.WSDLComponentFactory;
@@ -46,11 +47,12 @@
import org.apache.wsdl.WSDLDescription;
import org.apache.wsdl.WSDLEndpoint;
import org.apache.wsdl.WSDLExtensibilityAttribute;
-import org.apache.wsdl.WSDLExtensibilityElement;
import org.apache.wsdl.WSDLInterface;
import org.apache.wsdl.WSDLOperation;
import org.apache.wsdl.WSDLService;
import org.apache.wsdl.WSDLTypes;
+import org.apache.wsdl.extensions.DefaultExtensibilityElement;
+import org.apache.wsdl.extensions.ExtensionFactory;
import org.apache.wsdl.impl.WSDLProcessingException;
/**
@@ -96,20 +98,19 @@
wsdlDefinition
.setTargetNameSpace(wsdl4JDefinition.getTargetNamespace());
- //////////////////////////////////////////////////////////////////////////////
- //Order of the following itmes shouldn't be changed unless you really
- // //
- // know what you are doing. Reason being the components that are //
- // copied(pumped) towards the end depend on the components that has //
- // already being pumped. Following Lists some of the dependencies //
+ /////////////////////////////////////////////////////////////////////
+ // Order of the following items shouldn't be changed unless you //
+ // really know what you are doing. Reason being the components that //
+ // are copied(pumped) towards the end depend on the components that //
+ // has already being pumped. Following Lists some of the //
+ // dependencies. //
//1) The Binding refers to the Interface //
- //2) Thw Endpoint refers tot he Bindings //
+ //2) The Endpoint refers to the Bindings //
// .... //
- // //
- //////////////////////////////////////////////////////////////////////////////
+ // //
+ //////////////////////////////////////////////////////////////////////
- /////////////////////////(1)First pump the
- // Types//////////////////////////////
+ //////////////////(1)First Copy the Types/////////////////////////////
//Types may get changed inside the Operation pumping.
Types wsdl4jTypes = wsdl4JDefinition.getTypes();
@@ -117,48 +118,29 @@
WSDLTypes wsdlTypes = this.wsdlComponenetFactory.createTypes();
Iterator wsdl4jelmentsIterator = wsdl4jTypes
.getExtensibilityElements().iterator();
- ExtensibilityElement wsdl4jElement;
- WSDLExtensibilityElement womElement;
- UnknownExtensibilityElement temp = new UnknownExtensibilityElement();
- while (wsdl4jelmentsIterator.hasNext()) {
- wsdl4jElement = (ExtensibilityElement) wsdl4jelmentsIterator
- .next();
- womElement = this.wsdlComponenetFactory
- .createWSDLExtensibilityElement();
- if (null != wsdl4jElement.getRequired())
- womElement.setRequired(wsdl4jElement.getRequired()
- .booleanValue());
- //FIXME Find a permanent solution.
- if (wsdl4jElement.getClass().equals(temp.getClass())) {
- womElement
- .setElement(((UnknownExtensibilityElement) wsdl4jElement)
- .getElement());
- }
- wsdlTypes
- .addElement(wsdl4jElement.getElementType(), womElement);
- }
+ this.copyExtensibleElements(wsdlTypes.getExtensibilityElements(),
+ wsdlTypes);
+
this.womDefinition.setTypes(wsdlTypes);
}
- ////////////////////////(2)Pump the
- // Interfaces///////////////////////////
- //pump the Interfaces: Get the PortTypes from WSDL4J parse OM and pump
- // it to the
+ ///////////////////(2)Copy the Interfaces///////////////////////////
+ //copy the Interfaces: Get the PortTypes from WSDL4J parse OM and
+ // copy it to the
//WOM's WSDLInterface Components
Iterator portTypeIterator = wsdl4JDefinition.getPortTypes().values()
.iterator();
WSDLInterface wsdlInterface;
+ PortType portType;
while (portTypeIterator.hasNext()) {
wsdlInterface = this.wsdlComponenetFactory.createInterface();
- this.populateInterfaces(wsdlInterface, (PortType) portTypeIterator
- .next());
+ portType = (PortType) portTypeIterator.next();
+ this.populateInterfaces(wsdlInterface, portType);
wsdlDefinition.addInterface(wsdlInterface);
-
}
- //////////////////////////(3)Pump the
- // Bindings///////////////////////////////
+ //////////////////(3)Copy the Bindings///////////////////////
//pump the Bindings: Get the Bindings map from WSDL4J and create a new
// map of
//WSDLBinding elements
@@ -166,26 +148,29 @@
Iterator bindingIterator = wsdl4JDefinition.getBindings().values()
.iterator();
WSDLBinding wsdlBinding;
+ Binding wsdl4jBinding;
while (bindingIterator.hasNext()) {
wsdlBinding = this.wsdlComponenetFactory.createBinding();
- this
- .populateBindings(wsdlBinding, (Binding) bindingIterator
- .next());
+ wsdl4jBinding = (Binding) bindingIterator.next();
+ this.populateBindings(wsdlBinding, wsdl4jBinding);
+ this.copyExtensibleElements(wsdl4jBinding.getExtensibilityElements(),
+ wsdlBinding);
wsdlDefinition.addBinding(wsdlBinding);
}
- //////////////////////////(4)Pump the
- // Services///////////////////////////////
+ ///////////////////(4)Copy the Services///////////////////////////////
Iterator serviceIterator = wsdl4JDefinition.getServices().values()
.iterator();
WSDLService wsdlService;
+ Service wsdl4jService;
while (serviceIterator.hasNext()) {
wsdlService = this.wsdlComponenetFactory.createService();
- this
- .populateServices(wsdlService, (Service) serviceIterator
- .next());
+ wsdl4jService = (Service) serviceIterator.next();
+ this.populateServices(wsdlService, wsdl4jService);
+ this.copyExtensibleElements(wsdl4jService.getExtensibilityElements(),
+ wsdlService);
wsdlDefinition.addService(wsdlService);
}
@@ -204,25 +189,24 @@
//FIXME Evaluate a way of injecting features and priperties with a general
// formatted input
private void populateInterfaces(WSDLInterface wsdlInterface,
- PortType wsdl4jPortType) {
+ PortType wsdl4jPortType) {
//Copy the Attrebute information items
- //Copied with the Same QName so it will reqire no Query in Binding
- // pumping.
+ //Copied with the Same QName so it will require no Query in Binding
+ //Coping.
wsdlInterface.setName(wsdl4jPortType.getQName());
-
- Iterator wsdl4JOperationsIterator = wsdl4jPortType.getOperations()
- .iterator();
+ Iterator wsdl4JOperationsIterator =
+ wsdl4jPortType.getOperations().iterator();
WSDLOperation wsdloperation;
+ Operation wsdl4jOperation;
while (wsdl4JOperationsIterator.hasNext()) {
wsdloperation = this.wsdlComponenetFactory.createOperation();
+ wsdl4jOperation = (Operation) wsdl4JOperationsIterator.next();
this.populateOperations(wsdloperation,
- (Operation) wsdl4JOperationsIterator.next(), wsdl4jPortType
- .getQName().getNamespaceURI());
+ wsdl4jOperation,
+ wsdl4jPortType.getQName().getNamespaceURI());
wsdlInterface.setOperation(wsdloperation);
-
}
-
}
/**
@@ -232,26 +216,30 @@
//Copy attrebutes
wsdlBinding.setName(wsdl4JBinding.getQName());
QName interfaceName = wsdl4JBinding.getPortType().getQName();
- WSDLInterface wsdlInterface = this.womDefinition
- .getInterface(interfaceName);
+ WSDLInterface wsdlInterface =
+ this.womDefinition.getInterface(interfaceName);
+
//FIXME Do We need this eventually???
if (null == wsdlInterface)
throw new WSDLProcessingException(
"Interface/PortType not found for the Binding :"
- + wsdlBinding.getName());
-
+ + wsdlBinding.getName());
wsdlBinding.setBoundInterface(wsdlInterface);
-
- Iterator bindingoperationsIterator = wsdl4JBinding
- .getBindingOperations().iterator();
-
+ Iterator bindingoperationsIterator =
+ wsdl4JBinding.getBindingOperations().iterator();
WSDLBindingOperation wsdlBindingOperation;
+ BindingOperation wsdl4jBindingOperation;
while (bindingoperationsIterator.hasNext()) {
- wsdlBindingOperation = this.wsdlComponenetFactory
- .createWSDLBindingOperation();
+ wsdlBindingOperation =
+ this.wsdlComponenetFactory.createWSDLBindingOperation();
+ wsdl4jBindingOperation =
+ (BindingOperation)bindingoperationsIterator.next();
this.populateBindingOperation(wsdlBindingOperation,
- (BindingOperation) bindingoperationsIterator.next(),
- wsdl4JBinding.getQName().getNamespaceURI());
+ wsdl4jBindingOperation,
+ wsdl4JBinding.getQName().getNamespaceURI());
+ this.copyExtensibleElements(
+ wsdl4jBindingOperation.getExtensibilityElements(),
+ wsdlBindingOperation);
wsdlBinding.addBindingOperation(wsdlBindingOperation);
}
@@ -259,14 +247,19 @@
public void populateServices(WSDLService wsdlService, Service wsdl4jService) {
wsdlService.setName(wsdl4jService.getQName());
- Iterator wsdl4jportsIterator = wsdl4jService.getPorts().values()
- .iterator();
+ Iterator wsdl4jportsIterator =
+ wsdl4jService.getPorts().values().iterator();
wsdlService.setServiceInterface(this.getBoundInterface(wsdlService));
WSDLEndpoint wsdlEndpoint;
+ Port wsdl4jPort;
while (wsdl4jportsIterator.hasNext()) {
wsdlEndpoint = this.wsdlComponenetFactory.createEndpoint();
- this.populatePorts(wsdlEndpoint, (Port) wsdl4jportsIterator.next(),
- wsdl4jService.getQName().getNamespaceURI());
+ wsdl4jPort = (Port) wsdl4jportsIterator.next();
+ this.populatePorts(wsdlEndpoint,
+ wsdl4jPort,
+ wsdl4jService.getQName().getNamespaceURI());
+ this.copyExtensibleElements(wsdl4jPort.getExtensibilityElements(),
+ wsdlEndpoint);
wsdlService.setEndpoint(wsdlEndpoint);
}
@@ -283,11 +276,7 @@
//This code make no attempt to make use of the special xs:Token
//defined in the WSDL 2.0. eg like #any, #none
-
- //OperationType wsdl4jOperation.getStyle()
-
// Create the Input Message and add
-
Input wsdl4jInputMessage = wsdl4jOperation.getInput();
MessageReference wsdlInputMessage = this.wsdlComponenetFactory
.createMessageReference();
@@ -297,48 +286,41 @@
// the Types.
//TODO
-
- if(wsdl4jInputMessage.getMessage().getParts().size()>1)
+ if (wsdl4jInputMessage.getMessage().getParts().size() > 1)
throw new WSDLProcessingException("Multipart Parsing not Supported");
- Iterator inputIterator = wsdl4jInputMessage.getMessage().getParts().values().iterator();
- if(inputIterator.hasNext()){
- Part part = ((Part)inputIterator.next());
- QName element ;
- if(null != (element= part.getTypeName())){
+ Iterator inputIterator = wsdl4jInputMessage.getMessage().getParts()
+ .values().iterator();
+ if (inputIterator.hasNext()) {
+ Part part = ((Part) inputIterator.next());
+ QName element;
+ if (null != (element = part.getTypeName())) {
wsdlInputMessage.setElement(element);
- }else{
+ } else {
wsdlInputMessage.setElement(part.getElementName());
}
}
-
-
wsdlOperation.setInputMessage(wsdlInputMessage);
-
-
+
//Create an output message and add
Output wsdl4jOutputMessage = wsdl4jOperation.getOutput();
- MessageReference wsdlOutputMessage = this.wsdlComponenetFactory.createMessageReference();
+ MessageReference wsdlOutputMessage =
+ this.wsdlComponenetFactory.createMessageReference();
wsdlOutputMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
-
- if(wsdl4jOutputMessage.getMessage().getParts().size()>1)
+
+ if (wsdl4jOutputMessage.getMessage().getParts().size() > 1)
throw new WSDLProcessingException("Multipart Parsing not Supported");
- Iterator outputIterator = wsdl4jOutputMessage.getMessage().getParts().values().iterator();
- if(outputIterator.hasNext()){
- Part outPart = ((Part)outputIterator.next());
- QName typeName ;
- if(null != (typeName = outPart.getTypeName())){
+ Iterator outputIterator =
+ wsdl4jOutputMessage.getMessage().getParts().values().iterator();
+ if (outputIterator.hasNext()) {
+ Part outPart = ((Part) outputIterator.next());
+ QName typeName;
+ if (null != (typeName = outPart.getTypeName())) {
wsdlOutputMessage.setElement(typeName);
- }else{
+ } else {
wsdlOutputMessage.setElement(outPart.getElementName());
}
}
-
-
wsdlOperation.setOutputMessage(wsdlOutputMessage);
- //TODO
-
-
-
//Set the MEP
wsdlOperation.setMessageExchangePattern(WSDL11MEPFinder
.getMEP(wsdl4jOperation));
@@ -349,16 +331,19 @@
WSDLBindingOperation wsdlBindingOperation,
BindingOperation wsdl4jBindingOperation,
String nameSpaceOfTheBindingOperation) {
+
wsdlBindingOperation.setName(new QName(nameSpaceOfTheBindingOperation,
- wsdl4jBindingOperation.getName()));
+ wsdl4jBindingOperation.getName()));
- BindingInput wsdl4jInputBinding = wsdl4jBindingOperation
- .getBindingInput();
- WSDLBindingMessageReference wsdlInputBinding = this.wsdlComponenetFactory
- .createWSDLBindingMessageReference();
+ BindingInput wsdl4jInputBinding =
+ wsdl4jBindingOperation.getBindingInput();
+ WSDLBindingMessageReference wsdlInputBinding =
+ this.wsdlComponenetFactory.createWSDLBindingMessageReference();
wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
- //TODO
+ //TODO Faults
+ this.copyExtensibleElements(wsdl4jInputBinding.getExtensibilityElements(),
+ wsdlInputBinding);
wsdlBindingOperation.setInput(wsdlInputBinding);
BindingOutput wsdl4jOutputBinding = wsdl4jBindingOperation
@@ -367,7 +352,9 @@
.createWSDLBindingMessageReference();
wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
- //TODO
+ //TODO Faults
+ this.copyExtensibleElements(wsdl4jOutputBinding.getExtensibilityElements(),
+ wsdlOutputBinding);
wsdlBindingOperation.setInput(wsdlOutputBinding);
}
@@ -378,11 +365,8 @@
wsdlEndpoint.setBinding(this.womDefinition.getBinding(wsdl4jPort
.getBinding().getQName()));
-// this.copyExtensibilityAttribute(wsdl4jPort.getExtensionAttributes(), wsdlEndpoint);
-// this.copyExtensibleElements(wsdl4jPort.getExtensibilityElements(), wsdlEndpoint);
- }
-
+ }
/**
* This method will fill up the gap of WSDL 1.1 and WSDL 2.0 w.r.t. the
@@ -431,42 +415,68 @@
}
return newBoundInterface;
}
-
+
/**
- * Get the Extensible elements form wsdl4jExtensibleElements <code>Vector</code>if any and
- * copy them to <code>Component</code>
+ * Get the Extensible elements form wsdl4jExtensibleElements
+ * <code>Vector</code> if any and copy them to <code>Component</code>
+ *
* @param wsdl4jExtensibleElements
* @param womExtensibleElements
*/
- private void copyExtensibleElements(List wsdl4jExtensibleElements, Component component){
+ private void copyExtensibleElements(List wsdl4jExtensibleElements,
+ Component component) {
Iterator iterator = wsdl4jExtensibleElements.iterator();
- while(iterator.hasNext()){
- Object obj = iterator.next();
- if(obj instanceof UnknownExtensibilityElement){
- UnknownExtensibilityElement temp = (UnknownExtensibilityElement)(obj);
- WSDLExtensibilityElement extensibilityElement = this.wsdlComponenetFactory.createWSDLExtensibilityElement();
- extensibilityElement.setElement(temp.getElement());
- Boolean required = temp.getRequired();
- if(null != required){
+ ExtensionFactory extensionFactory = this.wsdlComponenetFactory
+ .createExtensionFactory();
+ while (iterator.hasNext()) {
+
+ ExtensibilityElement wsdl4jElement = (ExtensibilityElement) iterator
+ .next();
+
+ if (wsdl4jElement instanceof UnknownExtensibilityElement) {
+ UnknownExtensibilityElement unknown = (UnknownExtensibilityElement) (wsdl4jElement);
+ DefaultExtensibilityElement extensibilityElement = (DefaultExtensibilityElement) extensionFactory
+ .getExtensionElement(wsdl4jElement.getElementType());
+ extensibilityElement.setElement(unknown.getElement());
+ Boolean required = unknown.getRequired();
+ if (null != required) {
extensibilityElement.setRequired(required.booleanValue());
}
component.addExtensibilityElement(extensibilityElement);
+ } else if (wsdl4jElement instanceof SOAPAddress) {
+ SOAPAddress soapAddress = (SOAPAddress) wsdl4jElement;
+ org.apache.wsdl.extensions.SOAPAddress extensibilityElement = (org.apache.wsdl.extensions.SOAPAddress) extensionFactory
+ .getExtensionElement(soapAddress.getElementType());
+ extensibilityElement.setLocationURI(soapAddress
+ .getLocationURI());
+ Boolean required = soapAddress.getRequired();
+ if (null != required) {
+ extensibilityElement.setRequired(required.booleanValue());
+ }
+ component.addExtensibilityElement(extensibilityElement);
+ } else {
+// throw new AxisError(
+// "An Extensible item "+wsdl4jElement.getElementType()+" went unparsed during WSDL Parsing");
}
}
}
-
+
/**
- * Get the Extensible Attributes from wsdl4jExtensibilityAttribute <code>Map</code> if
- * any and copy them to the <code>Component</code>
+ * Get the Extensible Attributes from wsdl4jExtensibilityAttribute
+ * <code>Map</code> if any and copy them to the <code>Component</code>
+ *
* @param wsdl4jExtensibilityAttributes
* @param component
*/
- private void copyExtensibilityAttribute(Map wsdl4jExtensibilityAttributes, Component component){
+ private void copyExtensibilityAttribute(Map wsdl4jExtensibilityAttributes,
+ Component component) {
Iterator iterator = wsdl4jExtensibilityAttributes.keySet().iterator();
- while(iterator.hasNext()){
- QName attributeName = (QName)iterator.next();
- QName value = (QName)wsdl4jExtensibilityAttributes.get(attributeName);
- WSDLExtensibilityAttribute attribute = this.wsdlComponenetFactory.createWSDLExtensibilityAttribute();
+ while (iterator.hasNext()) {
+ QName attributeName = (QName) iterator.next();
+ QName value = (QName) wsdl4jExtensibilityAttributes
+ .get(attributeName);
+ WSDLExtensibilityAttribute attribute = this.wsdlComponenetFactory
+ .createWSDLExtensibilityAttribute();
attribute.setKey(attributeName);
attribute.setValue(value);
component.addExtensibleAttributes(attribute);
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Wed May 25 21:22:57 2005
@@ -1,30 +1,37 @@
package org.apache.axis.wsdl.codegen.emitter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis.wsdl.codegen.CodeGenerationException;
import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
-import org.apache.axis.wsdl.codegen.writer.*;
+import org.apache.axis.wsdl.codegen.writer.BeanWriter;
+import org.apache.axis.wsdl.codegen.writer.CallbackHandlerWriter;
+import org.apache.axis.wsdl.codegen.writer.ClassWriter;
+import org.apache.axis.wsdl.codegen.writer.InterfaceImplementationWriter;
+import org.apache.axis.wsdl.codegen.writer.InterfaceWriter;
+import org.apache.axis.wsdl.codegen.writer.ServiceXMLWriter;
+import org.apache.axis.wsdl.codegen.writer.SkeletonWriter;
+import org.apache.axis.wsdl.codegen.writer.TestClassWriter;
import org.apache.axis.wsdl.databinding.TypeMapper;
import org.apache.crimson.tree.XmlDocument;
import org.apache.wsdl.WSDLBinding;
-import org.apache.wsdl.WSDLOperation;
-import org.apache.wsdl.WSDLTypes;
-import org.apache.wsdl.WSDLInterface;
import org.apache.wsdl.WSDLDescription;
-import org.apache.wsdl.WSDLService;
import org.apache.wsdl.WSDLEndpoint;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+import org.apache.wsdl.WSDLService;
+import org.apache.wsdl.WSDLTypes;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -215,9 +222,8 @@
* @throws Exception
*/
protected void writeBeans(WSDLTypes wsdlType) throws Exception {
- HashMap typesMap = wsdlType.getTypes();
- if (typesMap!=null){
- Collection collection = typesMap.values();
+ Collection collection= wsdlType.getExtensibilityElements();
+ if (collection != null){
for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
XmlDocument interfaceModel = createDOMDocuementForBean();
BeanWriter beanWriter =
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/Component.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/Component.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/Component.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/Component.java Wed May 25 21:22:57 2005
@@ -53,7 +53,7 @@
public Object getComponentProperty(Object key);
/**
- * Adds the <code>WSDLExtensibilityElement</code> to the Extensible Component.
+ * Adds the <code>ExtensibilityElement</code> to the Extensible Component.
* @param element
*/
public void addExtensibilityElement(WSDLExtensibilityElement element);
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLExtensibilityElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLExtensibilityElement.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLExtensibilityElement.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLExtensibilityElement.java Wed May 25 21:22:57 2005
@@ -1,51 +1,33 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
* Licensed 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.wsdl;
-import org.w3c.dom.Element;
+import javax.xml.namespace.QName;
/**
* @author chathura@opensource.lk
+ *
*/
public interface WSDLExtensibilityElement {
- /**
- * Method getElement
- *
- * @return
- */
- public Element getElement();
-
- /**
- * Method setElement
- *
- * @param element
- */
- public void setElement(Element element);
-
- /**
- * Method isRequired
- *
- * @return
- */
- public boolean isRequired();
-
- /**
- * Method setRequired
- *
- * @param required
- */
- public void setRequired(boolean required);
-}
+ public boolean isRequired();
+
+ public void setRequired(boolean required);
+
+ public QName getType();
+
+ public void setType(QName type);
+}
\ No newline at end of file
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLTypes.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLTypes.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLTypes.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLTypes.java Wed May 25 21:22:57 2005
@@ -1,55 +1,43 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
* Licensed 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.wsdl;
import javax.xml.namespace.QName;
-import java.util.HashMap;
+
/**
* @author chathura@opensource.lk
+ *
*/
-public interface WSDLTypes {
- /**
- * Sets the <code>ExtensionElement</code>s as a <code>HashMap</code>
- *
- * @return
- */
- public HashMap getTypes();
-
- /**
- * Returns all the <code>ExtensionElement</code>s as a <code>HashMap</code>
- *
- * @param types
- */
- public void setTypes(HashMap types);
-
- /**
- * Adds the <code>ExtensionElement</code> to the map keyed with the <code>QName</code>
- *
- * @param qName
- * @param element
- */
- public void addElement(QName qName, WSDLExtensibilityElement element);
+public interface WSDLTypes extends Component{
+ /**
+ * Adds the <code>ExtensionElement</code> to the map keyed with the <code>QName</code>
+ *
+ * @param qName
+ * @param element
+ */
+ public void addElement(WSDLExtensibilityElement element);
- /**
- * Will return the Element with the given <code>QName</code>
- * Returns null if not found.
- *
- * @param qName
- * @return
- */
- public WSDLExtensibilityElement getElement(QName qName);
-}
+ /**
+ * Will return the first Element with the given <code>QName</code>
+ * Returns null if not found.
+ *
+ * @param qName
+ * @return
+ */
+ public WSDLExtensibilityElement getFirstElement(QName qName);
+}
\ No newline at end of file
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/ComponentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/ComponentImpl.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/ComponentImpl.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/ComponentImpl.java Wed May 25 21:22:57 2005
@@ -20,9 +20,9 @@
import java.util.List;
import org.apache.wsdl.Component;
-import org.apache.wsdl.WSDLExtensibilityAttribute;
-import org.apache.wsdl.WSDLConstants;
import org.apache.wsdl.WSDLExtensibilityElement;
+import org.apache.wsdl.WSDLConstants;
+import org.apache.wsdl.WSDLExtensibilityAttribute;
import org.w3c.dom.Document;
/**
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java Wed May 25 21:22:57 2005
@@ -15,13 +15,31 @@
*/
package org.apache.wsdl.impl;
-import org.apache.wsdl.*;
-
-import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import javax.xml.namespace.QName;
+
+import org.apache.wsdl.MessageReference;
+import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLBindingMessageReference;
+import org.apache.wsdl.WSDLBindingOperation;
+import org.apache.wsdl.WSDLDescription;
+import org.apache.wsdl.WSDLEndpoint;
+import org.apache.wsdl.WSDLExtensibilityAttribute;
+import org.apache.wsdl.WSDLFault;
+import org.apache.wsdl.WSDLFeature;
+import org.apache.wsdl.WSDLImport;
+import org.apache.wsdl.WSDLInclude;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+import org.apache.wsdl.WSDLProperty;
+import org.apache.wsdl.WSDLService;
+import org.apache.wsdl.WSDLTypes;
+import org.apache.wsdl.extensions.ExtensionFactory;
+import org.apache.wsdl.extensions.impl.ExtensionFactoryImpl;
+
/**
* @author chathura@opensource.lk
*/
@@ -469,9 +487,16 @@
return new WSDLBindingOperationImpl();
}
- public WSDLExtensibilityElement createWSDLExtensibilityElement(){
- return new WSDLExtensibilityElementImpl();
+ /**
+ *
+ * @return A new Instance of <code>ExtensionFactory</code> that
+ * is capable of creating the correct <code>ExtensibilityElement</code>
+ * given a <code>QName</code>.
+ */
+ public ExtensionFactory createExtensionFactory(){
+ return new ExtensionFactoryImpl();
}
+
public WSDLBinding getFirstBinding(){
Iterator bindingIterator = this.bindings.values().iterator();
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLExtensibilityElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLExtensibilityElementImpl.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLExtensibilityElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLExtensibilityElementImpl.java Wed May 25 21:22:57 2005
@@ -1,70 +1,45 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
* Licensed 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.wsdl.impl;
+import javax.xml.namespace.QName;
+
import org.apache.wsdl.WSDLExtensibilityElement;
-import org.w3c.dom.Element;
/**
* @author chathura@opensource.lk
+ *
*/
public class WSDLExtensibilityElementImpl implements WSDLExtensibilityElement {
- /**
- * Field element
- */
- private Element element;
-
- /**
- * Field required
- */
- private boolean required;
-
- /**
- * Method isRequired
- *
- * @return
- */
- public boolean isRequired() {
- return required;
- }
-
- /**
- * Method setRequired
- *
- * @param required
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- /**
- * Method getElement
- *
- * @return
- */
- public Element getElement() {
- return element;
- }
-
- /**
- * Method setElement
- *
- * @param element
- */
- public void setElement(Element element) {
- this.element = element;
- }
+
+ protected QName type;
+
+ protected boolean required;
+
+ public boolean isRequired() {
+ return required;
+ }
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+ public QName getType() {
+ return type;
+ }
+ public void setType(QName type) {
+ this.type = type;
+ }
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLTypesImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLTypesImpl.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLTypesImpl.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLTypesImpl.java Wed May 25 21:22:57 2005
@@ -15,38 +15,18 @@
*/
package org.apache.wsdl.impl;
-import org.apache.wsdl.WSDLExtensibilityElement;
-import org.apache.wsdl.WSDLTypes;
+import java.util.Iterator;
import javax.xml.namespace.QName;
-import java.util.HashMap;
+
+import org.apache.wsdl.WSDLExtensibilityElement;
+import org.apache.wsdl.WSDLTypes;
/**
* @author chathura@opensource.lk
*/
public class WSDLTypesImpl extends ComponentImpl implements WSDLTypes {
- /**
- * Field extensionElements
- */
- private HashMap extensionElements = new HashMap();
- /**
- * Sets the <code>ExtensionElement</code>s as a <code>HashMap</code>
- *
- * @return
- */
- public HashMap getTypes() {
- return extensionElements;
- }
-
- /**
- * Returns all the <code>ExtensionElement</code>s as a <code>HashMap</code>
- *
- * @param types
- */
- public void setTypes(HashMap types) {
- this.extensionElements = types;
- }
/**
* Adds the <code>ExtensionElement</code> to the map keyed with the <code>QName</code>
@@ -54,18 +34,25 @@
* @param qName
* @param element
*/
- public void addElement(QName qName, WSDLExtensibilityElement element) {
- this.extensionElements.put(qName, element);
+ public void addElement(WSDLExtensibilityElement element) {
+ this.addExtensibilityElement(element);
}
/**
- * Will return the Element with the given <code>QName</code>
+ * Will return the first Element with the given <code>QName</code>
* Returns null if not found.
*
* @param qName
* @return
*/
- public WSDLExtensibilityElement getElement(QName qName) {
- return (WSDLExtensibilityElement) this.extensionElements.get(qName);
+ public WSDLExtensibilityElement getFirstElement(QName qName) {
+ Iterator iterator = this.getExtensibilityElements().iterator();
+ while(iterator.hasNext()){
+ WSDLExtensibilityElement temp =(WSDLExtensibilityElement)iterator.next();
+ if(temp.getType().equals(qName))
+ return temp;
+ }
+
+ return null;
}
}
Modified: webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java?rev=178577&r1=178576&r2=178577&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/test/org/apache/wsdl/WOMBuilderTest.java Wed May 25 21:22:57 2005
@@ -16,9 +16,9 @@
package org.apache.wsdl;
-import org.apache.axis.wsdl.builder.WOMBuilderFactory;
-import org.apache.wsdl.util.Utils;
-import org.w3c.dom.Document;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
import javax.wsdl.Definition;
import javax.wsdl.Operation;
@@ -26,9 +26,10 @@
import javax.wsdl.Service;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Iterator;
+
+import org.apache.axis.wsdl.builder.WOMBuilderFactory;
+import org.apache.wsdl.util.Utils;
+import org.w3c.dom.Document;
/**
* @author chathura@opensource.lk
@@ -63,7 +64,7 @@
;
assertEquals(womDescription.getServices().size(), wsdl4jDefinition.getServices().size());
assertEquals(womDescription.getBindings().size(), wsdl4jDefinition.getBindings().size());
- assertEquals(womDescription.getTypes().getTypes().size(), wsdl4jDefinition.getTypes().getExtensibilityElements().size());
+
}
public void testInterfacesComponent() throws Exception {