axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r527287 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: marshaller/impl/alt/DocLitWrappedMethodMarshaller.java utility/PropertyDescriptorPlus.java wrapper/impl/JAXBWrapperToolImpl.java
Date Tue, 10 Apr 2007 20:37:23 GMT
Author: scheu
Date: Tue Apr 10 13:37:22 2007
New Revision: 527287

URL: http://svn.apache.org/viewvc?view=rev&rev=527287
Log:
AXIS2-2502
Contributor:Rich Scheuerle
Some more small performance tweaks to the doc/literal wrapped flow.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java?view=diff&rev=527287&r1=527286&r2=527287
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
Tue Apr 10 13:37:22 2007
@@ -313,7 +313,7 @@
             ParameterDescription[] pds = operationDesc.getParameterDescriptions();
 
             // Create the message 
-            MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
+            MessageFactory mf = marshalDesc.getMessageFactory();
             Message m = mf.create(protocol);
 
             // In usage=WRAPPED, there will be a single block in the body.
@@ -412,7 +412,7 @@
             ParameterDescription[] pds = operationDesc.getParameterDescriptions();
 
             // Create the message 
-            MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
+            MessageFactory mf = marshalDesc.getMessageFactory();
             Message m = mf.create(protocol);
 
             // In usage=WRAPPED, there will be a single block in the body.

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java?view=diff&rev=527287&r1=527286&r2=527287
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java
Tue Apr 10 13:37:22 2007
@@ -47,8 +47,10 @@
 public class PropertyDescriptorPlus {
     PropertyDescriptor descriptor;
     String xmlName = null;
+    Object[] SINGLE_PARAM = new Object[1];
 
     private static Log log = LogFactory.getLog(PropertyDescriptorPlus.class);
+    private static final boolean DEBUG_ENABLED = log.isDebugEnabled();
 
     /**
      * Package protected constructor.  Only created by XMLRootElementUtil.createPropertyDescriptorMap
@@ -166,24 +168,31 @@
      * @throws IllegalAccessException
      * @throws JAXBWrapperException
      */
-    private void setAtomic(Object targetBean, Object propValue, Method writeMethod)
-            throws InvocationTargetException, IllegalAccessException, JAXBWrapperException
{
+    private void setAtomic(Object targetBean, Object propValue, Method writeMethod) 
+    throws InvocationTargetException, IllegalAccessException, JAXBWrapperException {
         // JAXB provides setters for atomic value.
-        Object[] object = new Object[] { propValue };
-        Class[] paramTypes = writeMethod.getParameterTypes();
-        if (paramTypes != null && paramTypes.length == 1) {
-            Class paramType = paramTypes[0];
-            if (paramType.isPrimitive() && propValue == null) {
-                //Ignoring null value for primitive type, this could potentially be the way
of a customer indicating to set
-                //default values defined in JAXBObject/xmlSchema.
-                if (log.isDebugEnabled()) {
-                    log.debug(
-                            "Ignoring null value for primitive type, this is the way to set
default values defined in JAXBObject/xmlSchema. for primitive types");
+        
+        if (propValue != null) {
+            // Normal case
+            SINGLE_PARAM[0] = propValue;
+            writeMethod.invoke(targetBean, SINGLE_PARAM);
+        } else {
+            Class[] paramTypes = writeMethod.getParameterTypes();
+            
+            if(paramTypes !=null && paramTypes.length ==1){
+                Class paramType = paramTypes[0];
+                if(paramType.isPrimitive() && propValue == null){
+                    // TODO NLS
+                    //Ignoring null value for primitive type, this could potentially be the
way of a customer indicating to set
+                    //default values defined in JAXBObject/xmlSchema.
+                    if(DEBUG_ENABLED){
+                        log.debug("Ignoring null value for primitive type, this is the way
to set default values defined in JAXBObject/xmlSchema. for primitive types");
+                    }
+                    return;
                 }
-                return;
             }
         }
-        writeMethod.invoke(targetBean, object);
+        
     }
 
     /**
@@ -202,9 +211,9 @@
         Class paramType = writeMethod.getParameterTypes()[0];
         Object value = asArray(propValue, paramType);
         // JAXB provides setters for atomic value.
-        Object[] object = new Object[] { value };
-
-        writeMethod.invoke(targetBean, value);
+        SINGLE_PARAM[0] =value;
+        
+        writeMethod.invoke(targetBean, SINGLE_PARAM);
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java?view=diff&rev=527287&r1=527286&r2=527287
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wrapper/impl/JAXBWrapperToolImpl.java
Tue Apr 10 13:37:22 2007
@@ -165,26 +165,27 @@
                                             List<String> xmlChildNames,
                                             Map<String, PropertyDescriptorPlus> pdMap)
             throws JAXBWrapperException {
-        Map<String, PropertyDescriptorPlus> map = new HashMap<String, PropertyDescriptorPlus>();
-
-        // Now check the property info map
-        for (int i = 0; i < xmlChildNames.size(); i++) {
-            String xmlChildName = xmlChildNames.get(i);
-            PropertyDescriptorPlus pd = pdMap.get(xmlChildName);
-            if (pd == null) {
-                // Each xml child name must have a matching property.  
-                if (log.isDebugEnabled()) {
+        // The following code is slow, and doc/lit wrapped is in the main
+        // performance flow.  So only do this check if debug is enabled.
+        if (log.isDebugEnabled()) {
+            for (int i = 0; i < xmlChildNames.size(); i++) {
+                String xmlChildName = xmlChildNames.get(i);
+                PropertyDescriptorPlus pd = pdMap.get(xmlChildName);
+                if (pd == null) {
+                    // Each xml child name must have a matching property.  
+                    
                     log.debug(
-                            "Error occurred trying to match an xml name to a child of a jaxb
object");
+                    "Error occurred trying to match an xml name to a child of a jaxb object");
                     log.debug("  The JAXBClass is:" + jaxbClass.getName());
                     log.debug("  The child name that we are looking for is:" + xmlChildName);
                     log.debug("  The JAXBClass has the following child xml names:" +
                             toString(pdMap.keySet()));
                     log.debug("  Complete list of child names that we are looking for:" +
                             toString(xmlChildNames));
+                    
+                    throw new JAXBWrapperException(
+                            Messages.getMessage("JAXBWrapperErr6", jaxbClass.getName(), xmlChildName));
                 }
-                throw new JAXBWrapperException(
-                        Messages.getMessage("JAXBWrapperErr6", jaxbClass.getName(), xmlChildName));
             }
         }
     }



---------------------------------------------------------------------
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