axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r358514 - in /webservices/axis2/trunk/java: ./ modules/codegen/src/org/apache/axis2/schema/ modules/codegen/src/org/apache/axis2/schema/writer/ modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/ modules/codegen/src/org/apache/axis...
Date Thu, 22 Dec 2005 06:58:41 GMT
Author: ajith
Date: Wed Dec 21 22:58:22 2005
New Revision: 358514

URL: http://svn.apache.org/viewcvs?rev=358514&view=rev
Log:
1. Updated the schemacompiler to push out a model map when asked not to write classes - halfway
through the change to implement a single class stub
2. Updated the maven build to copy adb classes into the generated jar
3. Updated the ADB supporter template slightly 

Removed:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DefaultDataBindingSupporterTemplate.xsl
Modified:
    webservices/axis2/trunk/java/maven.xml
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/CompilerOptions.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/XSD2Java.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl

Modified: webservices/axis2/trunk/java/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/maven.xml?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/maven.xml (original)
+++ webservices/axis2/trunk/java/maven.xml Wed Dec 21 22:58:22 2005
@@ -327,6 +327,7 @@
             <fileset dir="modules/common/target/classes"/>
             <fileset dir="modules/addressing/target/classes"/>
             <fileset dir="modules/codegen/target/classes"/> 
+            <fileset dir="modules/adb/target/classes"/>
             <fileset dir="modules/addressing/target/">
                 <include name="modules/addressing.mar"/>
             </fileset>
@@ -504,6 +505,7 @@
                 <ant:pathelement location="modules/tool/src"/>
                 <ant:pathelement location="modules/wsdl/src"/>
                 <ant:pathelement location="modules/xml/src"/>
+                <ant:pathelement location="modules/adb/src"/> 
             </ant:sourcepath>
             <ant:classpath>
               <ant:fileset dir="target/lib">

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/CompilerOptions.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/CompilerOptions.java?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/CompilerOptions.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/CompilerOptions.java
Wed Dec 21 22:58:22 2005
@@ -36,7 +36,7 @@
     /**
      * This flag tells the databinder to either write the output or
      * not. if this is set to true it will write the output at once.
-     * if not  ???
+     * if not the outputter will populate the 
      */
     private boolean writeOutput = false;
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java
Wed Dec 21 22:58:22 2005
@@ -78,6 +78,10 @@
         return processedElementMap;
     }
 
+    public Map getProcessedModelMap() {
+        return writer.getModelMap();
+    }
+
     /**
      * Constructor - Accepts a options bean
      *

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/XSD2Java.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/XSD2Java.java?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/XSD2Java.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/XSD2Java.java
Wed Dec 21 22:58:22 2005
@@ -74,7 +74,8 @@
             compilerOptions.setOutputLocation(outputFolder);
             //##############################
             // compilerOptions.setPackageName("adb");
-            //  compilerOptions.setWrapClasses(true);
+             compilerOptions.setWrapClasses(false);
+             compilerOptions.setWriteOutput(true);
             //##############################
 
             SchemaCompiler compiler = new SchemaCompiler(compilerOptions);

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
Wed Dec 21 22:58:22 2005
@@ -47,6 +47,12 @@
     public void writeBatch() throws SchemaCompilationException;
 
     /**
+     * Gets a map of models. this is useful for tight integrations where the internal workings
+     * of the schema compiler may be exposed.
+     */
+    public Map getModelMap();
+
+    /**
      * Write a complex type
      *
      * @param complexType

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
Wed Dec 21 22:58:22 2005
@@ -29,6 +29,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.HashMap;
 
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
@@ -59,24 +60,47 @@
 
     private List namesList;
     private static int count = 0;
-    private boolean wrapClasses;
+    private boolean wrapClasses = false;
+    private boolean writeClasses=false;
 
     private String packageName = null;
     private File rootDir;
 
     private Document globalWrappedDocument;
 
+    private Map modelMap = new HashMap();
+
     /**
      * Default constructor
      */
     public JavaBeanWriter() {
     }
 
