axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r357931 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen: CodeGenerationEngine.java codegen-config.properties extension/AbstractDBProcessingExtension.java extension/DefaultDatabindingExtension.java
Date Tue, 20 Dec 2005 07:14:22 GMT
Author: ajith
Date: Mon Dec 19 23:14:10 2005
New Revision: 357931

URL: http://svn.apache.org/viewcvs?rev=357931&view=rev
Log:
reverting the change by Dims (Sorry dims, the proposed change does not solve all the cases,
especially when the user says -adb none then the defaulttypemapper is not set

1. Added the DefaultDatabindingExtension.java
2. changed the codegen-config.properties
3. updated the AbstractDBProcessingExtension.java changing the change by dims

Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/DefaultDatabindingExtension.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.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/extension/AbstractDBProcessingExtension.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=357931&r1=357930&r2=357931&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
Mon Dec 19 23:14:10 2005
@@ -60,7 +60,6 @@
         for (int i = 0; i < extensions.length; i++) {
             //load the Extension class
             addExtension((CodeGenExtension)getObjectFromClassName(extensions[i]));
-
         }
 
     }
@@ -78,20 +77,23 @@
             }
 
             Emitter emitter;
+
+
             TypeMapper mapper = configuration.getTypeMapper();
             if (mapper==null){
-                //this shouldn't happen
+                // this check is redundant here. The default databinding extension should
+                // have already figured this out and thrown an error message. However in
case the
+                // users mess with the config it is safe to keep this check in order to throw
+                // a meaningful error message
                 throw new CodeGenerationException("No proper databinding has taken place");
             }
-            
+
             Map emitterMap = ConfigPropertyFileLoader.getLanguageEmitterMap();
             String className = emitterMap.get(configuration.getOutputLanguage()).toString();
             if (className!=null){
-                
                 emitter = (Emitter)getObjectFromClassName(className);
                 emitter.setCodeGenConfiguration(configuration);
                 emitter.setMapper(mapper);
-
             }else{
                 throw new Exception("Emitter class not found!");
             }

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=357931&r1=357930&r2=357931&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
Mon Dec 19 23:14:10 2005
@@ -3,7 +3,9 @@
 #######################################################################################################################
 # Extensions - The extensions are comma separated
 # these are loaded in their lexical order
-codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension
+# Note the last extension - It includes a check to figure out whether proper databinding
has taken place
+# This extension should appear AFTER all the databinding extensions inorder to function properly
+codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension
 #codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension
 # The third party schemas to be loaded. e.g. The Xmime extension
 # Note - these will be loaded from the org.apache.axis2.wsdl.codegen.schema package.
@@ -19,7 +21,7 @@
 # the related extensions for the specified data binding frameworks above
 # Note -  these are in the lexical order of the framework names. There is an implicit assumption
 # that a given databinding framework will be processed only by one extension
-codegen.databinding.extensions=org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension
+codegen.databinding.extensions=org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension
 # the default data binding framework name
 codegen.databinding.frameworks.default=adb
 #####################################################################################################################

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/AbstractDBProcessingExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/AbstractDBProcessingExtension.java?rev=357931&r1=357930&r2=357931&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/AbstractDBProcessingExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/AbstractDBProcessingExtension.java
Mon Dec 19 23:14:10 2005
@@ -30,10 +30,8 @@
      */
     protected boolean testFallthrough(String dbFrameworkName){
         Map extensionsMap = ConfigPropertyFileLoader.getDatabindingFrameworkNameToExtensionMap();
-        Object mappedExtension=extensionsMap.get(dbFrameworkName);
-        if(mappedExtension == null) 
-            return true;
-        return !(getClass().getName().equals(mappedExtension.toString()));
+        String mappedExtension=extensionsMap.get(dbFrameworkName)!=null?extensionsMap.get(dbFrameworkName).toString():"";
+        return !(getClass().getName().equals(mappedExtension));
     }
 
 }

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/DefaultDatabindingExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/DefaultDatabindingExtension.java?rev=357931&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/DefaultDatabindingExtension.java
(added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/DefaultDatabindingExtension.java
Mon Dec 19 23:14:10 2005
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package org.apache.axis2.wsdl.codegen.extension;
+
+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.databinding.DefaultTypeMapper;
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+
+public class DefaultDatabindingExtension extends AbstractDBProcessingExtension{
+    private CodeGenConfiguration configuration;
+    public void init(CodeGenConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    public void engage() throws CodeGenerationException {
+        TypeMapper mappper = configuration.getTypeMapper();
+        if (testFallthrough(configuration.getDatabindingType())){
+            //if it's fall through for the default databinding extension and a mapper has
+            //not yet being set, then there's a problem.
+            //Hence check the mapper status here
+
+            if (mappper==null){
+                //this shouldn't happen
+                throw new CodeGenerationException("No proper databinding has taken place");
+            }
+            return;
+        }
+
+        configuration.setTypeMapper(new DefaultTypeMapper());
+    }
+}



Mime
View raw message