axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r358782 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2: schema/ schema/util/ schema/writer/ wsdl/codegen/ wsdl/codegen/emitter/ wsdl/codegen/extension/ wsdl/codegen/writer/ wsdl/databinding/ wsdl/template/java/
Date Fri, 23 Dec 2005 09:16:05 GMT
Author: ajith
Date: Fri Dec 23 01:15:41 2005
New Revision: 358782

URL: http://svn.apache.org/viewcvs?rev=358782&view=rev
Log:
Halfway through the changes to integrate single stub class. Now the code is generated but
need to fix some class name issues. Following are the changes
1. Updated the CodeGenConfiguration.java to include the ADB template as a property
2. Modified the templates to add the ADB templates to the original templates
3. Modified the resolver to handle the new imports
4. Refactored certain method names

 

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/schema-compile.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/util/SchemaPropertyLoader.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/CodeGenConfiguration.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTIncludeResolver.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.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/codegen/extension/XMLBeansExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ClassWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl

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=358782&r1=358781&r2=358782&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
Fri Dec 23 01:15:41 2005
@@ -32,6 +32,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -74,10 +75,20 @@
     private static final String EXTRA_ATTRIBUTE_FIELD_NAME = "extraAttributes";
 
 
+    /**
+     * @return the processes element map
+     * includes the Qname of the element as the key and a
+     * String representing the fully qualified class name
+     */
     public HashMap getProcessedElementMap() {
         return processedElementMap;
     }
 
+    /**
+     * @return a map of Qname vs models. A model can be anything,
+     * ranging from a DOM document to a stream. This is taken from the
+     * writer and the schema compiler has no control over it
+     */
     public Map getProcessedModelMap() {
         return writer.getModelMap();
     }
@@ -185,6 +196,15 @@
         }
     }
 