+    /**
+     * This returns a map of Qnames vs DOMDocument models. One can use this method to
+     * obtain the raw DOMmodels used to write the classes.
+     * This has no meaning when the classes are supposed to be wrapped  so the
+     *
+     * @see org.apache.axis2.schema.writer.BeanWriter#getModelMap()
+     * @return
+     * @throws SchemaCompilationException
+     */
+    public Map getModelMap(){
+        return modelMap;
+    }
+
     public void init(CompilerOptions options) throws SchemaCompilationException {
         try {
             initWithFile(options.getOutputLocation());
-            this.packageName = options.getPackageName();
-            this.wrapClasses = options.isWrapClasses();
+            packageName = options.getPackageName();
+            writeClasses = options.isWriteOutput();
+            if (!writeClasses){
+                wrapClasses = false;
+            }else{
+                wrapClasses = options.isWrapClasses();
+            }
+            System.out.println("writeClasses = " + writeClasses);
+
 
             //if the wrap mode is set then create a global document to keep the wrapped
             //element models
@@ -212,7 +236,10 @@
 
         String originalName = qName.getLocalPart();
         String className = getNonConflictingName(this.namesList, originalName);
-        String fullyqualifiedClassName = null;
+
+        String packagePrefix;
+
+        String fullyqualifiedClassName;
         ArrayList propertyNames = new ArrayList();
 
         if (!templateLoaded) {
@@ -225,19 +252,28 @@
             globalWrappedDocument.getDocumentElement().appendChild(
                     getBeanElement(globalWrappedDocument, className, originalName, packageName,
qName, isElement, metainf, propertyNames, typeMap)
             );
-            //now the fully qualified class name needs to have the name of the including
class as well
-            fullyqualifiedClassName = (this.packageName == null ? "" : this.packageName)
+ WRAPPED_DATABINDING_CLASS_NAME + "." + className;
+            packagePrefix =  (this.packageName == null ? "" : this.packageName) + WRAPPED_DATABINDING_CLASS_NAME;
+
         } else {
             //create the model
             Document model = XSLTUtils.getDocument();
             //make the XML
             model.appendChild(getBeanElement(model, className, originalName, packageName,
qName, isElement, metainf, propertyNames, typeMap));
-            //create the file
-            File out = createOutFile(packageName, className);
-            //parse with the template and create the files
-            parse(model, out);
-            fullyqualifiedClassName = packageName + "." + className;
+
+            if (writeClasses){
+                //create the file
+                File out = createOutFile(packageName, className);
+                //parse with the template and create the files
+                parse(model, out);
+            }
+
+            //add the model to the model map
+            modelMap.put(qName,model);
+
+            packagePrefix = packageName ;
         }
+
+        fullyqualifiedClassName = packagePrefix + (packagePrefix.endsWith(".")?"":".") +
className;
 
         //return the fully qualified class name
         return fullyqualifiedClassName;

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
Wed Dec 21 22:58:22 2005
@@ -90,10 +90,13 @@
             }
             //call the schema compiler
             CompilerOptions options = new CompilerOptions();
-            options.setOutputLocation(configuration.getOutputLocation());
-            options.setPackageName(ADB_PACKAGE_NAME_PREFIX);
-            options.setWrapClasses(configuration.isWrapClasses());
 
+            //set the default options
+            setDefaultOptions(options);
+            
+
+            //todo allow the user to override the default options here
+            //perhaps by allowing -Eparameters
 
             SchemaCompiler schemaCompiler = new SchemaCompiler(options);
             schemaCompiler
@@ -101,13 +104,27 @@
 
             //create the type mapper
             JavaTypeMapper mapper = new JavaTypeMapper();
-            //get the processed element map and transfer it to the type mapper
-            Map processedMap = schemaCompiler.getProcessedElementMap();
-            Iterator processedkeys = processedMap.keySet().iterator();
-            QName qNameKey;
-            while (processedkeys.hasNext()) {
-                qNameKey = (QName) processedkeys.next();
-                mapper.addTypeMappingName(qNameKey, processedMap.get(qNameKey).toString());
+
+            if (options.isWriteOutput()){
+                //get the processed element map and transfer it to the type mapper
+                Map processedMap = schemaCompiler.getProcessedElementMap();
+                Iterator processedkeys = processedMap.keySet().iterator();
+                QName qNameKey;
+                while (processedkeys.hasNext()) {
+                    qNameKey = (QName) processedkeys.next();
+                    mapper.addTypeMappingName(qNameKey, processedMap.get(qNameKey).toString());
+                }
+
+            }else{
+                //get the processed model map and transfer it to the type mapper
+                //since the options mentiond that its
+                Map processedModelMap = schemaCompiler.getProcessedModelMap();
+                Iterator processedkeys = processedModelMap.keySet().iterator();
+                QName qNameKey;
+                while (processedkeys.hasNext()) {
+                    qNameKey = (QName) processedkeys.next();
+                    mapper.addTypeMappingObject(qNameKey, processedModelMap.get(qNameKey));
+                }
             }
 
             //set the type mapper to the config
@@ -118,5 +135,28 @@
             throw new RuntimeException(e);
         }
 
+    }
+
+    private void setDefaultOptions(CompilerOptions options) {
+        /// these options need to be taken from the command line
+        options.setOutputLocation(configuration.getOutputLocation());
+        options.setPackageName(ADB_PACKAGE_NAME_PREFIX);
+
+        options.setWrapClasses(configuration.isWrapClasses());
+        options.setWriteOutput(true);
+
+        //todo this needs to be attended to later
+        //default setting is to set the wrap status depending on whether it's
+        //the server side or the client side
+//        if (configuration.isServerSide()){
+//            //for the serverside we generate unwrapped  by default
+//            options.setWrapClasses(false);
+//            //for the serverside we write the output
+//            options.setWriteOutput(true);
+//        }else{
+//            options.setWrapClasses(configuration.isWrapClasses());
+//            options.setWriteOutput(true);
+//            //options.setWriteOutput(false);
+//        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=358514&r1=358513&r2=358514&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
Wed Dec 21 22:58:22 2005
@@ -457,11 +457,17 @@
 
          <xsl:for-each select="param">
              <xsl:if test="@type!=''">
-                 <!-- consider all the types to ADBbeans. So no instanceof check -->
+
                  public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/>
param){
-                 org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
-                 (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), param.getPullParser(null));
-                 return builder.getDocumentElement();
+                     if (param instanceof org.apache.axis2.databinding.ADBBean){
+                         org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new
org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
+                         (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), param.getPullParser(null));
+                         return builder.getDocumentElement();
+                     }else{
+                        <!-- treat this as a plain bean. use the reflective bean converter
-->
+                        //todo finish this onece the bean serializer has the necessary methods
+                         retrun null;
+                     }
                  }
              </xsl:if>
          </xsl:for-each>

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=358514&r1=358513&r2=358514&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
Wed Dec 21 22:58:22 2005
@@ -184,16 +184,23 @@
              };
          </xsl:if>
 
