axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r160375 - in webservices/axis/trunk/java/modules: core/src/org/apache/axis/deployment/ core/src/org/apache/axis/description/ core/test/org/apache/axis/description/ samples/test/org/apache/axis/clientapi/ samples/test/org/apache/axis/engine/ wsdl/src/org/apache/axis/wsdl/builder/ wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/ wsdl/src/org/apache/wsdl/ wsdl/src/org/apache/wsdl/impl/
Date Thu, 07 Apr 2005 06:26:56 GMT
Author: chathura
Date: Wed Apr  6 23:26:51 2005
New Revision: 160375

URL: http://svn.apache.org/viewcvs?view=rev&rev=160375
Log:
New factory added so that the WOM can be built esternally. This provides for the building of the AxisService(Service Desc) even though it estends the WSDLService. The same will be true for any class extending a a WOM component.

Added:
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/AxisDescWSDLComponentFactory.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java
Removed:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/SimpleAxisOperationImpl.java
Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/description/RegistryTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MessageWithServerTest.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/wsdl/WSDLDescription.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLService.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/WSDLServiceImpl.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java Wed Apr  6 23:26:51 2005
@@ -16,20 +16,30 @@
 
 package org.apache.axis.deployment;
 
-import org.apache.axis.description.*;
-import org.apache.axis.engine.AxisFault;
-import org.apache.axis.engine.EngineRegistryImpl;
-import org.apache.axis.phaseresolver.PhaseException;
-import org.apache.axis.transport.TransportReceiver;
-import org.apache.axis.transport.TransportSender;
+import java.io.InputStream;
+import java.util.ArrayList;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import java.io.InputStream;
-import java.util.ArrayList;
+
+import org.apache.axis.description.AxisGlobal;
+import org.apache.axis.description.AxisModule;
+import org.apache.axis.description.AxisOperation;
+import org.apache.axis.description.AxisService;
+import org.apache.axis.description.AxisTransportIn;
+import org.apache.axis.description.AxisTransportOut;
+import org.apache.axis.description.Flow;
+import org.apache.axis.description.FlowImpl;
+import org.apache.axis.description.HandlerMetadata;
+import org.apache.axis.description.Parameter;
+import org.apache.axis.description.ParameterImpl;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.phaseresolver.PhaseException;
+import org.apache.axis.transport.TransportReceiver;
+import org.apache.axis.transport.TransportSender;
 
 
 /**
@@ -619,7 +629,7 @@
 
     private AxisOperation processOperation() throws DeploymentException {
         //  String name = pullparser.getLocalName();
-        AxisOperation operation = new SimpleAxisOperationImpl();
+        AxisOperation operation = new AxisOperation();
         int attribCount = pullparser.getAttributeCount();
         if (attribCount < 5) {  // there should be two attributes
             for (int i = 0; i < attribCount; i++) {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java Wed Apr  6 23:26:51 2005
@@ -1,24 +1,51 @@
-/*
- * Copyright 2004,2005 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.axis.description;
 
+import javax.xml.namespace.QName;
+
 import org.apache.wsdl.WSDLOperation;
+import org.apache.wsdl.impl.WSDLOperationImpl;
 
 /**
- * for the time been operation can have only the parameters
+ * @author chathura@opensource.lk
+ *
  */