+    /**
+     * @return the property map of the schemacompiler.
+     * In this case it would be the property map loaded from
+     * the configuration file
+     */
+    public Properties getCompilerProperties(){
+        return SchemaPropertyLoader.getPropertyMap() ;
+    }
+
 
     /**
      * Writes the element
@@ -624,5 +644,7 @@
         }
 
     }
+
+
 
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/SchemaConstants.java
Fri Dec 23 01:15:41 2005
@@ -85,4 +85,13 @@
     public static final Integer ANY_ARRAY_TYPE = new Integer(4);
 
 
+    public static class SchemaPropertyNames{
+
+        public static final String SCHEMA_COMPILER_PROPERTIES = "/org/apache/axis2/schema/schema-compile.properties";
+        public static final String BEAN_WRITER_KEY = "schema.bean.writer.class";
+        public static final String BEAN_WRITER_TEMPLATE_KEY = "schema.bean.writer.template";
+        public static final String BEAN_WRITER_TYPEMAP_KEY = "schema.bean.typemap";
+    }
+
+
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/schema-compile.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/schema-compile.properties?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/schema-compile.properties
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/schema-compile.properties
Fri Dec 23 01:15:41 2005
@@ -15,7 +15,7 @@
 # load the following templates (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.wrapped=/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
+schema.bean.writer.template=/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
 # schema.bean.writer.template=/org/apache/axis2/schema/template/PlainBeanTemplate.xsl
 
 #

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/util/SchemaPropertyLoader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/util/SchemaPropertyLoader.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/util/SchemaPropertyLoader.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/util/SchemaPropertyLoader.java
Fri Dec 23 01:15:41 2005
@@ -1,6 +1,7 @@
 package org.apache.axis2.schema.util;
 
 import org.apache.axis2.schema.SchemaCompiler;
+import org.apache.axis2.schema.SchemaConstants;
 import org.apache.axis2.schema.typemap.TypeMap;
 import org.apache.axis2.schema.writer.BeanWriter;
 
@@ -25,33 +26,31 @@
  * Loads the properties  for the schema compiler
  */
 public class SchemaPropertyLoader {
-    private static String unwrappedBeanTemplate = null;
+    private static String beanTemplate = null;
     private static BeanWriter beanWriterInstance = null;
     private static TypeMap typeMapperInstance = null;
-
-    private static final String SCHEMA_COMPILER_PROPERTIES = "/org/apache/axis2/schema/schema-compile.properties";
-    private static final String BEAN_WRITER_KEY = "schema.bean.writer.class";
-    private static final String BEAN_WRITER_UNWRAPPED_TEMPLATE_KEY = "schema.bean.writer.template.wrapped";
-    private static final String BEAN_WRITER_TYPEMAP_KEY = "schema.bean.typemap";
+    private static Properties propertyMap;
 
     static {
         try {
             //load the properties
             Properties props = new Properties();
-            props.load(SchemaCompiler.class.getResourceAsStream(SCHEMA_COMPILER_PROPERTIES));
+            props.load(SchemaCompiler.class.getResourceAsStream(SchemaConstants.SchemaPropertyNames.SCHEMA_COMPILER_PROPERTIES));
 
-            String beanWriterClassName = props.getProperty(BEAN_WRITER_KEY);
+            String beanWriterClassName = props.getProperty(SchemaConstants.SchemaPropertyNames.BEAN_WRITER_KEY);
             if (beanWriterClassName != null) {
                 beanWriterInstance = (BeanWriter) Class.forName(beanWriterClassName).newInstance();
             }
 
-            String typeMapperClassName = props.getProperty(BEAN_WRITER_TYPEMAP_KEY);
+            String typeMapperClassName = props.getProperty(SchemaConstants.SchemaPropertyNames.BEAN_WRITER_TYPEMAP_KEY);
             if (typeMapperClassName != null) {
                 typeMapperInstance = (TypeMap) Class.forName(typeMapperClassName).newInstance();
             }
 
-            unwrappedBeanTemplate = props.getProperty(BEAN_WRITER_UNWRAPPED_TEMPLATE_KEY);
+            beanTemplate = props.getProperty(SchemaConstants.SchemaPropertyNames.BEAN_WRITER_TEMPLATE_KEY);
 
+            //set the props as the property map
+            propertyMap = props;
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -59,8 +58,16 @@
 
     }
 
-    public static String getUnwrappedBeanTemplate() {
-        return unwrappedBeanTemplate;
+    /**
+     * Exposes the whole property set
+     * @return
+     */
+    public static Properties getPropertyMap() {
+        return propertyMap;
+    }
+
+    public static String getBeanTemplate() {
+        return beanTemplate;
     }
 
     public static BeanWriter getBeanWriterInstance() {

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=358782&r1=358781&r2=358782&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
Fri Dec 23 01:15:41 2005
@@ -210,7 +210,7 @@
         }
 
         namesList = new ArrayList();
-        javaBeanTemplateName = SchemaPropertyLoader.getUnwrappedBeanTemplate();
+        javaBeanTemplateName = SchemaPropertyLoader.getBeanTemplate();
     }
 
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
Fri Dec 23 01:15:41 2005
@@ -118,7 +118,7 @@
      * @param key
      * @param value
      */
-    public void put(Object key, Object value) {
+    public void putProperty(Object key, Object value) {
         configurationProperties.put(key, value);
     }
 
@@ -128,7 +128,7 @@
      * @param key
      * @return
      */
-    public Object get(Object key) {
+    public Object getProperty(Object key) {
         return configurationProperties.get(key);
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
Fri Dec 23 01:15:41 2005
@@ -22,7 +22,9 @@
     String DEFAULT_PACKAGE_NAME = "codegen";
     QName BASE_64_CONTENT_QNAME = new QName("http://www.w3.org/2001/XMLSchema", "base64Binary");
     QName XMIME_CONTENT_TYPE_QNAME = new QName("http://www.w3.org/2004/06/xmlmime", "contentType");
+
     String BASE_64_PROPERTY_KEY = "base64map";
+    String EXTERNAL_TEMPLATE_PROPERTY_KEY = "externalTemplate";
 
     String XSLT_INCLUDE_DATABIND_SUPPORTER_HREF = "databindsupporter"; 
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTIncludeResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTIncludeResolver.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTIncludeResolver.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTIncludeResolver.java
Fri Dec 23 01:15:41 2005
@@ -7,6 +7,9 @@
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.stream.StreamSource;
 import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+import java.util.Properties;
+import java.util.Map;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -25,19 +28,44 @@
 
 public class XSLTIncludeResolver implements URIResolver,XSLTConstants {
 
+    private Map externalPropertyMap;
+
+    public XSLTIncludeResolver() {
+    }
+
+    public XSLTIncludeResolver(Map externalPropertyMap) {
+        this.externalPropertyMap = externalPropertyMap;
+    }
+
+    public void setExternalPropertyMap(Map externalPropertyMap) {
+        this.externalPropertyMap = externalPropertyMap;
+    }
 
     public Source resolve(String href, String base) throws TransformerException {
+        String templateName;
+        InputStream supporterTemplateStream;
         if (XSLT_INCLUDE_DATABIND_SUPPORTER_HREF.equals(href)){
-            String supporterTemplate = ConfigPropertyFileLoader.getDbSupporterTemplateName();
-            if(supporterTemplate!=null){
-                InputStream supporterTemplateStream = getClass().getResourceAsStream(supporterTemplate);
+            templateName = ConfigPropertyFileLoader.getDbSupporterTemplateName();
+            if(templateName!=null){
+                supporterTemplateStream = getClass().getResourceAsStream(templateName);
                 return new StreamSource(supporterTemplateStream);
             } else{
                 throw new TransformerException("Databinding template not found!");
             }
+        }
 
+        if (externalPropertyMap.get(href)!=null){
+            templateName = externalPropertyMap.get(href).toString();
+            if(templateName!=null){
+                supporterTemplateStream = getClass().getResourceAsStream(templateName);
+                return new StreamSource(supporterTemplateStream);
+            }
         }
+        //if nothing could be found return an empty source
+        return getEmptySource();
+    }
 
-        return null;
+    private Source getEmptySource(){
+        return new StreamSource(new ByteArrayInputStream("<xsl:stylesheet version=\"1.0\"
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"/>".getBytes()));
     }
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
Fri Dec 23 01:15:41 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
 import org.apache.axis2.wsdl.codegen.XSLTConstants;
+import org.apache.axis2.wsdl.codegen.XSLTIncludeResolver;
 import org.apache.axis2.wsdl.codegen.writer.AntBuildWriter;
 import org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter;
 import org.apache.axis2.wsdl.codegen.writer.ClassWriter;
@@ -54,8 +55,8 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.URIResolver;
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -83,9 +84,9 @@
     private static final String SERVICE_XML_OUTPUT_FOLDER_NAME = "service_descriptors.";
 
 
-    protected InputStream xsltStream = null;
     protected CodeGenConfiguration configuration;
     protected TypeMapper mapper;
+    protected URIResolver reslover;
 
 
     /**
@@ -105,6 +106,7 @@
      */
     public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
         this.configuration = configuration;
+        reslover = new XSLTIncludeResolver(this.configuration.getProperties());
     }
 
     /**
@@ -500,8 +502,8 @@
         writer.createOutFile(
                 model.getDocumentElement().getAttribute("package"),
                 model.getDocumentElement().getAttribute("name"));
-        writer.parse(
-                model);
+        //use the global resolver
+        writer.parse(model,reslover);
     }
 
 
@@ -1146,6 +1148,7 @@
                 "callbackname",
                 localPart + CALL_BACK_HANDLER_SUFFIX,
                 rootElement);
+
         //add the wrap classes flag
         if (configuration.isWrapClasses()) {
             addAttribute(doc,
@@ -1175,6 +1178,10 @@
         rootElement.appendChild(
                 createDOMElementforDatabinders(doc, binding));
 
+        //check for the special models in the mapper and if they are present process them
+        if (mapper.isObjectMappingPresent()){
+            processModelObjects(mapper.getAllMappedObjects(),rootElement,doc);
+        }
 
         doc.appendChild(rootElement);
 
@@ -1183,6 +1190,31 @@
 
     }
 
+    /**
+     *
+     * @param objectMappings
+     * @param root
+     * @param doc
+     */
+    private void processModelObjects(Map objectMappings,Element root,Document doc){
+        Iterator objectIterator = objectMappings.values().iterator();
+        while (objectIterator.hasNext()) {
+            Object o =  objectIterator.next();
+            if (o instanceof Document){
+              root.appendChild(doc.importNode(((Document)o).getDocumentElement(),false));
+            }else{
+                //oops we have no idea how to do this
+            }
+        }
+
+    }
+
+    /**
+     * Look for the SOAPVersion and add it
+     * @param binding
+     * @param doc
+     * @param rootElement
+     */
     protected void addSoapVersion(WSDLBinding binding, Document doc, Element rootElement)
{
         //loop through the extensibility elements to get to the bindings element
         List extensibilityElementsList = binding.getExtensibilityElements();

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=358782&r1=358781&r2=358782&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
Fri Dec 23 01:15:41 2005
@@ -18,8 +18,10 @@
 
 import org.apache.axis2.schema.CompilerOptions;
 import org.apache.axis2.schema.SchemaCompiler;
+import org.apache.axis2.schema.SchemaConstants;
 import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
 import org.apache.axis2.wsdl.databinding.JavaTypeMapper;
+import org.apache.axis2.wsdl.codegen.XSLTConstants;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.wsdl.WSDLExtensibilityElement;
@@ -36,7 +38,7 @@
 import java.util.Vector;
 
 /**
- * Work in progress to test simple DataBinding with the XmlSchema lib
+ * This extension provides the
  */
 public class SimpleDBExtension extends AbstractDBProcessingExtension {
 
@@ -117,7 +119,8 @@
 
             }else{
                 //get the processed model map and transfer it to the type mapper
-                //since the options mentiond that its
+                //since the options mentiond that its not writable, it should have
+                //populated the model map
                 Map processedModelMap = schemaCompiler.getProcessedModelMap();
                 Iterator processedkeys = processedModelMap.keySet().iterator();
                 QName qNameKey;
@@ -125,6 +128,20 @@
                     qNameKey = (QName) processedkeys.next();
                     mapper.addTypeMappingObject(qNameKey, processedModelMap.get(qNameKey));
                 }
+
+                Map processedMap = schemaCompiler.getProcessedElementMap();
+                processedkeys = processedMap.keySet().iterator();
+                while (processedkeys.hasNext()) {
+                    qNameKey = (QName) processedkeys.next();
+                    mapper.addTypeMappingName(qNameKey, processedMap.get(qNameKey).toString());
+                }
+
+                //get the ADB template from the schema compilers property bag and set the
+                //template
+                configuration.putProperty(XSLTConstants.EXTERNAL_TEMPLATE_PROPERTY_KEY,
+                                          schemaCompiler.getCompilerProperties().getProperty(
+                                                  SchemaConstants.SchemaPropertyNames.BEAN_WRITER_TEMPLATE_KEY));
+
             }
 
             //set the type mapper to the config
@@ -142,21 +159,24 @@
         options.setOutputLocation(configuration.getOutputLocation());
         options.setPackageName(ADB_PACKAGE_NAME_PREFIX);
 
-        options.setWrapClasses(configuration.isWrapClasses());
-        options.setWriteOutput(true);
+//        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);
-//        }
+        if (configuration.isServerSide()){
+            //for the serverside we generate unwrapped  by default
+            options.setWrapClasses(false);
+            //for the serverside we write the output by default
+            options.setWriteOutput(true);
+        }else{
+            // for the client let the users preference be the word here
+            options.setWrapClasses(configuration.isWrapClasses());
+            //for the client side the default setting is not to write the
+            //output
+            options.setWriteOutput(false);
+            //options.setWriteOutput(false);
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
Fri Dec 23 01:15:41 2005
@@ -192,7 +192,7 @@
             configuration.setTypeMapper(mapper);
 
             // write the mapper to a file for later retriival
-            writeMappingsToFile(mapper.getAllTypeMappings());
+            writeMappingsToFile(mapper.getAllMappedNames());
 
         } catch (Exception e) {
             throw new RuntimeException(e);
@@ -261,7 +261,7 @@
             allSeenTypes.addAll(Arrays.asList(sType.getAnonymousTypes()));
         }
 
-        configuration.put(XSLTConstants.BASE_64_PROPERTY_KEY, base64ElementQNamesList);
+        configuration.putProperty(XSLTConstants.BASE_64_PROPERTY_KEY, base64ElementQNamesList);
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ClassWriter.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ClassWriter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ClassWriter.java
Fri Dec 23 01:15:41 2005
@@ -26,6 +26,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.w3c.dom.Document;
 
+import javax.xml.transform.URIResolver;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
@@ -159,12 +160,12 @@
      * @param doc
      * @throws Exception
      */
-    public void parse(Document doc) throws Exception {
+    public void parse(Document doc, URIResolver resolver) throws Exception {
         if (!fileExists) {
             XSLTTemplateProcessor.parse(this.stream,
                     doc,
                     this.xsltStream,
-                    new XSLTIncludeResolver());
+                    resolver);
             this.stream.flush();
             this.stream.close();
             if ("java".equals(language) && outputFile != null) {

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
Fri Dec 23 01:15:41 2005
@@ -19,6 +19,7 @@
 import org.apache.axis2.om.OMElement;
 
 import javax.xml.namespace.QName;
+import java.util.Map;
 
 public interface TypeMapper {
 
@@ -28,6 +29,12 @@
     public static final String DEFAULT_CLASS_NAME = OMElement.class.getName();
 
     /**
+     * returns whether the mapping is the object type or the normal class name type
+     * @return
+     */
+    public boolean isObjectMappingPresent();
+
+    /**
      * Get the type mapping class name
      *
      * @param qname name of the XML element to be mapped
@@ -71,4 +78,16 @@
      * @see #getTypeMappingObject(javax.xml.namespace.QName)
      */
     public void addTypeMappingObject(QName qname, Object value);
+
+    /**
+     * @return a map containing all type mapping names
+     * i.e. Qname to  classname
+     */
+    public Map getAllMappedNames();
+
+    /**
+     * @return a map containing all type mapping model objects
+     * i.e. Qname to model objects
+     */
+    public Map getAllMappedObjects();
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java?rev=358782&r1=358781&r2=358782&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
Fri Dec 23 01:15:41 2005
@@ -18,6 +18,7 @@
 
 import javax.xml.namespace.QName;
 import java.util.HashMap;
+import java.util.Map;
 
 public abstract class TypeMappingAdapter implements TypeMapper {
 
@@ -33,6 +34,7 @@
     //counter variable to generate unique parameter ID's
     protected int counter = 0;
 
+    protected boolean isObject = false;
 
     //Upper limit for the paramete count
     protected static final int UPPER_PARAM_LIMIT = 1000;
@@ -91,13 +93,29 @@
      * @see TypeMapper#addTypeMappingObject(javax.xml.namespace.QName, Object)
      */
     public void addTypeMappingObject(QName qname, Object value) {
+        isObject = true;
         qName2ObjectMap.put(qname, value);
     }
 
     /**
+     * @see org.apache.axis2.wsdl.databinding.TypeMapper#isObjectMappingPresent()
      * @return
      */
-    public HashMap getAllTypeMappings() {
+    public boolean isObjectMappingPresent() {
+        return isObject;
+    }
+
+    /**
+     * @see org.apache.axis2.wsdl.databinding.TypeMapper#getAllMappedNames()
+     */
+    public Map getAllMappedNames() {
         return qName2NameMap;
+    }
+
+    /**
+     * @see org.apache.axis2.wsdl.databinding.TypeMapper#getAllMappedObjects()
+     */
+    public Map getAllMappedObjects() {
+        return qName2ObjectMap;
     }
 }

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=358782&r1=358781&r2=358782&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
Fri Dec 23 01:15:41 2005
@@ -1,7 +1,10 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="text"/>
 
+    <!-- import the databinding template-->
     <xsl:include href="databindsupporter"/>
+    <!-- import the other templates for databinding -->
+    <xsl:include href="externalTemplate"/>
 
     <xsl:template match="/class">
         <xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
@@ -391,5 +394,5 @@
 
     </xsl:template>
 
-   
+
 </xsl:stylesheet>



Mime
View raw message