-         <xsl:for-each select="param">
-             <xsl:if test="@type!=''">
-                 <!-- consider all the types to ADBbeans. So no instanceof check -->
-                 public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/>
param){
-                 org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
-                 (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), param.getPullParser(null));
-                 return builder.getDocumentElement();
-                 }
-             </xsl:if>
-         </xsl:for-each>
+        <xsl:for-each select="param">
+                    <xsl:if test="@type!=''">
+
+                        public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/>
param){
+                            if (param instanceof org.apache.axis2.databinding.ADBBean){
+                                org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder
= new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
+                                (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), param.getPullParser(null));
+                                return builder.getDocumentElement();
+                            }else{
+                               <!-- treat this as a plain bean. use the reflective bean
converter -->
+                               <!-- todo finish this once the bean serializer has the
necessary methods -->
+                                retrun null;
+                            }
+                        }
+                    </xsl:if>
+                </xsl:for-each>
+
 
          public  java.lang.Object fromOM(org.apache.axis2.om.OMElement param,
          java.lang.Class type){
@@ -205,6 +212,7 @@
                      obj = parseMethod.invoke(null,new Object[]{param.getXMLStreamReader()});
                  }else{
                      //oops! we don't know how to deal with this. Perhaps the reflective
one is a good choice here
+                    <!-- todo finish this once the bean serializer has the necessary methods
-->
                  }
              } catch (Exception e) {
                   throw new RuntimeException(e);



Mime
View raw message