Author: jbonofre
Date: Wed Jul 29 11:54:21 2009
New Revision: 798863

URL: http://svn.apache.org/viewvc?rev=798863&view=rev
Log:
Revert to WSDL 1.0 version and create an abstract WSDL.

Modified:
    
servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java
    
servicemix/components/engines/servicemix-exec/trunk/src/main/resources/servicemix-exec.wsdl

Modified: 
servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java?rev=798863&r1=798862&r2=798863&view=diff
==============================================================================
--- 
servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java
 (original)
+++ 
servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java
 Wed Jul 29 11:54:21 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.servicemix.exec;
 
+import javax.jbi.management.DeploymentException;
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOut;
 import javax.jbi.messaging.MessageExchange;
@@ -41,10 +42,10 @@
  */
 public class ExecEndpoint extends ProviderEndpoint {
     
-    // the default WSDL name (in the classpath)
-    public final static String DEFAULT_WSDL = "servicemix-exec.wsdl";
+    public final static String DEFAULT_WSDL = "servicemix-exec.wsdl"; // the 
default abstract endpoint WSDL
 
        private String command; // the command can be static (define in the 
descriptor) or provided in the incoming message
+       private Resource wsdl; // the abstract WSDL describing the endpoint 
behavior
        private ExecMarshalerSupport marshaler = new DefaultExecMarshaler(); // 
the default exec marshaler
 
        public String getCommand() {
@@ -67,6 +68,21 @@
        public ExecMarshalerSupport getMarshaler() {
                return marshaler;
        }
+       
+       public Resource getWsdl() {
+           return this.wsdl;
+       }
+       
+       /**
+        * <p>
+        * This attribute specifies the abstract WSDL describing the endpoint 
behavior.
+        * </p>
+        * 
+        * @param wsdl the WSDL <code>Resource</code>.
+        */
+       public void setWsdl(Resource wsdl) {
+           this.wsdl = wsdl;
+       }
 
        /**
         * <p>
@@ -87,23 +103,26 @@
        
        /*
         * (non-Javadoc)
-        * @see 
org.apache.servicemix.common.endpoints.ProviderEndpoint#activate()
+        * @see 
org.apache.servicemix.common.endpoints.AbstractEndpoint#validate()
         */
        @Override
-       public void activate() throws Exception {
-           // get the WSDL resource
-           //Resource wsdl = new ClassPathResource(DEFAULT_WSDL);
-           
-           // parse the WSDL to populate the endpoint description
-           //description = DomUtil.parse(wsdl.getInputStream());
-           // extract the WSDL definition from the description
-           //definition = 
javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(null, 
description);
-           
-           // TODO override WSDL attributes (binding, service name, etc) using 
the endpoint configuration
-           // (contained in the xbean.xml)
-           // it should use PortTypeDecorator.decorate()
+       public void validate() throws DeploymentException {
+           try {
+               if (wsdl != null) {
+                   // the user provides a WSDL
+                   description = DomUtil.parse(wsdl.getInputStream());
+                   definition = 
javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(null, 
description);
+               } else {
+                   // load the default abstract WSDL
+                   description = DomUtil.parse(new 
ClassPathResource(DEFAULT_WSDL).getInputStream());
+                   definition = 
javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(null, 
description);
+                   // TODO cleanup in WSDL definitions to use endpoint 
properties (service/endpoint)
+               }
+           } catch (Exception e) {
+               throw new DeploymentException("Can't load the WSDL.", e);
+           }
            
-           super.activate();
+           // TODO validate used WSDL
        }
 
        /*

Modified: 
servicemix/components/engines/servicemix-exec/trunk/src/main/resources/servicemix-exec.wsdl
URL: 
http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-exec/trunk/src/main/resources/servicemix-exec.wsdl?rev=798863&r1=798862&r2=798863&view=diff
==============================================================================
--- 
servicemix/components/engines/servicemix-exec/trunk/src/main/resources/servicemix-exec.wsdl
 (original)
+++ 
servicemix/components/engines/servicemix-exec/trunk/src/main/resources/servicemix-exec.wsdl
 Wed Jul 29 11:54:21 2009
@@ -1,42 +1,54 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<wsdl:description name="servicemix-exec"
-                  targetNamespace="http://servicemix.apache.org/exec";
-                  xmlns:wsdl="http://www.w3.org/2006/01/wsdl";
-                  xmlns:tns="http://servicemix.apache.org/exec";
-                  xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
-                  
-    <wsdl:description>
-        Abstract WSDL for the servicemix-exec component.
-    </wsdl:description>                  
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions name="servicemix-exec" 
targetNamespace="http://servicemix.apache.org/exec";
+    xmlns:tns="http://servicemix.apache.org/exec";
+    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
     
     <wsdl:types>
         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
-                   targetNamespace="http://servicemix.apache.org/exec";
-                   xmlns="http://servicemix.apache.org/exec";>
-            
+                attributeFormDefault="unqualified"
+                elementFormDefault="unqualified"
+                targetNamespace="http://servicemix.apache.org/exec";
+                xmlns:tns="http://servicemix.apache.org/exec";>
             <xs:element name="Command" type="xs:string"/>
-            
-            <xs:element name="ExecutionData" type="TypeExecutionData"/>
-            <xs:complexType name="TypeExecutionData">
-                <xs:sequence>
-                    <xs:element name="output" type="xs:string"/>
-                    <xs:element name="error" type="xs:string"/>
-                    <xs:element name="returnCode" type="xs:integer"/>          
      
-                </xs:sequence>    
+            <xs:element name="CommandResponse" type="tns:ExecutionData"/>
+            <xs:complexType name="ExecutionData">
+                <xs:element name="output" type="xs:string"/>
             </xs:complexType>
-                       
         </xs:schema>
     </wsdl:types>
     
-    <wsdl:interfaces>
-        <wsdl:interface name="executeInterface">
-            <wsdl:fault name="executionFault" element="xs:string"/>
-            <wsdl:operation name="execute" 
pattern="http://www.w3.org/ns/wsdl/in-out";
-                       style="http://www.w3.org/ns/wsdl/style/iri";>
-                <wsdl:input messageLabel="In" element="Command"/>
-                <wsdl:output messageLabel="Out" element="ExecutionData"/>      
                 
-            </wsdl:operation>                  
-        </wsdl:interface>
-    </wsdl:interfaces>
-                  
-</wsdl:description>               
\ No newline at end of file
+    <wsdl:message name="ExecuteCommandIn">
+        <wsdl:part name="body" element="tns:ExecuteCommand"/>
+    </wsdl:message>
+    
+    <wsdl:message name="ExecuteCommandOut">
+        <wsdl:part name="body" element="tns:ExecuteCommandResponse"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="ExecPortType">
+        <wsdl:operation name="ExecutionCommand">
+            <wsdl:input message="tns:Command"/>
+            <wsdl:output message="tns:CommandResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    
+</wsdl:definitions>             
\ No newline at end of file


Reply via email to