axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r349384 - in /webservices/axis2/trunk/java/modules/codegen: src/org/apache/axis2/databinding/schema/ src/org/apache/axis2/databinding/schema/template/ src/org/apache/axis2/databinding/schema/types/ test/org/apache/axis2/databinding/schema/c...
Date Mon, 28 Nov 2005 05:49:20 GMT
Author: ajith
Date: Sun Nov 27 21:48:52 2005
New Revision: 349384

URL: http://svn.apache.org/viewcvs?rev=349384&view=rev
Log:
1. Updated the Template names
2. Added a new template to generate plain beans
3. Added a new test case to test the imports and the BaseURI code

Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/ADBBeanTemplate.xsl
      - copied, changed from r349077, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/PlainBeanTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/ImportTest.java
Removed:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/schema-compile.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/types/package.html
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/AbstractSchemaCompilerTester.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java?rev=349384&r1=349383&r2=349384&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
Sun Nov 27 21:48:52 2005
@@ -508,6 +508,7 @@
      */
     private void processSimpleSchemaType(XmlSchemaSimpleType simpleType){
         //nothing to here yet.
+        //todo need to populate the processed type map here
 
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/schema-compile.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/schema-compile.properties?rev=349384&r1=349383&r2=349384&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/schema-compile.properties
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/schema-compile.properties
Sun Nov 27 21:48:52 2005
@@ -10,8 +10,9 @@
 # bean writer template
 # The bean writers template is it's own responsibilty. (A bean writer provider
 # may choose not to use a template at all!) However the property loader will
-# load the followiing template (reference) and provide it in case the bean writer is
-# not hard bound to a template
-schema.bean.writer.template=/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
+# load the followiing template (reference) and provide it and in the case when the
+# bean writer is not statically bound to a template, this'll be useful.
+schema.bean.writer.template=/org/apache/axis2/databinding/schema/template/ADBBeanTemplate.xsl
+#schema.bean.writer.template=/org/apache/axis2/databinding/schema/template/PlainBeanTemplate.xsl
 # The type map to be used by the schema compiler
 schema.bean.typemap=org.apache.axis2.databinding.schema.typemap.JavaTypeMap

Copied: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/ADBBeanTemplate.xsl
(from r349077, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/ADBBeanTemplate.xsl?p2=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/ADBBeanTemplate.xsl&p1=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl&r1=349077&r2=349384&rev=349384&view=diff
==============================================================================
    (empty)

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/PlainBeanTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/PlainBeanTemplate.xsl?rev=349384&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/PlainBeanTemplate.xsl
(added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/PlainBeanTemplate.xsl
Sun Nov 27 21:48:52 2005
@@ -0,0 +1,80 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    <xsl:template match="/bean">
+        /**
+        * <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:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
+
+        /**
+        *  <xsl:value-of select="$name"/> bean class
+        */
+
+        public class <xsl:value-of select="$name"/> <xsl:if test="@extension">
extends <xsl:value-of select="@extension"/></xsl:if>{
+
+        <xsl:choose>
+            <xsl:when test="@type">/* This type was generated from the piece of schema
that had
+                name = <xsl:value-of select="@originalName"/>
+                Namespace URI = <xsl:value-of select="@nsuri"/>
+                Namespace Prefix = <xsl:value-of select="@nsprefix"/>
+                */
+            </xsl:when>
+            <xsl:otherwise>
+                public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
+                "<xsl:value-of select="@nsuri"/>",
+                "<xsl:value-of select="@originalName"/>",
+                "<xsl:value-of select="@nsprefix"/>");
+
+            </xsl:otherwise>
+        </xsl:choose>
+
+
+        <xsl:for-each select="property">
+            <xsl:variable name="propertyType"><xsl:value-of select="@type"></xsl:value-of></xsl:variable>
+            <xsl:variable name="propertyName"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
+            <xsl:variable name="javaName"><xsl:value-of select="@javaname"></xsl:value-of></xsl:variable>
+            <xsl:variable name="varName">local<xsl:value-of select="$javaName"/></xsl:variable>
+            /**
+            * field for <xsl:value-of select="$javaName"/>
+            <xsl:if test="@attribute">* This was an Attribute!</xsl:if>
+            <xsl:if test="@array">* This was an Array!</xsl:if>
+
+            */
+            private <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text><xsl:value-of
select="$varName" /> ;
+
+            /**
+            * Auto generated getter method
+            * @return <xsl:value-of select="$propertyType"/>
+            */
+            public  <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text>get<xsl:value-of
select="$javaName"/>(){
+            return <xsl:value-of select="$varName"/>;
+            }
+
+            /**
+            * Auto generated setter method
+            * @param param<xsl:value-of select="$javaName"/>
+            */
+            public void set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/>
param){
+            <!--Add the validation code. For now we only add the validation code for arrays-->
+            <xsl:if test="@array">
+                <xsl:if test="not(@unbound)">
+                    if (param.length &gt; <xsl:value-of select="@maxOccurs"></xsl:value-of>){
+                    throw new java.lang.RuntimeException();
+                    }
+                </xsl:if>
+                <xsl:if test="@minOccurs">
+                    if (param.length &lt; <xsl:value-of select="@minOccurs"></xsl:value-of>){
+                    throw new java.lang.RuntimeException();
+                    }
+                </xsl:if>
+            </xsl:if>
+            this.<xsl:value-of select="$varName"/>=param;
+            }
+        </xsl:for-each>
+        }
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/types/package.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/types/package.html?rev=349384&r1=349383&r2=349384&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/types/package.html
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/types/package.html
Sun Nov 27 21:48:52 2005
@@ -1,5 +1,5 @@
 <html>
 <body>
- These classes are directly salvaged from Axis 1 codebase. Original author comments has been
reserved! 
+ These classes are directly salvaged from Axis 1 codebase. Original author comments have
been preserved! 
 </body>
 </html>

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/AbstractSchemaCompilerTester.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/AbstractSchemaCompilerTester.java?rev=349384&r1=349383&r2=349384&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/AbstractSchemaCompilerTester.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/AbstractSchemaCompilerTester.java
Sun Nov 27 21:48:52 2005
@@ -49,7 +49,7 @@
         Document doc = builder.parse(new File(fileName));
 
         //now read it to a schema
-        XmlSchemaCollection schemaCol =  new XmlSchemaCollection();
+        XmlSchemaCollection schemaCol =  getSchemaReader();
         currentSchema = schemaCol.read(doc,null);
 
         outputFolder = new File(TEMP_OUT_FOLDER);
@@ -63,7 +63,9 @@
         }
     }
 
-
+    protected  XmlSchemaCollection getSchemaReader(){
+        return new XmlSchemaCollection();
+    }
 
     public void testSchema() throws Exception{
         SchemaCompiler compiler = new SchemaCompiler( new CompilerOptions().setOutputLocation(outputFolder));

Added: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/ImportTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/ImportTest.java?rev=349384&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/ImportTest.java
(added)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/schema/compile/ImportTest.java
Sun Nov 27 21:48:52 2005
@@ -0,0 +1,31 @@
+package org.apache.axis2.databinding.schema.compile;
+
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+/*
+ * 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 ImportTest extends AbstractSchemaCompilerTester{
+    protected void setUp() throws Exception {
+        this.fileName = "test-resources/xsd/import.xsd";
+        super.setUp();
+    }
+
+    protected XmlSchemaCollection getSchemaReader() {
+        XmlSchemaCollection reader = new XmlSchemaCollection();
+        reader.setBaseUri("test-resources/xsd");
+        return reader;
+    }
+}



Mime
View raw message