axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r398950 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/schema/template/ codegen/src/org/apache/axis2/wsdl/codegen/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/codegen/writer...
Date Tue, 02 May 2006 14:50:40 GMT
Author: ajith
Date: Tue May  2 07:50:17 2006
New Revision: 398950

URL: http://svn.apache.org/viewcvs?rev=398950&view=rev
Log:
1. Introduced the generation of a Skeleton interface. The class that is used in the message
receiver is the interface rather than the concrete implementation. However the services.xml
still has the skeleton implementation name. (to solve the blocker 655)
2. Fixed the testcase to suit the change

Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SkeletonInterfaceWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
    webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeSkeleton.java
    webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeSkeleton.java
    webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/oasis/ping/PingPortSkeleton.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
Tue May  2 07:50:17 2006
@@ -457,8 +457,8 @@
         // of commons and so cannot just be fixed in axis2.  This method should be removed
and the calls to it below replaced with
         // simple calls to getElementText() as soon as this serious bug can be fixed.
 
-        private static String getElementTextProperly(javax.xml.stream.XMLStreamReader reader)
throws java.lang.Exception {
-            String value = reader.getElementText();
+        private static java.lang.String getElementTextProperly(javax.xml.stream.XMLStreamReader
reader) throws java.lang.Exception {
+            java.lang.String value = reader.getElementText();
             while (!reader.isEndElement())
                 reader.next();
             return value;
@@ -723,7 +723,7 @@
                                 <!-- end of OMelement handling -->
                                 <!-- start of the simple types handling -->
                                 <xsl:otherwise>
-                                    String content = getElementTextProperly(reader);
+                                    java.lang.String content = getElementTextProperly(reader);
                                     object.set<xsl:value-of select="$javaName"/>(
                                         org.apache.axis2.databinding.utils.ConverterUtil.convertTo<xsl:value-of
select="$shortTypeName"/>(content));
                                     <xsl:if test="$isType or $anon">  <!-- This
is a subelement property to be consumed -->

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
Tue May  2 07:50:17 2006
@@ -108,7 +108,7 @@
                 optionMap);
         if (ns2packageOption != null) {
             //the syntax for the value of the namespaces and packages is
-            //to be a comma seperated list with uri,packagename,uri,packagename...
+            //to be a comma seperated list with uri=packagename,uri=packagename...
             String value = ns2packageOption.getOptionValue();
             if (value != null) {
                 // Try treating the values as a name=value pair separated by comma's

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
Tue May  2 07:50:17 2006
@@ -58,6 +58,7 @@
 java.bean.template=org.apache.axis2.wsdl.codegen.writer.BeanWriter,/org/apache/axis2/wsdl/template/java/BeanTemplate.xsl
 java.callback.template=org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter,/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl
 java.skeleton.template=org.apache.axis2.wsdl.codegen.writer.SkeletonWriter,/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
+java.skeleton.interface.template=org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter,/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
 java.testclass.template=org.apache.axis2.wsdl.codegen.writer.TestClassWriter,/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl
 java.service.template=org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter,/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
 java.message.receiver.template=org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter,/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
Tue May  2 07:50:17 2006
@@ -72,6 +72,7 @@
     private static final String STUB_SUFFIX = "Stub";
     private static final String TEST_SUFFIX = "Test";
     private static final String SKELETON_CLASS_SUFFIX = "Skeleton";
+    private static final String SKELETON_INTERFACE_SUFFIX = "SkeletonInterface";
     private static final String MESSAGE_RECEIVER_SUFFIX = "MessageReceiver";
     private static final String FAULT_SUFFIX = "Exception";
     private static final String DATABINDING_SUPPORTER_NAME_SUFFIX = "DatabindingSupporter";
@@ -689,6 +690,9 @@
         generateAndPopulateFaultNames();
         updateFaultPackageForSkeleton();
 
+        //write skeletonInterface
+        writeSkeletonInterface();
+
         // write skeleton
         writeSkeleton();
 
@@ -702,7 +706,7 @@
         writeAntBuild();
 
         //for the server side codegen
-        //we need to seriali
+        //we need to serialize the WSDL's
         writeWSDLFiles();
     }
 
@@ -822,6 +826,9 @@
 
         addAttribute(doc, "name", localPart + MEPtoSuffixMap.get(mep), rootElement);
         addAttribute(doc, "skeletonname", localPart + SKELETON_CLASS_SUFFIX, rootElement);
+         addAttribute(doc, "skeletonInterfaceName", localPart + SKELETON_INTERFACE_SUFFIX,
+                rootElement);
+
         addAttribute(doc, "basereceiver", (String) MEPtoClassMap.get(mep), rootElement);
         fillSyncAttributes(doc, rootElement);
 
@@ -1080,6 +1087,20 @@
         writeClass(skeletonModel, skeletonWriter);
     }
 
+    /**
+     * Write the skeletonInterface
+     * @throws Exception
+     */
+     private void writeSkeletonInterface() throws Exception {
+        Document skeletonModel = createDOMDocumentForSkeletonInterface();
+        debugLogDocument("Document for skeleton Interface:", skeletonModel);
+        ClassWriter skeletonInterfaceWriter = new SkeletonInterfaceWriter(getOutputDirectory(this.codeGenConfiguration.getOutputLocation(),
+                "src"), this.codeGenConfiguration.getOutputLanguage());
+
+        writeClass(skeletonModel, skeletonInterfaceWriter);
+    }
+
+
     private Document createDOMDocumentForSkeleton() {
         Document doc = getEmptyDocument();
         Element rootElement = doc.createElement("interface");
@@ -1089,7 +1110,8 @@
         addAttribute(doc, "name", serviceName + SKELETON_CLASS_SUFFIX, rootElement);
         addAttribute(doc, "callbackname", serviceName + CALL_BACK_HANDLER_SUFFIX,
                 rootElement);
-
+        addAttribute(doc, "skeletonInterfaceName", serviceName + SKELETON_INTERFACE_SUFFIX,
+                rootElement);
         fillSyncAttributes(doc, rootElement);
         loadOperations(doc, rootElement, null);
 
@@ -1097,14 +1119,30 @@
         rootElement.appendChild(getUniqueListofFaults(doc));
 
         doc.appendChild(rootElement);
-
-        /////////////////////////////////////////////////////
-        //System.out.println(DOM2Writer.nodeToString(rootElement));
-        /////////////////////////////////////////////////////
-
         return doc;
 
     }
+
+    private Document createDOMDocumentForSkeletonInterface() {
+            Document doc = getEmptyDocument();
+            Element rootElement = doc.createElement("interface");
+
+            String serviceName = makeJavaClassName(axisService.getName());
+            addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement);
+            addAttribute(doc, "name", serviceName + SKELETON_INTERFACE_SUFFIX, rootElement);
+            addAttribute(doc, "callbackname", serviceName + CALL_BACK_HANDLER_SUFFIX,
+                    rootElement);
+
+            fillSyncAttributes(doc, rootElement);
+            loadOperations(doc, rootElement, null);
+
+            //attach a list of faults
+            rootElement.appendChild(getUniqueListofFaults(doc));
+
+            doc.appendChild(rootElement);
+            return doc;
+
+        }
 
     private boolean loadOperations(Document doc, Element rootElement, String mep) {
         Element methodElement;

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SkeletonInterfaceWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SkeletonInterfaceWriter.java?rev=398950&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SkeletonInterfaceWriter.java
(added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/SkeletonInterfaceWriter.java
Tue May  2 07:50:17 2006
@@ -0,0 +1,32 @@
+package org.apache.axis2.wsdl.codegen.writer;
+
+import java.io.File;
+/*
+ * 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.
+ */
+
+public class SkeletonInterfaceWriter extends ClassWriter {
+
+
+    public SkeletonInterfaceWriter(String outputFileLocation) {
+        this.outputFileLocation = new File(outputFileLocation);
+    }
+
+    public SkeletonInterfaceWriter(File outputFileLocation, String language) {
+        this.outputFileLocation = outputFileLocation;
+        this.language = language;
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
Tue May  2 07:50:17 2006
@@ -13,7 +13,7 @@
     <!--Template for in out message receiver -->
     <xsl:template match="/interface[@basereceiver='org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver']">
 
-        <xsl:variable name="skeletonname"><xsl:value-of select="@skeletonname"/></xsl:variable>
+        <xsl:variable name="skeletonname"><xsl:value-of select="@skeletonInterfaceName"/></xsl:variable>
         <xsl:variable name="dbsupportpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
 
         /**

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl?rev=398950&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
(added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
Tue May  2 07:50:17 2006
@@ -0,0 +1,39 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    <xsl:template match="/interface">
+    /**
+     * <xsl:value-of select="@name"/>.java
+     *
+     * This file was auto-generated from WSDL
+     * by the Apache Axis2 version: #axisVersion# #today#
+     */
+    package <xsl:value-of select="@package"/>;
+    /**
+     *  <xsl:value-of select="@name"/> java skeleton interface for the axisService
+     */
+    public interface <xsl:value-of select="@name"></xsl:value-of> {
+     <xsl:for-each select="method">
+         <xsl:variable name="count"><xsl:value-of select="count(output/param)"/></xsl:variable>
+         <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"/></xsl:variable>
+		 <!-- regardless of the sync or async status, the generated method signature would be
just a usual
+	           java method -->
+        /**
+         * Auto generated method signature
+         <!--  select only the body parameters  -->
+          <xsl:for-each select="input/param[@location='body']">
+            <xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+         </xsl:text></xsl:if></xsl:for-each>
+         */
+        public  <xsl:if test="$count=0 or $outputtype=''">void</xsl:if><xsl:if
test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text>
</xsl:text><xsl:value-of select="@name"/>
+                  (<xsl:for-each select="input/param[@location='body']">
+            <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of
select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/></xsl:if>
+                   </xsl:for-each> )
+         <!--add the faults-->
+           <xsl:for-each select="fault/param[@type!='']">
+               <xsl:if test="position()=1">throws </xsl:if>
+               <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/>
+           </xsl:for-each>;
+     </xsl:for-each>
+    }
+    </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
Tue May  2 07:50:17 2006
@@ -11,7 +11,7 @@
     /**
      *  <xsl:value-of select="@name"/> java skeleton for the axisService
      */
-    public class <xsl:value-of select="@name"></xsl:value-of> {
+    public class <xsl:value-of select="@name"></xsl:value-of> implements <xsl:value-of
select="@skeletonInterfaceName"/>{
      <xsl:for-each select="method">
          <xsl:variable name="count"><xsl:value-of select="count(output/param)"/></xsl:variable>
          <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"/></xsl:variable>

Modified: webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeSkeleton.java?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeSkeleton.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf/PerfPortTypeSkeleton.java
Tue May  2 07:50:17 2006
@@ -7,7 +7,7 @@
 /**
  * PerfPortTypeSkeleton java skeleton for the axisService
  */
-public class PerfPortTypeSkeleton {
+public class PerfPortTypeSkeleton implements PerfPortTypeSkeletonInterface {
     /**
      * Auto generated method signature
      *

Modified: webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeSkeleton.java?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeSkeleton.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/samples/wsdl/perf2/PerfPortTypeSkeleton.java
Tue May  2 07:50:17 2006
@@ -7,7 +7,7 @@
 /**
  * PerfPortTypeSkeleton java skeleton for the axisService
  */
-public class PerfPortTypeSkeleton {
+public class PerfPortTypeSkeleton implements PerfPortTypeSkeletonInterface {
     /**
      * Auto generated method signature
      *

Modified: webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/oasis/ping/PingPortSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/oasis/ping/PingPortSkeleton.java?rev=398950&r1=398949&r2=398950&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/oasis/ping/PingPortSkeleton.java
(original)
+++ webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/oasis/ping/PingPortSkeleton.java
Tue May  2 07:50:17 2006
@@ -17,7 +17,7 @@
 /**
  * Auto generated java skeleton for the service by the Axis code generator
  */
-public class PingPortSkeleton {
+public class PingPortSkeleton implements PingPortSkeletonInterface{
 
     private MessageContext mc;
 



Mime
View raw message