axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsosno...@apache.org
Subject svn commit: r449558 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen: emitter/AxisServiceBasedMultiLanguageEmitter.java extension/JiBXExtension.java
Date Mon, 25 Sep 2006 03:54:28 GMT
Author: dsosnoski
Date: Sun Sep 24 20:54:28 2006
New Revision: 449558

URL: http://svn.apache.org/viewvc?view=rev&rev=449558
Log:
Generate data structures for JiBX unwrapped support

Modified:
    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/codegen/extension/JiBXExtension.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=449558&r1=449557&r2=449558
==============================================================================
--- 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
Sun Sep 24 20:54:28 2006
@@ -1054,30 +1054,18 @@
         //at this point we may need to capture the extra parameters passes to the
         //particular databinding framework
         //these parameters showup in the property map with String keys, and we
-        //can just copy these items over to the <extra> element.
-        //this code allows both simple values, which are written as name="value"
-        //attributes of the <extra> element, and Element values with property
-        //names starting with "databinders/extra", which are written as child
-        //elements of the <extra> element (with the property name unused, in
-        //this case)
+        //can just copy these items as attributes of the <extra> element.
         Element extraElement = addElement(doc, "extra", null, rootElement);
         Map propertiesMap = codeGenConfiguration.getProperties();
         for (Iterator it = propertiesMap.keySet().iterator(); it.hasNext();){
             Object key = it.next();
             if (key instanceof String) {
                 Object value = propertiesMap.get(key);
-                if (value instanceof Element) {
-                    if (((String)key).startsWith("databinders/extra")) {
-                        // append child element
-                        extraElement.appendChild(doc.importNode((Element)value, true));
-                    }
-                } else {
-                    //if the value is null set it to empty string
-                    if (value==null) value="";
-                    //add key="value" attribute to element iff value a string
-                    if (value instanceof String){
-                         addAttribute(doc,(String)key,(String)value, extraElement);
-                    }
+                //if the value is null set it to empty string
+                if (value==null) value="";
+                //add key="value" attribute to element iff value a string
+                if (value instanceof String){
+                     addAttribute(doc,(String)key,(String)value, extraElement);
                 }
             }
         }
@@ -1097,7 +1085,15 @@
         for (Iterator iterator = parameters.iterator(); iterator.hasNext();) {
             rootElement.appendChild((Element) iterator.next());
         }
-
+        
+        // finish with any extra information from operations
+        for (Iterator operationsIterator = axisService.getOperations();operationsIterator.hasNext();)
{
+            AxisOperation axisOperation = (AxisOperation) operationsIterator.next();
+            Parameter details = axisOperation.getParameter(Constants.DATABINDING_DETAILS);
+            if (details != null) {
+                rootElement.appendChild(doc.importNode((Element)details.getValue(), true));
+            }
+        }
 
         ///////////////////////////////////////////////
         //System.out.println(DOM2Writer.nodeToString(rootElement));

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JiBXExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JiBXExtension.java?view=diff&rev=449558&r1=449557&r2=449558
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JiBXExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JiBXExtension.java
Sun Sep 24 20:54:28 2006
@@ -16,6 +16,8 @@
 
 package org.apache.axis2.wsdl.codegen.extension;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
@@ -45,7 +47,7 @@
         // check the JiBX binding definition file specified
         String path = (String)configuration.getProperties().get(BINDING_PATH_OPTION);
         if (path == null) {
-            throw new RuntimeException("jibx binding option currently requires -" +
+            throw new RuntimeException("jibx binding option currently requires -E" +
                     BINDING_PATH_OPTION + " {file-path} parameter");
         }
         try {
@@ -65,52 +67,25 @@
                 throw new RuntimeException("JiBX binding extension not in classpath");
             }
             
+            // create an instance of the class
+            Object inst = null;
+            Constructor constructor = clazz.getConstructor(new Class[] { CodeGenConfiguration.class
});
+            inst = constructor.newInstance(new Object[] { configuration });
+            
             // invoke utility class method for actual processing
             Method method = clazz.getMethod(JIBX_UTILITY_METHOD,
-                new Class[] { String.class, CodeGenConfiguration.class });
-            method.invoke(null, new Object[] { path, configuration });
-
-/*            // invoke utility class method for actual processing
-            Method method = clazz.getMethod(BINDING_MAP_METHOD,
-                    new Class[] { String.class });
-            HashMap jibxmap = (HashMap)method.invoke(null, new Object[] { path });
-
-            // Want to find all elements by working down from bindings (if any
-            // supplied) or interfaces (if no bindings). Not sure why this dual
-            // path is required, but based on the code in
-            // org.apache.axis2.wsdl.builder.SchemaUnwrapper
-            HashSet elements = new HashSet();
-            Iterator operations = configuration.getAxisService().getOperations();
-            while (operations.hasNext()) {
-                AxisOperation o =  (AxisOperation)operations.next();
-                accumulateElements(o, elements);
-            }
-
-
-            //create the type mapper
-            //First try to take the one that is already there
-            TypeMapper mapper = configuration.getTypeMapper();
-            if (mapper==null){
-                mapper =new JavaTypeMapper();
-            }
-
-            for (Iterator iter = elements.iterator(); iter.hasNext();) {
-                QName qname = (QName)iter.next();
-                if (qname != null) {
-                    String cname = (String)jibxmap.get(qname);
-                    if (cname == null) {
-                        throw new RuntimeException("No JiBX mapping defined for " + qname);
-                    }
-                    mapper.addTypeMappingName(qname, cname);
-                }
-            }
-
-            // set the type mapper to the config
-            configuration.setTypeMapper(mapper);	*/
+                new Class[] { String.class });
+            method.invoke(inst, new Object[] { path });
 
         } catch (Exception e) {
             if (e instanceof RuntimeException) {
                 throw (RuntimeException)e;
+            } else if (e instanceof InvocationTargetException) {
+                if (e.getCause() instanceof RuntimeException) {
+                    throw (RuntimeException)e.getCause();
+                } else {
+                    throw new RuntimeException(e);
+                }
             } else {
                 throw new RuntimeException(e);
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message