-public interface AxisOperation extends WSDLOperation, ParameterInclude {
+public class AxisOperation extends WSDLOperationImpl implements
+		ParameterInclude, WSDLOperation,DescriptionConstants {
+	
+	
+	public AxisOperation(){
+		this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
+	}
+	
+	public AxisOperation(QName name){
+		this();
+		this.setName(name);
+	}
+
+	/**
+     * Method addParameter
+     *
+     * @param param Parameter that will be added
+     */
+    public void addParameter(Parameter param) {
+        if (param == null) {
+            return;
+        }
+        ParameterIncludeImpl paramInclude =
+                (ParameterIncludeImpl) this.getComponentProperty(PARAMETER_KEY);
+        paramInclude.addParameter(param);
+    }
+
+   
+    /**
+     * Method getParameter
+     *
+     * @param name Name of the parameter
+     * @return 
+     */
+    public Parameter getParameter(String name) {
+        ParameterIncludeImpl paramInclude =
+                (ParameterIncludeImpl) this.getComponentProperty(PARAMETER_KEY);
+        return (Parameter) paramInclude.getParameter(name);
+    }
 }

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/description/RegistryTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/description/RegistryTest.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/description/RegistryTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/description/RegistryTest.java Wed Apr  6 23:26:51 2005
@@ -16,6 +16,8 @@
  
 package org.apache.axis.description;
 
+import javax.xml.namespace.QName;
+
 import org.apache.axis.AbstractTestCase;
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.engine.AxisFault;
@@ -25,8 +27,6 @@
 import org.apache.axis.handlers.AbstractHandler;
 import org.apache.axis.providers.RawXMLProvider;
 
-import javax.xml.namespace.QName;
-
 public class RegistryTest extends AbstractTestCase {
     private EngineRegistry reg;
 
@@ -76,7 +76,7 @@
     }
 
     public void testOpeartion() {
-        AxisOperation op = new SimpleAxisOperationImpl(new QName("op"));
+        AxisOperation op = new AxisOperation(new QName("op"));
         testParameteInClude(op);
     }
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceive.java Wed Apr  6 23:26:51 2005
@@ -29,7 +29,6 @@
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.description.AxisOperation;
 import org.apache.axis.description.AxisService;
-import org.apache.axis.description.SimpleAxisOperationImpl;
 import org.apache.axis.encoding.EncodingTest.Echo;
 import org.apache.axis.integration.UtilServer;
 import org.apache.axis.om.SOAPEnvelope;
@@ -73,7 +72,7 @@
         service.setClassLoader(Thread.currentThread().getContextClassLoader());
         service.setServiceClass(Echo.class);
         service.setProvider(new RawXMLProvider());
-        AxisOperation operation = new SimpleAxisOperationImpl(operationName);
+        AxisOperation operation = new AxisOperation(operationName);
 
         service.addOperation(operation);
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/clientapi/TestSendReceiveAsync.java Wed Apr  6 23:26:51 2005
@@ -16,8 +16,6 @@
 
 package org.apache.axis.clientapi;
 
-import java.io.FileInputStream;
-import java.io.FileReader;
 import java.io.InputStreamReader;
 
 import javax.xml.namespace.QName;
@@ -32,7 +30,6 @@
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.description.AxisOperation;
 import org.apache.axis.description.AxisService;
-import org.apache.axis.description.SimpleAxisOperationImpl;
 import org.apache.axis.engine.Echo;
 import org.apache.axis.integration.UtilServer;
 import org.apache.axis.om.SOAPEnvelope;
@@ -84,7 +81,7 @@
         service.setClassLoader(Thread.currentThread().getContextClassLoader());
         service.setServiceClass(Echo.class);
         service.setProvider(new RawXMLProvider());
-        AxisOperation operation = new SimpleAxisOperationImpl(operationName);
+        AxisOperation operation = new AxisOperation(operationName);
 
         service.addOperation(operation);
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java Wed Apr  6 23:26:51 2005
@@ -31,7 +31,6 @@
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.description.AxisOperation;
 import org.apache.axis.description.AxisService;
-import org.apache.axis.description.SimpleAxisOperationImpl;
 import org.apache.axis.encoding.EncodingTest.Echo;
 import org.apache.axis.integration.UtilServer;
 import org.apache.axis.om.OMElement;
@@ -71,7 +70,7 @@
         service.setClassLoader(Thread.currentThread().getContextClassLoader());
         service.setServiceClass(Echo.class);
         service.setProvider(new RawXMLProvider());
-        AxisOperation operation = new SimpleAxisOperationImpl(operationName);
+        AxisOperation operation = new AxisOperation(operationName);
 
         service.addOperation(operation);
         UtilServer.deployService(service);

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java Wed Apr  6 23:26:51 2005
@@ -18,22 +18,32 @@
 
 //todo
 
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
+
 import org.apache.axis.addressing.AddressingConstants;
 import org.apache.axis.addressing.EndpointReference;
 import org.apache.axis.context.MessageContext;
-import org.apache.axis.description.*;
+import org.apache.axis.description.AxisOperation;
+import org.apache.axis.description.AxisService;
+import org.apache.axis.description.Flow;
+import org.apache.axis.description.FlowImpl;
+import org.apache.axis.description.Parameter;
+import org.apache.axis.description.ParameterImpl;
 import org.apache.axis.handlers.AbstractHandler;
 import org.apache.axis.integration.UtilServer;
-import org.apache.axis.om.*;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
 import org.apache.axis.providers.RawXMLProvider;
 import org.apache.axis.transport.http.SimpleHTTPServer;
 import org.apache.axis.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-
 
 public class HandlerFailureTest extends TestCase {
     private Log log = LogFactory.getLog(getClass());
@@ -73,7 +83,7 @@
         Parameter classParam = new ParameterImpl("className", Echo.class.getName());
         service.addParameter(classParam);
         service.setProvider(new RawXMLProvider());
-        AxisOperation operation = new SimpleAxisOperationImpl(operationName);
+        AxisOperation operation = new AxisOperation(operationName);
 
         service.addOperation(operation);
 
@@ -114,7 +124,7 @@
         Parameter classParam = new ParameterImpl("className", Echo.class.getName());
         service.addParameter(classParam);
         service.setProvider(new RawXMLProvider());
-        AxisOperation operation = new SimpleAxisOperationImpl(operationName);
+        AxisOperation operation = new AxisOperation(operationName);
 
         service.addOperation(operation);
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MessageWithServerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MessageWithServerTest.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MessageWithServerTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MessageWithServerTest.java Wed Apr  6 23:26:51 2005
@@ -32,7 +32,6 @@
 import org.apache.axis.description.AxisModule;
 import org.apache.axis.description.AxisOperation;
 import org.apache.axis.description.AxisService;
-import org.apache.axis.description.SimpleAxisOperationImpl;
 import org.apache.axis.integration.UtilServer;
 import org.apache.axis.testUtils.SimpleJavaProvider;
 import org.apache.axis.transport.http.SimpleHTTPServer;
@@ -72,7 +71,7 @@
         m1.setFaultFlow(new MockFlow("service module faultflow", 1));
         service.addModule(m1.getName());
 
-        AxisOperation operation = new SimpleAxisOperationImpl(operationName);
+        AxisOperation operation = new AxisOperation(operationName);
         service.addOperation(operation);
 
         UtilServer.deployService(service);

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/AxisDescWSDLComponentFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/AxisDescWSDLComponentFactory.java?view=auto&rev=160375
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/AxisDescWSDLComponentFactory.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/AxisDescWSDLComponentFactory.java Wed Apr  6 23:26:51 2005
@@ -0,0 +1,119 @@
+package org.apache.axis.wsdl.builder;
+
+import org.apache.axis.description.AxisService;
+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.WSDLExtensibilityElement;
+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.impl.MessageReferenceImpl;
+import org.apache.wsdl.impl.WSDLBindingImpl;
+import org.apache.wsdl.impl.WSDLBindingMessageReferenceImpl;
+import org.apache.wsdl.impl.WSDLBindingOperationImpl;
+import org.apache.wsdl.impl.WSDLDescriptionImpl;
+import org.apache.wsdl.impl.WSDLEndpointImpl;
+import org.apache.wsdl.impl.WSDLExtensibilityElementImpl;
+import org.apache.wsdl.impl.WSDLFaultImpl;
+import org.apache.wsdl.impl.WSDLFeatureImpl;
+import org.apache.wsdl.impl.WSDLImportImpl;
+import org.apache.wsdl.impl.WSDLIncludeImpl;
+import org.apache.wsdl.impl.WSDLInterfaceImpl;
+import org.apache.wsdl.impl.WSDLPropertyImpl;
+import org.apache.wsdl.impl.WSDLTypesImpl;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class AxisDescWSDLComponentFactory implements WSDLComponentFactory {
+
+	
+	public WSDLDescription createDescription() {
+		return new WSDLDescriptionImpl();
+	}
+
+	
+	public WSDLService createService() {
+		return new AxisService();
+	}
+
+	
+	public WSDLInterface createInterface() {
+		return new WSDLInterfaceImpl();
+	}
+
+	
+	public WSDLTypes createTypes() {
+		return new WSDLTypesImpl();
+	}
+
+	
+	public WSDLBinding createBinding() {
+		return new WSDLBindingImpl();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis.wsdl.builder.WSDLComponentFactory#createFault()
+	 */
+	public WSDLOperation createOperation() {
+		return null;
+	}
+
+	
+	public WSDLEndpoint createEndpoint() {
+		return new WSDLEndpointImpl();
+	}
+
+	
+	public WSDLFault createFault() {
+		return new WSDLFaultImpl();
+	}
+
+	
+	public WSDLFeature createFeature() {
+		return new WSDLFeatureImpl();
+	}
+
+	
+	public WSDLImport createImport() {
+		return new WSDLImportImpl();
+	}
+
+	
+	public WSDLInclude createInclude() {
+		return new WSDLIncludeImpl();
+	}
+
+	
+	public WSDLProperty createProperty() {
+		return new WSDLPropertyImpl();
+	}
+	
+	public MessageReference createMessageReference(){
+		return new MessageReferenceImpl();
+	}
+	
+	public WSDLBindingMessageReference createWSDLBindingMessageReference(){
+		return new WSDLBindingMessageReferenceImpl();
+	}
+	
+	public WSDLBindingOperation createWSDLBindingOperation(){
+		return new WSDLBindingOperationImpl();
+	}
+	
+	public WSDLExtensibilityElement createWSDLExtensibilityElement(){
+		return new WSDLExtensibilityElementImpl();
+	}
+
+}

Added: 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?view=auto&rev=160375
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/WSDLComponentFactory.java Wed Apr  6 23:26:51 2005
@@ -0,0 +1,112 @@
+package org.apache.axis.wsdl.builder;
+
+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.WSDLExtensibilityElement;
+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;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public interface WSDLComponentFactory {
+
+	/**
+	 * @return A new instance of type <code>WSDLDescription</code>
+	 */
+	public WSDLDescription createDescription();
+
+	/**
+	 * @return A new instance of type <code>WSDLService</code>
+	 */
+	public WSDLService createService();
+
+	/**
+	 * @return A new instance of type <code>WSDLInterface</code>
+	 */
+	public WSDLInterface createInterface();
+
+	/**
+	 * @return A new instance of type <code>WSDLTypes</code>
+	 */
+	public WSDLTypes createTypes();
+
+	/**
+	 * @return A new instance of type <code>WSDLBinding</code>
+	 */
+	public WSDLBinding createBinding();
+
+	/**
+	 * @return A new instance of type <code>WSDLOperation</code>
+	 */
+	public WSDLOperation createOperation();
+
+	/**
+	 * @return A new instance of type <code>WSDLEndpoint</code>
+	 */
+	public WSDLEndpoint createEndpoint();
+
+	/**
+	 * @return A new instance of type <code>WSDLFault</code>
+	 */
+	public WSDLFault createFault();
+
+	/**
+	 * @return A new instance of type <code>WSDLFeature</code>
+	 */
+	public WSDLFeature createFeature();
+
+	/**
+	 * @return A new instance of type <code>WSDLImport</code>
+	 */
+	public WSDLImport createImport();
+
+	/**
+	 * @return A new instance of type <code>WSDLInclude</code>
+	 */
+	public WSDLInclude createInclude();
+
+	/**
+	 * Method createProperty
+	 *
+	 * @return A new instance of <code>WSDLProperty</code>
+	 */
+	public WSDLProperty createProperty();
+	
+	/**
+	 * 
+	 * @return A new instance of <code>MessageReference</code>
+	 */
+	public MessageReference createMessageReference();
+	
+	/**
+	 * 
+	 * @return A new instance of <code>WSDLBindingMessageReference</code>
+	 */
+	public WSDLBindingMessageReference createWSDLBindingMessageReference();
+	
+	/**
+	 * 
+	 * @return A new instance of <code>WSDLBindingOperation</code>
+	 */
+	public WSDLBindingOperation createWSDLBindingOperation();
+	
+	/**
+	 * 
+	 * @return A new instance of <code>WSDLExtensibilityElement</code>
+	 */
+	public WSDLExtensibilityElement createWSDLExtensibilityElement();
+
+}

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?view=diff&r1=160374&r2=160375
==============================================================================
--- 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 Apr  6 23:26:51 2005
@@ -33,6 +33,7 @@
 import javax.wsdl.extensions.UnknownExtensibilityElement;
 import javax.xml.namespace.QName;
 
+import org.apache.axis.wsdl.builder.WSDLComponentFactory;
 import org.apache.wsdl.MessageReference;
 import org.apache.wsdl.WSDLBinding;
 import org.apache.wsdl.WSDLBindingMessageReference;
@@ -45,336 +46,374 @@
 import org.apache.wsdl.WSDLOperation;
 import org.apache.wsdl.WSDLService;
 import org.apache.wsdl.WSDLTypes;
-import org.apache.wsdl.impl.MessageReferenceImpl;
-import org.apache.wsdl.impl.WSDLBindingImpl;
-import org.apache.wsdl.impl.WSDLBindingMessageReferenceImpl;
-import org.apache.wsdl.impl.WSDLBindingOperationImpl;
-import org.apache.wsdl.impl.WSDLEndpointImpl;
-import org.apache.wsdl.impl.WSDLExtensibilityElementImpl;
-import org.apache.wsdl.impl.WSDLInterfaceImpl;
-import org.apache.wsdl.impl.WSDLOperationImpl;
 import org.apache.wsdl.impl.WSDLProcessingException;
-import org.apache.wsdl.impl.WSDLServiceImpl;
-import org.apache.wsdl.impl.WSDLTypesImpl;
 
 /**
  * @author chathura@opensource.lk
  */
 public class WSDLPump {
 
-    private static final String BOUND_INTERFACE_NAME = "BoundInterface";
-    private WSDLDescription womDefinition;
+	private static final String BOUND_INTERFACE_NAME = "BoundInterface";
 
-    private Definition wsdl4jParsedDefinition;
+	private WSDLDescription womDefinition;
 
-    public WSDLPump(WSDLDescription womDefinition,
-                    Definition wsdl4jParsedDefinition) {
-        this.womDefinition = womDefinition;
-        this.wsdl4jParsedDefinition = wsdl4jParsedDefinition;
-    }
-
-    public void pump() {
-        if (null != this.wsdl4jParsedDefinition && null != this.womDefinition) {
-            this.populateDefinition(this.womDefinition, this.wsdl4jParsedDefinition);
-        } else {
-            throw new WSDLProcessingException("Properties not set properly");
-        }
-
-    }
-
-    private void populateDefinition(WSDLDescription wsdlDefinition,
-                                    Definition wsdl4JDefinition) {
-        //Go through the WSDL4J Definition and pump it to the WOM
-        wsdlDefinition.setWSDL1DefinitionName(wsdl4JDefinition.getQName());
-        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								   //
-        //1) The Binding refers to the Interface								   //
-        //2) Thw Endpoint refers tot he Bindings								   //
-        // ....																	   //
-        //																		   //
-        /////////////////////////////////////////////////////////////////////////////
-
-
-
-        //////////////////////////(1)First pump the Types////////////////////////////
-        //Types may get changed inside the Operation pumping.
-				
-        Types wsdl4jTypes = wsdl4JDefinition.getTypes();
-        WSDLTypes wsdlTypes = new WSDLTypesImpl();
-        Iterator wsdl4jelmentsIterator = wsdl4jTypes.getExtensibilityElements().iterator();
-        ExtensibilityElement wsdl4jElement;
-        WSDLExtensibilityElement womElement;
-        UnknownExtensibilityElement temp = new UnknownExtensibilityElement();
-        while (wsdl4jelmentsIterator.hasNext()) {
-            wsdl4jElement = (ExtensibilityElement) wsdl4jelmentsIterator.next();
-            womElement = new WSDLExtensibilityElementImpl();
-            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.womDefinition.setTypes(wsdlTypes);
-
-
-
-
-        //////////////////////////(2)Pump the Interfaces/////////////////////////////
-        //pump the Interfaces: Get the PortTypes from WSDL4J parse OM and pump it to the 
-        //WOM's WSDLInterface Components 
-
-        Iterator portTypeIterator = wsdl4JDefinition.getPortTypes().values().iterator();
-        WSDLInterface wsdlInterface;
-        while (portTypeIterator.hasNext()) {
-            wsdlInterface = new WSDLInterfaceImpl();
-            this.populateInterfaces(wsdlInterface,
-                    (PortType) portTypeIterator.next());
-            wsdlDefinition.addInterface(wsdlInterface);
-
-        }
-
-
-
-
-        //////////////////////////(3)Pump the Bindings///////////////////////////////
-        //pump the Bindings: Get the Bindings map from WSDL4J and create a new map of 
-        //WSDLBinding elements
-
-        
-        Iterator bindingIterator = wsdl4JDefinition.getBindings().values().iterator();
-        WSDLBinding wsdlBinding;
-        while (bindingIterator.hasNext()) {
-            wsdlBinding = new WSDLBindingImpl();
-            this.populateBindings(wsdlBinding, (Binding) bindingIterator.next());
-            wsdlDefinition.addBinding(wsdlBinding);
-
-        }
-
-
-        //////////////////////////(4)Pump the Services///////////////////////////////
-
-        Iterator serviceIterator = wsdl4JDefinition.getServices().values().iterator();
-        WSDLService wsdlService;
-        while (serviceIterator.hasNext()) {
-            wsdlService = new WSDLServiceImpl();
-            this.populateServices(wsdlService, (Service) serviceIterator.next());
-            wsdlDefinition.addService(wsdlService);
-        }
-
-    }
-
-    //////////////////////////////////////////////////////////////////////////////
-    //////////////////////////   Top level Components Copying ////////////////////
-
-
-
-    /**
-     * Simply Copy information.
-     *
-     * @param wsdlInterface
-     * @param wsdl4jPortType
-     */
-    //FIXME Evaluate a way of injecting features and priperties with a general formatted input
-    private void populateInterfaces(WSDLInterface wsdlInterface, PortType wsdl4jPortType) {
-
-        //Copy the Attrebute information items
-        //Copied with the Same QName so it will reqire no Query in Binding pumping.
-        wsdlInterface.setName(wsdl4jPortType.getQName());
-
-
-        Iterator wsdl4JOperationsIterator = wsdl4jPortType.getOperations().iterator();
-        WSDLOperation wsdloperation;
-        while (wsdl4JOperationsIterator.hasNext()) {
-            wsdloperation = new WSDLOperationImpl();
-            this.populateOperations(wsdloperation, (Operation) wsdl4JOperationsIterator.next(), wsdl4jPortType.getQName().getNamespaceURI());
-            wsdlInterface.setOperation(wsdloperation);
-
-        }
-
-
-    }
-
-
-    /**
-     * Pre Condition: The Interface Components must be copied by now.
-     */
-    private void populateBindings(WSDLBinding wsdlBinding, Binding wsdl4JBinding) {
-        //Copy attrebutes
-        wsdlBinding.setName(wsdl4JBinding.getQName());
-        QName interfaceName = wsdl4JBinding.getPortType().getQName();
-        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.setBoundInterface(wsdlInterface);
-
-        Iterator bindingoperationsIterator = wsdl4JBinding.getBindingOperations().iterator();
-
-        WSDLBindingOperation wsdlBindingOperation;
-        while (bindingoperationsIterator.hasNext()) {
-            wsdlBindingOperation = new WSDLBindingOperationImpl();
-            this.populateBindingOperation(wsdlBindingOperation, (BindingOperation) bindingoperationsIterator.next(), wsdl4JBinding.getQName().getNamespaceURI());
-            wsdlBinding.addBindingOperation(wsdlBindingOperation);
-        }
-
-
-    }
-
-
-    public void populateServices(WSDLService wsdlService, Service wsdl4jService) {
-        wsdlService.setName(wsdl4jService.getQName());
-        Iterator wsdl4jportsIterator = wsdl4jService.getPorts().values().iterator();
-        wsdlService.setServiceInterface(this.getBoundInterface(wsdlService));
-        WSDLEndpoint wsdlEndpoint;
-        while (wsdl4jportsIterator.hasNext()) {
-            wsdlEndpoint = new WSDLEndpointImpl();
-            this.populatePorts(wsdlEndpoint, (Port) wsdl4jportsIterator.next(), wsdl4jService.getQName().getNamespaceURI());
-            wsdlService.setEndpoint(wsdlEndpoint);
-        }
-
-    }
-
-
-    /////////////////////////////////////////////////////////////////////////////
-    ////////////////////////////   Internal Component Copying ///////////////////
-    //TODO Faults ??
-    public void populateOperations(WSDLOperation wsdlOperation, Operation wsdl4jOperation, String nameSpaceOfTheOperation) {
-        //Copy Name Attrebute
-        wsdlOperation.setName(new QName(nameSpaceOfTheOperation, wsdl4jOperation.getName()));
-
-        //OperationType wsdl4jOperation.getStyle()
-        
-
-        // Create the Input Message and add
-        
-        Input wsdl4jInputMessage = wsdl4jOperation.getInput();
-        MessageReference wsdlInputMessage = new MessageReferenceImpl();
-        wsdlInputMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
-
-        //Get all the in parts and create a new Element out of it and add it to the Types.
-        //TODO
-        
-        wsdlInputMessage.setMessageLabel(wsdl4jInputMessage.getName());
-        //wsdlInputMessage.setElement(wsdl4jInputMessage.getMessage())
-
-        //       	wsdlInputMessage.setMessageLabel()
-
-        //Create an output message and add
-        Output wsdl4jOutputMessage = wsdl4jOperation.getOutput();
-        MessageReference wsdlOutputMessage = new MessageReferenceImpl();
-        wsdlOutputMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
-        //Get all the in parts and create a new Element out of it and add it to the Types.
-        //TODO
-
-        //wsdlInputMessage.setMessageLabel()
-
-        //Set the MEP
-        wsdlOperation.setMessageExchangePattern(WSDL11MEPFinder.getMEP(wsdl4jOperation));
-
-    }
-
-
-    private void populateBindingOperation(WSDLBindingOperation wsdlBindingOperation, BindingOperation wsdl4jBindingOperation, String nameSpaceOfTheBindingOperation) {
-        wsdlBindingOperation.setName(new QName(nameSpaceOfTheBindingOperation, wsdl4jBindingOperation.getName()));
-
-        BindingInput wsdl4jInputBinding = wsdl4jBindingOperation.getBindingInput();
-        WSDLBindingMessageReference wsdlInputBinding = new WSDLBindingMessageReferenceImpl();
-
-        wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
-        //TODO
-        wsdlBindingOperation.setInput(wsdlInputBinding);
-
-
-        BindingOutput wsdl4jOutputBinding = wsdl4jBindingOperation.getBindingOutput();
-        WSDLBindingMessageReference wsdlOutputBinding = new WSDLBindingMessageReferenceImpl();
-
-        wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
-        //TODO
-        wsdlBindingOperation.setInput(wsdlOutputBinding);
-
-
-    }
-
-
-    public void populatePorts(WSDLEndpoint wsdlEndpoint, Port wsdl4jPort, String targetNamspace) {
-        wsdlEndpoint.setName(new QName(targetNamspace, wsdl4jPort.getName()));
-
-        wsdlEndpoint.setBinding(this.womDefinition.getBinding(wsdl4jPort.getBinding().getQName()));
-        ///Extesibility elements.
-    }
-    
-    
-    
-//    ///////////////////////////Util Methods ////////////////////////////////////
-//   
-//    /**
-//     * Will return the URI for the MEP. if null will retun the IN_OUT as default
-//     * pattern.
-//     */
-//    private String getRelaventMEPForTheMessageStyle(OperationType operationType) {
-//
-//        if (null != operationType) {
-//
-//            if (operationType.equals(OperationType.REQUEST_RESPONSE))
-//                return WSDLConstants.MEP_URI_IN_OUT;
-//
-//            if (operationType.equals(OperationType.ONE_WAY))
-//                return WSDLConstants.MEP_URI_IN_ONLY;
-//
-//            if (operationType.equals(OperationType.NOTIFICATION))
-//                return WSDLConstants.MEP_URI_OUT_ONLY;
-//
-//            if (operationType.equals(OperationType.SOLICIT_RESPONSE))
-//                return WSDLConstants.MEP_URI_OUT_IN;
-//        }
-//        //TODO
-//        return WSDLConstants.MEP_URI_OUT_IN;
-//    }
-
-    /**
-     * This method will fill up the gap of WSDL 1.1 and WSDL 2.0 w.r.t. the
-     * bound interface for the Service Component Defined in the WSDL 2.0.
-     * Logic being if there exist only one PortType in the WSDL 1.1 file
-     * then that will be set as the bound interface of the Service. If more than one
-     * Porttype exist in the WSDl 1.1 file this will create a dummy Interface
-     * with the available PortTypes and will return that interface so that it
-     * will inherit all those interfaces.
-     * 
-     * Eventuall this will have to be fixed using user input since
-     *
-     * @param service
-     * @return
-     */
-    private WSDLInterface getBoundInterface(WSDLService service) {
-
-        // Throw an exception if there are no interfaces defined as at yet.
-        if (0 == this.womDefinition.getWsdlInterfaces().size())
-            throw new WSDLProcessingException("There are no " +
-                    "Interfaces/PortTypes identified in the current partially built" +
-                    "WOM");
-
-        //If there is only one Interface available hten return that because normally
-        // that interface must be the one to the service should get bound.
-        if (1 == this.womDefinition.getWsdlInterfaces().size())
-            return (WSDLInterface) this.womDefinition.getWsdlInterfaces().values().iterator().next();
-
-        //If there are more than one interface available... For the time being create a
-        // new interface and set all those existing interfaces as superinterfaces of it
-        // and return.
-        WSDLInterface newBoundInterface = this.womDefinition.createInterface();
-        newBoundInterface.setName(new QName(service.getNamespace(), service.getName().getLocalPart() + BOUND_INTERFACE_NAME));
-        Iterator interfaceIterator = this.womDefinition.getWsdlInterfaces().values().iterator();
-        while (interfaceIterator.hasNext()) {
-            newBoundInterface.addSuperInterface((WSDLInterface) interfaceIterator.next());
-        }
-        return newBoundInterface;
-    }
+	private Definition wsdl4jParsedDefinition;
 
-}
+	private WSDLComponentFactory wsdlComponenetFactory;
+
+	public WSDLPump(WSDLDescription womDefinition,
+			Definition wsdl4jParsedDefinition) {
+		this(womDefinition, wsdl4jParsedDefinition, womDefinition);
+	}
+
+	public WSDLPump(WSDLDescription womDefinition,
+			Definition wsdl4jParsedDefinition,
+			WSDLComponentFactory wsdlComponentFactory) {
+		this.womDefinition = womDefinition;
+		this.wsdl4jParsedDefinition = wsdl4jParsedDefinition;
+		this.wsdlComponenetFactory = wsdlComponentFactory;
+	}
+
+	public void pump() {
+		if (null != this.wsdl4jParsedDefinition && null != this.womDefinition) {
+			this.populateDefinition(this.womDefinition,
+					this.wsdl4jParsedDefinition);
+		} else {
+			throw new WSDLProcessingException("Properties not set properly");
+		}
+
+	}
+
+	private void populateDefinition(WSDLDescription wsdlDefinition,
+			Definition wsdl4JDefinition) {
+		//Go through the WSDL4J Definition and pump it to the WOM
+		wsdlDefinition.setWSDL1DefinitionName(wsdl4JDefinition.getQName());
+		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 //
+		//1) The Binding refers to the Interface //
+		//2) Thw Endpoint refers tot he Bindings //
+		// .... //
+		//																		   //
+		/////////////////////////////////////////////////////////////////////////////
+
+		//////////////////////////(1)First pump the
+		// Types////////////////////////////
+		//Types may get changed inside the Operation pumping.
+
+		Types wsdl4jTypes = wsdl4JDefinition.getTypes();
+		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.womDefinition.setTypes(wsdlTypes);
+
+		//////////////////////////(2)Pump the
+		// Interfaces/////////////////////////////
+		//pump the Interfaces: Get the PortTypes from WSDL4J parse OM and pump
+		// it to the
+		//WOM's WSDLInterface Components
+
+		Iterator portTypeIterator = wsdl4JDefinition.getPortTypes().values()
+				.iterator();
+		WSDLInterface wsdlInterface;
+		while (portTypeIterator.hasNext()) {
+			wsdlInterface = this.wsdlComponenetFactory.createInterface();
+			this.populateInterfaces(wsdlInterface, (PortType) portTypeIterator
+					.next());
+			wsdlDefinition.addInterface(wsdlInterface);
+
+		}
+
+		//////////////////////////(3)Pump the
+		// Bindings///////////////////////////////
+		//pump the Bindings: Get the Bindings map from WSDL4J and create a new
+		// map of
+		//WSDLBinding elements
+
+		Iterator bindingIterator = wsdl4JDefinition.getBindings().values()
+				.iterator();
+		WSDLBinding wsdlBinding;
+		while (bindingIterator.hasNext()) {
+			wsdlBinding = this.wsdlComponenetFactory.createBinding();
+			this.populateBindings(wsdlBinding, (Binding) bindingIterator
+							.next());
+			wsdlDefinition.addBinding(wsdlBinding);
+
+		}
+
+		//////////////////////////(4)Pump the
+		// Services///////////////////////////////
+
+		Iterator serviceIterator = wsdl4JDefinition.getServices().values()
+				.iterator();
+		WSDLService wsdlService;
+		while (serviceIterator.hasNext()) {
+			wsdlService = this.wsdlComponenetFactory.createService();
+			this
+					.populateServices(wsdlService, (Service) serviceIterator
+							.next());
+			wsdlDefinition.addService(wsdlService);
+		}
+
+	}
+
+	//////////////////////////////////////////////////////////////////////////////
+	////////////////////////// Top level Components Copying
+	// ////////////////////
+
+	/**
+	 * Simply Copy information.
+	 * 
+	 * @param wsdlInterface
+	 * @param wsdl4jPortType
+	 */
+	//FIXME Evaluate a way of injecting features and priperties with a general
+	// formatted input
+	private void populateInterfaces(WSDLInterface wsdlInterface,
+			PortType wsdl4jPortType) {
+
+		//Copy the Attrebute information items
+		//Copied with the Same QName so it will reqire no Query in Binding
+		// pumping.
+		wsdlInterface.setName(wsdl4jPortType.getQName());
+
+		Iterator wsdl4JOperationsIterator = wsdl4jPortType.getOperations()
+				.iterator();
+		WSDLOperation wsdloperation;
+		while (wsdl4JOperationsIterator.hasNext()) {
+			wsdloperation =this.wsdlComponenetFactory.createOperation();
+			this.populateOperations(wsdloperation,
+					(Operation) wsdl4JOperationsIterator.next(), wsdl4jPortType
+							.getQName().getNamespaceURI());
+			wsdlInterface.setOperation(wsdloperation);
+
+		}
+
+	}
+
+	/**
+	 * Pre Condition: The Interface Components must be copied by now.
+	 */
+	private void populateBindings(WSDLBinding wsdlBinding, Binding wsdl4JBinding) {
+		//Copy attrebutes
+		wsdlBinding.setName(wsdl4JBinding.getQName());
+		QName interfaceName = wsdl4JBinding.getPortType().getQName();
+		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.setBoundInterface(wsdlInterface);
+
+		Iterator bindingoperationsIterator = wsdl4JBinding
+				.getBindingOperations().iterator();
+
+		WSDLBindingOperation wsdlBindingOperation;
+		while (bindingoperationsIterator.hasNext()) {
+			wsdlBindingOperation = this.wsdlComponenetFactory.createWSDLBindingOperation();
+			this.populateBindingOperation(wsdlBindingOperation,
+					(BindingOperation) bindingoperationsIterator.next(),
+					wsdl4JBinding.getQName().getNamespaceURI());
+			wsdlBinding.addBindingOperation(wsdlBindingOperation);
+		}
+
+	}
+
+	public void populateServices(WSDLService wsdlService, Service wsdl4jService) {
+		wsdlService.setName(wsdl4jService.getQName());
+		Iterator wsdl4jportsIterator = wsdl4jService.getPorts().values()
+				.iterator();
+		wsdlService.setServiceInterface(this.getBoundInterface(wsdlService));
+		WSDLEndpoint wsdlEndpoint;
+		while (wsdl4jportsIterator.hasNext()) {
+			wsdlEndpoint = this.wsdlComponenetFactory.createEndpoint();
+			this.populatePorts(wsdlEndpoint, (Port) wsdl4jportsIterator.next(),
+					wsdl4jService.getQName().getNamespaceURI());
+			wsdlService.setEndpoint(wsdlEndpoint);
+		}
+
+	}
+
+	/////////////////////////////////////////////////////////////////////////////
+	//////////////////////////// Internal Component Copying ///////////////////
+	//TODO Faults ??
+	public void populateOperations(WSDLOperation wsdlOperation,
+			Operation wsdl4jOperation, String nameSpaceOfTheOperation) {
+		//Copy Name Attrebute
+		wsdlOperation.setName(new QName(nameSpaceOfTheOperation,
+				wsdl4jOperation.getName()));
+
+		//OperationType wsdl4jOperation.getStyle()
+
+		// Create the Input Message and add
+
+		Input wsdl4jInputMessage = wsdl4jOperation.getInput();
+		MessageReference wsdlInputMessage = this.wsdlComponenetFactory.createMessageReference();
+		wsdlInputMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
+
+		//Get all the in parts and create a new Element out of it and add it to
+		// the Types.
+		//TODO
+
+		wsdlInputMessage.setMessageLabel(wsdl4jInputMessage.getName());
+		//wsdlInputMessage.setElement(wsdl4jInputMessage.getMessage())
+
+		//       	wsdlInputMessage.setMessageLabel()
+
+		//Create an output message and add
+		Output wsdl4jOutputMessage = wsdl4jOperation.getOutput();
+		MessageReference wsdlOutputMessage = this.wsdlComponenetFactory.createMessageReference();
+		wsdlOutputMessage
+				.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
+		//Get all the in parts and create a new Element out of it and add it to
+		// the Types.
+		//TODO
+
+		//wsdlInputMessage.setMessageLabel()
+
+		//Set the MEP
+		wsdlOperation.setMessageExchangePattern(WSDL11MEPFinder
+				.getMEP(wsdl4jOperation));
+
+	}
+
+	private void populateBindingOperation(
+			WSDLBindingOperation wsdlBindingOperation,
+			BindingOperation wsdl4jBindingOperation,
+			String nameSpaceOfTheBindingOperation) {
+		wsdlBindingOperation.setName(new QName(nameSpaceOfTheBindingOperation,
+				wsdl4jBindingOperation.getName()));
+
+		BindingInput wsdl4jInputBinding = wsdl4jBindingOperation
+				.getBindingInput();
+		WSDLBindingMessageReference wsdlInputBinding = this.wsdlComponenetFactory.createWSDLBindingMessageReference();
+
+		wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
+		//TODO
+		wsdlBindingOperation.setInput(wsdlInputBinding);
+
+		BindingOutput wsdl4jOutputBinding = wsdl4jBindingOperation
+				.getBindingOutput();
+		WSDLBindingMessageReference wsdlOutputBinding = this.wsdlComponenetFactory.createWSDLBindingMessageReference();
+
+		wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
+		//TODO
+		wsdlBindingOperation.setInput(wsdlOutputBinding);
+
+	}
+
+	public void populatePorts(WSDLEndpoint wsdlEndpoint, Port wsdl4jPort,
+			String targetNamspace) {
+		wsdlEndpoint.setName(new QName(targetNamspace, wsdl4jPort.getName()));
+
+		wsdlEndpoint.setBinding(this.womDefinition.getBinding(wsdl4jPort
+				.getBinding().getQName()));
+		///Extesibility elements.
+	}
+
+	//    ///////////////////////////Util Methods
+	// ////////////////////////////////////
+	//   
+	//    /**
+	//     * Will return the URI for the MEP. if null will retun the IN_OUT as
+	// default
+	//     * pattern.
+	//     */
+	//    private String getRelaventMEPForTheMessageStyle(OperationType
+	// operationType) {
+	//
+	//        if (null != operationType) {
+	//
+	//            if (operationType.equals(OperationType.REQUEST_RESPONSE))
+	//                return WSDLConstants.MEP_URI_IN_OUT;
+	//
+	//            if (operationType.equals(OperationType.ONE_WAY))
+	//                return WSDLConstants.MEP_URI_IN_ONLY;
+	//
+	//            if (operationType.equals(OperationType.NOTIFICATION))
+	//                return WSDLConstants.MEP_URI_OUT_ONLY;
+	//
+	//            if (operationType.equals(OperationType.SOLICIT_RESPONSE))
+	//                return WSDLConstants.MEP_URI_OUT_IN;
+	//        }
+	//        //TODO
+	//        return WSDLConstants.MEP_URI_OUT_IN;
+	//    }
+
+	/**
+	 * This method will fill up the gap of WSDL 1.1 and WSDL 2.0 w.r.t. the
+	 * bound interface for the Service Component Defined in the WSDL 2.0. Logic
+	 * being if there exist only one PortType in the WSDL 1.1 file then that
+	 * will be set as the bound interface of the Service. If more than one
+	 * Porttype exist in the WSDl 1.1 file this will create a dummy Interface
+	 * with the available PortTypes and will return that interface so that it
+	 * will inherit all those interfaces.
+	 * 
+	 * Eventuall this will have to be fixed using user input since
+	 * 
+	 * @param service
+	 * @return
+	 */
+	private WSDLInterface getBoundInterface(WSDLService service) {
+
+		// Throw an exception if there are no interfaces defined as at yet.
+		if (0 == this.womDefinition.getWsdlInterfaces().size())
+			throw new WSDLProcessingException(
+					"There are no "
+							+ "Interfaces/PortTypes identified in the current partially built"
+							+ "WOM");
+
+		//If there is only one Interface available hten return that because
+		// normally
+		// that interface must be the one to the service should get bound.
+		if (1 == this.womDefinition.getWsdlInterfaces().size())
+			return (WSDLInterface) this.womDefinition.getWsdlInterfaces()
+					.values().iterator().next();
+
+		//If there are more than one interface available... For the time being
+		// create a
+		// new interface and set all those existing interfaces as
+		// superinterfaces of it
+		// and return.
+		WSDLInterface newBoundInterface = this.womDefinition.createInterface();
+		newBoundInterface.setName(new QName(service.getNamespace(), service
+				.getName().getLocalPart()
+				+ BOUND_INTERFACE_NAME));
+		Iterator interfaceIterator = this.womDefinition.getWsdlInterfaces()
+				.values().iterator();
+		while (interfaceIterator.hasNext()) {
+			newBoundInterface
+					.addSuperInterface((WSDLInterface) interfaceIterator.next());
+		}
+		return newBoundInterface;
+	}
+
+}
\ No newline at end of file

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java Wed Apr  6 23:26:51 2005
@@ -16,13 +16,16 @@
 package org.apache.wsdl;
 
 import javax.xml.namespace.QName;
+
+import org.apache.axis.wsdl.builder.WSDLComponentFactory;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 
 /**
  * @author chathura@opensource.lk
  */
-public interface WSDLDescription extends Component {
+public interface WSDLDescription extends Component, WSDLComponentFactory {
     /**
      * Returns a Map of <code>WSDLBindings</code> Objects keyed by the <code>QName</code>
      * of the Binding.

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLService.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLService.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLService.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLService.java Wed Apr  6 23:26:51 2005
@@ -52,7 +52,7 @@
      * @param qName qName of the Service
      * @return WSDLService Object or will throw an WSDLProcessingException in the case of object not found.
      */
-    public WSDLService getEndpoint(QName qName);
+    public WSDLEndpoint getEndpoint(QName qName);
 
     /**
      * Method getName

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?view=diff&r1=160374&r2=160375
==============================================================================
--- 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 Apr  6 23:26:51 2005
@@ -15,9 +15,18 @@
  */
 package org.apache.wsdl.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+
+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.WSDLExtensibilityElement;
 import org.apache.wsdl.WSDLFault;
 import org.apache.wsdl.WSDLFeature;
 import org.apache.wsdl.WSDLImport;
@@ -28,10 +37,6 @@
 import org.apache.wsdl.WSDLService;
 import org.apache.wsdl.WSDLTypes;
 
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.HashMap;
-
 /**
  * @author chathura@opensource.lk
  */
@@ -466,4 +471,20 @@
     public WSDLProperty createProperty() {
         return new WSDLPropertyImpl();
     }
+    
+    public MessageReference createMessageReference(){
+		return new MessageReferenceImpl();
+	}
+	
+	public WSDLBindingMessageReference createWSDLBindingMessageReference(){
+		return new WSDLBindingMessageReferenceImpl();
+	}
+	
+	public WSDLBindingOperation createWSDLBindingOperation(){
+		return new WSDLBindingOperationImpl();
+	}
+	
+	public WSDLExtensibilityElement createWSDLExtensibilityElement(){
+		return new WSDLExtensibilityElementImpl();
+	}
 }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLServiceImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLServiceImpl.java?view=diff&r1=160374&r2=160375
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLServiceImpl.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLServiceImpl.java Wed Apr  6 23:26:51 2005
@@ -75,10 +75,10 @@
      * @param qName qname of the Service
      * @return WSDLService Object or will throw an WSDLProcessingException in the case of object not found.
      */
-    public WSDLService getEndpoint(QName qName) {
-        WSDLService temp = (WSDLService) this.endpoints.get(qName);
+    public WSDLEndpoint getEndpoint(QName qName) {
+    	WSDLEndpoint temp = (WSDLEndpoint) this.endpoints.get(qName);
         if (null == temp) {
-            throw new WSDLProcessingException("Service not found for NCName "
+            throw new WSDLProcessingException("Endpoint not found for qname "
                             + qName);
         }
         return temp;



Mime
View raw message