[jboss-svn-commits] JBossWS SVN: r1168 - in branches/tdiesler/jbossws-1.0/src: main/java/org/jboss/ws/common main/java/org/jboss/ws/deployment main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/metadata main/java/org/jboss/ws/server main/java/org/jboss/ws/tools/metadata test/java/org/jboss/test/ws/jaxws/jbws860 test/resources/jaxws/samples/jsr181ejb test/resources/jaxws/samples/jsr181pojo test/resources/jaxws/samples/wsaddressing test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF test/resources/jaxws/wsaddressing/replyto/Initial-META-INF test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 6 20:02:37 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-10-06 20:02:13 -0400 (Fri, 06 Oct 2006)
New Revision: 1168

Modified:
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ParameterWrapping.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
   branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
   branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/jaxrpc-mapping.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/wstools-config.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml
   branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml
Log:
[JBWS-1113] Improve performance of Service.getPort()

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/common/CommonClient.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -54,7 +54,6 @@
 import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
 import org.jboss.ws.soap.EndpointInfo;
 import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPBodyImpl;
 import org.jboss.ws.soap.SOAPConnectionImpl;
 import org.jboss.ws.utils.HolderUtils;
 import org.jboss.ws.utils.JavaUtils;
@@ -184,6 +183,8 @@
       if (epMetaData == null)
       {
          UnifiedMetaData wsMetaData = new UnifiedMetaData();
+         wsMetaData.setClassLoader(Thread.currentThread().getContextClassLoader());
+         
          ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(Constants.NS_JBOSSWS_URI, "AnonymousService"));
          wsMetaData.addService(serviceMetaData);
 

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -25,8 +25,6 @@
 
 import java.io.IOException;
 import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
 import java.util.Set;
 
 import javax.xml.namespace.QName;
@@ -104,9 +102,9 @@
       try
       {
          UnifiedMetaData wsMetaData = new UnifiedMetaData();
-         wsMetaData.setResourceLoader(resourceLoader);
          wsMetaData.setClassLoader(classLoader);
-
+         wsMetaData.setResourceLoader(resourceLoader);
+         
          ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceQName);
          wsMetaData.addService(serviceMetaData);
 

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -129,9 +129,9 @@
       UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
       if (wsMetaData != null)
       {
-         // late initialization of the web context loader
-         if (wsMetaData.getClassLoader() != udi.ucl)
-            wsMetaData.setClassLoader(udi.ucl);
+         // eagerly initialize the UMDM
+         wsMetaData.setClassLoader(udi.ucl);
+         wsMetaData.eagerInitialize();
          
          // Publish the WSDL file
          WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ParameterWrapping.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ParameterWrapping.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/jaxrpc/ParameterWrapping.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -142,7 +142,7 @@
       
       ParameterMetaData paramMetaData = opMetaData.getReturnParameter();
       Class resStructType = paramMetaData.getJavaType();
-
+      
       log.debug("matchResponseParameters: " + resStructType.getName());
       try
       {
@@ -463,8 +463,17 @@
             CtField field = new CtField(pool.get(typeName), name, clazz);
             field.setModifiers(Modifier.PRIVATE);
             clazz.addField(field);
-            clazz.addMethod(CtNewMethod.getter("get" + capitalize(name), field));
-            clazz.addMethod(CtNewMethod.setter("set" + capitalize(name), field));
+            
+            if (pmd.getOperationMetaData().getReturnParameter() == pmd)
+            {
+               clazz.addMethod(CtNewMethod.getter("getResult", field));
+               clazz.addMethod(CtNewMethod.setter("setResult", field));
+            }
+            else
+            {
+               clazz.addMethod(CtNewMethod.getter("get" + capitalize(name), field));
+               clazz.addMethod(CtNewMethod.setter("set" + capitalize(name), field));
+            }
          }
 
          wrapperType = (Class)pool.toClass(clazz, loader);

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -26,7 +26,9 @@
 import java.lang.reflect.Method;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 import javax.jws.soap.SOAPBinding.ParameterStyle;
@@ -81,6 +83,8 @@
    private String endpointAddress;
    // The endpoint interface name
    private String seiName;
+   // The endpoint interface
+   private Class seiClass;
    // The optional authentication method
    private String authMethod;
    // The optional transport guarantee
@@ -101,6 +105,8 @@
    private List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
    // True if the handlers are initialized
    private boolean handlersInitialized;
+   // Maps the java method to the operation meta data
+   private Map<Method, OperationMetaData> opmdCache = new HashMap<Method, OperationMetaData>();
 
    public EndpointMetaData(ServiceMetaData service, QName portName, Type type)
    {
@@ -171,9 +177,10 @@
       return seiName;
    }
 
-   public void setServiceEndpointInterfaceName(String endpointInterfaceName)
+   public void setServiceEndpointInterfaceName(String seiName)
    {
-      this.seiName = endpointInterfaceName;
+      this.seiName = seiName;
+      this.seiClass = null;
    }
 
    /** Get the class loader associated with the endpoint meta data */
@@ -183,35 +190,34 @@
       return classLoader;
    }
 
-   /** Get the class loader associated with the endpoint meta data */
+   /** Get the resource loader associated with the endpoint meta data */
    public URLClassLoader getResourceLoader()
    {
       URLClassLoader classLoader = getServiceMetaData().getUnifiedMetaData().getResourceLoader();
       return classLoader;
    }
 
-   /** Lazily load the SEI. The SEI class loader may not be available at creation time.
+   /** Load the service endpoint interface
     */
    public Class getServiceEndpointInterface()
    {
-      String seiName = getServiceEndpointInterfaceName();
-      if (seiName == null)
-         throw new WSException("ServiceEndpointInterface name not available");
-
-      Class seiClass = null;
-      try
+      Class tmpClass = seiClass;
+      if (tmpClass == null && seiName != null)
       {
-         ClassLoader classLoader = getClassLoader();
-         if (classLoader == null)
-            throw new WSException("Class loader not available");
-
-         seiClass = classLoader.loadClass(seiName);
+         try
+         {
+            ClassLoader classLoader = getClassLoader();
+            tmpClass = classLoader.loadClass(seiName);
+            
+            if (service.getUnifiedMetaData().isAllowTypeCaching())
+               seiClass = tmpClass;
+         }
+         catch (ClassNotFoundException ex)
+         {
+            throw new WSException("Cannot load service endpoint interface: " + seiName, ex);
+         }
       }
-      catch (ClassNotFoundException ex)
-      {
-         throw new WSException("Cannot load SEI: " + seiName, ex);
-      }
-      return seiClass;
+      return tmpClass;
    }
 
    public Use getEncodingStyle()
@@ -363,13 +369,17 @@
 
    public OperationMetaData getOperation(Method method)
    {
-      OperationMetaData opMetaData = null;
-      for (OperationMetaData aux : operations)
+      OperationMetaData opMetaData = opmdCache.get(method);
+      if (opMetaData == null)
       {
-         if (aux.getJavaMethod().equals(method))
+         for (OperationMetaData aux : operations)
          {
-            opMetaData = aux;
-            break;
+            if (aux.isJavaMethod(method))
+            {
+               opmdCache.put(method, aux);
+               opMetaData = aux;
+               break;
+            }
          }
       }
       return opMetaData;
@@ -427,6 +437,8 @@
     */
    public void eagerInitialize()
    {
+      getServiceEndpointInterface();
+      
       TypeMappingImpl typeMapping = service.getTypeMapping();
       for (TypeMappingMetaData tmMetaData : service.getTypesMetaData().getTypeMappings())
       {
@@ -447,13 +459,11 @@
             
             if (registered == false)
             {
-               ClassLoader classLoader = service.getUnifiedMetaData().getClassLoader();
-               if (classLoader == null)
-                  throw new WSException("ClassLoader not available in meta data");
-               
                try
                {
+                  ClassLoader classLoader = getClassLoader();
                   Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);
+                  
                   if (JavaUtils.isPrimitive(javaTypeName))
                      javaType = JavaUtils.getWrapperType(javaType);
 

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/FaultMetaData.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -25,8 +25,8 @@
 
 import javax.xml.namespace.QName;
 
+import org.jboss.logging.Logger;
 import org.jboss.ws.WSException;
-import org.jboss.ws.jaxrpc.ParameterWrapping;
 import org.jboss.ws.utils.JavaUtils;
 
 /**
@@ -38,8 +38,11 @@
  */
 public class FaultMetaData
 {
+   // provide logging
+   private final Logger log = Logger.getLogger(FaultMetaData.class);
+   
    // The parent operation
-   private OperationMetaData operation;
+   private OperationMetaData opMetaData;
 
    private QName xmlName;
    private QName xmlType;
@@ -55,7 +58,7 @@
       if (javaTypeName == null)
          throw new IllegalArgumentException("Invalid null javaTypeName argument, for: " + xmlName);
 
-      this.operation = operation;
+      this.opMetaData = operation;
       this.xmlName = xmlName;
       this.xmlType = xmlType;
       this.javaTypeName = javaTypeName;
@@ -63,7 +66,7 @@
 
    public OperationMetaData getOperationMetaData()
    {
-      return operation;
+      return opMetaData;
    }
 
    public QName getXmlName()
@@ -83,27 +86,23 @@
 
    public Class getJavaType()
    {
-      // If the class loader has changed, make sure we reload the class
-      ClassLoader loader = operation.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
-      if (loader == null)
-         throw new WSException("ClassLoader not available");
-
-      if (javaTypeName == null)
-         return null;
-
-      if (javaType == null || ((!javaType.isPrimitive()) && javaType.getClassLoader() != loader))
+      Class tmpType = javaType;
+      if (tmpType == null && javaTypeName != null)
       {
          try
          {
-            javaType = JavaUtils.loadJavaType(javaTypeName, loader);
+            ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+            tmpType = JavaUtils.loadJavaType(javaTypeName, loader);
+            
+            if (opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isAllowTypeCaching())
+               javaType = tmpType;
          }
          catch (ClassNotFoundException ex)
          {
             throw new WSException("Cannot load java type: " + javaTypeName, ex);
          }
       }
-
-      return javaType;
+      return tmpType;
    }
 
    public void eagerInitialize()

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/OperationMetaData.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -25,6 +25,7 @@
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import javax.jws.soap.SOAPBinding.ParameterStyle;
@@ -66,6 +67,7 @@
    private List<ParameterMetaData> parameters = new ArrayList<ParameterMetaData>();
    private List<FaultMetaData> faults = new ArrayList<FaultMetaData>();
    private ParameterMetaData returnParam;
+   private List<Method> unsynchronizedMethods;
 
    public OperationMetaData(QName qname, String javaName)
    {
@@ -157,94 +159,101 @@
       return javaName;
    }
 
-   /** Lazily load the java method. The SEI class loader may not be available at creation time
+   /** Load the java method. 
     */
    public Method getJavaMethod()
    {
-      ClassLoader loader = getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
-      if (javaMethod == null || javaMethod.getDeclaringClass().getClassLoader().equals(loader) == false)
+      Class seiClass = epMetaData.getServiceEndpointInterface();
+      
+      Method tmpMethod = javaMethod;
+      if (tmpMethod == null && seiClass != null)
       {
-         javaMethod = null;
-         try
+         // Add all SEI method to the list of unsynchronized methods
+         if (unsynchronizedMethods == null)
          {
-            Class seiClass = epMetaData.getServiceEndpointInterface();
-            if (seiClass == null)
-               throw new WSException("ServiceEndpointInterface not available");
+            unsynchronizedMethods = new ArrayList<Method>(); 
+            unsynchronizedMethods.addAll(Arrays.asList(seiClass.getMethods()));
+         }
+         
+         for (Method method : unsynchronizedMethods)
+         {
+            if (isJavaMethod(method))
+            {
+               // Remove the method from the list of unsynchronized methods
+               if (epMetaData.getServiceMetaData().getUnifiedMetaData().isAllowTypeCaching())
+               {
+                  unsynchronizedMethods.remove(method);
+                  javaMethod = method;
+               }
+               tmpMethod = method;
+               break;
+            }
+         }
+         
+         if (tmpMethod == null)
+            throw new WSException("Cannot find java method: " + javaName);
+      }
+      return tmpMethod;
+   }
 
-            for (Method method : seiClass.getMethods())
+   public boolean isJavaMethod(Method method)
+   {
+      boolean isJavaMethod = method.equals(javaMethod);
+      if (isJavaMethod == false)
+      {
+         String methodName = method.getName();
+         Class[] methodTypes = method.getParameterTypes();
+         Class returnType = method.getReturnType();
+
+         if (javaName.equals(methodName))
+         {
+            log.trace("Found java method: " + method);
+
+            // match document/literal/wrapped
+            if (isDocumentWrapped())
             {
-               String methodName = method.getName();
-               Class[] methodTypes = method.getParameterTypes();
-               Class returnType = method.getReturnType();
-
-               if (javaName.equals(methodName))
+               if (ParameterWrapping.matchRequestParameters(this, methodTypes) && ParameterWrapping.matchResponseParameters(this, returnType))
                {
-                  log.trace("Found java method: " + method);
-
-                  // match document/literal/wrapped
-                  if (isDocumentWrapped())
+                  log.debug("Found wrapped java method: " + method);
+                  isJavaMethod = true;
+               }
+            }
+            else
+            {
+               // Match the return parameter
+               ParameterMetaData returnMetaData = getReturnParameter();
+               if (returnMetaData != null)
+               {
+                  if (!matchParameter(returnMetaData, returnType, true) && !matchParameter(returnMetaData, returnType, false))
                   {
-                     if (ParameterWrapping.matchRequestParameters(this, methodTypes) && ParameterWrapping.matchResponseParameters(this, returnType))
-                     {
-                        log.debug("Found wrapped java method: " + method);
-                        javaMethod = method;
-                        break;
-                     }
+                     log.debug("Unmatched return meta data: " + returnType);
                   }
-                  else
+               }
+               else
+               {
+                  if (returnType != void.class)
                   {
-                     // Match the return parameter
-                     ParameterMetaData returnMetaData = getReturnParameter();
-                     if (returnMetaData != null)
-                     {
-                        if (!matchParameter(returnMetaData, returnType, true) && !matchParameter(returnMetaData, returnType, false))
-                        {
-                           log.debug("Unmatched return meta data: " + returnType);
-                           continue;
-                        }
-                     }
-                     else
-                     {
-                        if (returnType != void.class)
-                        {
-                           log.debug("Unmatched return meta data: " + returnType);
-                           continue;
-                        }
-                     }
+                     log.debug("Unmatched return meta data: " + returnType);
+                  }
+               }
 
-                     // compare params by java type name
-                     if (compareMethodParams(methodTypes, true))
-                     {
-                        log.debug("Found best matching java method: " + method);
-                        javaMethod = method;
-                        break;
-                     }
+               // compare params by java type name
+               if (compareMethodParams(methodTypes, true))
+               {
+                  log.debug("Found best matching java method: " + method);
+                  isJavaMethod = true;
+               }
 
-                     // compare params by assignability
-                     else if (compareMethodParams(methodTypes, false))
-                     {
-                        log.debug("Found possible matching java method: " + method);
-                        javaMethod = method;
-                        break;
-                     }
-                  }
+               // compare params by assignability
+               else if (compareMethodParams(methodTypes, false))
+               {
+                  log.debug("Found possible matching java method: " + method);
+                  isJavaMethod = true;
                }
             }
-
-            if (javaMethod == null)
-               throw new WSException("Cannot find java method: " + javaName);
          }
-         catch (RuntimeException rte)
-         {
-            throw rte;
-         }
-         catch (Exception ex)
-         {
-            throw new WSException("Cannot load java method: " + javaName);
-         }
       }
-
-      return javaMethod;
+      return isJavaMethod;
    }
 
    /** Return true if this is a generic message style destination that takes a org.w3c.dom.Element
@@ -308,7 +317,7 @@
             paramMetaData.setJavaTypeName(javaType);
             log.debug("Set parameter java type from method param: " + javaType);
          }
-         
+
          if (matchByTypeName)
          {
             pass = methodParam.getName().equals(javaType);
@@ -529,6 +538,8 @@
 
       for (FaultMetaData fault : faults)
          fault.eagerInitialize();
+
+      getJavaMethod();
    }
 
    public String toString()

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -31,6 +31,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.rpc.ParameterMode;
 
+import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
 import org.jboss.ws.WSException;
 import org.jboss.ws.jaxrpc.ParameterWrapping;
@@ -45,6 +46,9 @@
  */
 public class ParameterMetaData
 {
+   // provide logging
+   private final Logger log = Logger.getLogger(ParameterMetaData.class);
+   
    // The parent operation
    private OperationMetaData opMetaData;
 
@@ -118,31 +122,28 @@
    public void setJavaTypeName(String javaTypeName)
    {
       this.javaTypeName = javaTypeName;
+      this.javaType = null;
    }
 
    public Class getJavaType()
    {
-      // If the class loader has changed, make sure we reload the class
-      ClassLoader loader = opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
-      if (loader == null)
-         throw new WSException("ClassLoader not available");
-
-      if (javaTypeName == null)
-         return null;
-
-      if (javaType == null || ((!javaType.isPrimitive()) && javaType.getClassLoader() != loader))
+      Class tmpType = javaType;
+      if (tmpType == null && javaTypeName != null)
       {
          try
          {
-            javaType = JavaUtils.loadJavaType(javaTypeName, loader);
+            ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+            tmpType = JavaUtils.loadJavaType(javaTypeName, loader);
+            
+            if (opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isAllowTypeCaching())
+               javaType = tmpType;
          }
          catch (ClassNotFoundException ex)
          {
             throw new WSException("Cannot load java type: " + javaTypeName, ex);
          }
       }
-
-      return javaType;
+      return tmpType;
    }
 
 

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -69,15 +69,17 @@
    // The list of service meta data
    private List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
    // Used by eager initialization
-   private boolean initialized = false;
+   private boolean allowTypeCaching = false;
 
    public UnifiedMetaData()
    {
-      this.classLoader = Thread.currentThread().getContextClassLoader();
    }
 
    public URLClassLoader getResourceLoader()
    {
+      if (resourceLoader == null)
+         throw new IllegalStateException ("Resource loader not available");
+      
       return resourceLoader;
    }
 
@@ -88,6 +90,9 @@
 
    public ClassLoader getClassLoader()
    {
+      if (classLoader == null)
+         throw new IllegalStateException ("Class loader not available");
+      
       return classLoader;
    }
 
@@ -141,18 +146,27 @@
    }
 
    /**
+    * The final web classloader is not available for JSR181-JSE endpoints when 
+    * the meta data model is build. During that phase no java type should be cached. 
+    */
+   public boolean isAllowTypeCaching()
+   {
+      return allowTypeCaching;
+   }
+
+   /**
     * Eagerly initialize all cache values that are normally lazy-loaded. This
     * allows for concurrent read-only access to a <code>UnifiedMetaData</code>
     * instance. This method, however, must be called from a single thread.
     */
    public void eagerInitialize()
    {
-      if (initialized == false)
+      if (allowTypeCaching == false)
       {
+         allowTypeCaching = true;
+         
          for (ServiceMetaData service : services)
             service.eagerInitialize();
-
-         initialized = true;
       }
    }
 

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpoint.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/server/ServiceEndpoint.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -36,21 +36,19 @@
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPMessage;
 
-import org.jboss.kernel.Kernel;
 import org.jboss.logging.Logger;
-import org.jboss.ws.utils.DOMWriter;
 import org.jboss.ws.Constants;
 import org.jboss.ws.binding.BindingException;
 import org.jboss.ws.common.CommonMessageContext;
 import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
 import org.jboss.ws.metadata.EndpointMetaData;
 import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
 import org.jboss.ws.soap.SOAPElementImpl;
 import org.jboss.ws.soap.SOAPElementWriter;
 import org.jboss.ws.soap.SOAPMessageImpl;
+import org.jboss.ws.utils.DOMWriter;
 import org.w3c.dom.Document;
 
 /**
@@ -100,11 +98,6 @@
 
    public void start() throws Exception
    {
-      // eagerly initialize the UMDM
-      ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
-      UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
-      wsMetaData.eagerInitialize();
-
       seMetrics.start();
       seInfo.setState(State.STARTED);
    }

Modified: branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -84,6 +84,7 @@
          throw new WSException("A service endpoint interface should extend Remote");
 
       um = new UnifiedMetaData();
+      um.setClassLoader(Thread.currentThread().getContextClassLoader());
 
       String seiName = WSDLUtils.getInstance().getJustClassName(seiClass.getName());
       if (serviceName == null)

Modified: branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java	2006-10-07 00:02:13 UTC (rev 1168)
@@ -57,7 +57,7 @@
       assertNotNull(wsdlDef);
    }
 
-   public void testHervletAccess() throws Exception
+   public void testServletAccess() throws Exception
    {
       HttpURLConnection con = (HttpURLConnection)new URL("http://" + getServerHost() + ":8080/test/TestServlet").openConnection();
       BufferedReader isr = new BufferedReader(new InputStreamReader(con.getInputStream()));

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -8,6 +8,9 @@
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
   
+  <global>
+    <package-namespace package="org.jboss.test.ws.jaxws.samples.jsr181ejb" namespace="http://org.jboss.ws/samples/jsr181ejb"/>
+  </global>
   <wsdl-java file="resources/jaxws/samples/jsr181ejb/META-INF/wsdl/TestService.wsdl">
     <mapping file="jaxrpc-mapping.xml" />
   </wsdl-java>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -8,6 +8,9 @@
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
   
+  <global>
+    <package-namespace package="org.jboss.test.ws.jaxws.samples.jsr181pojo" namespace="http://org.jboss.ws/samples/jsr181pojo"/>
+  </global>
   <wsdl-java file="resources/jaxws/samples/jsr181pojo/META-INF/wsdl/TestService.wsdl">
     <mapping file="jaxrpc-mapping.xml" />
   </wsdl-java>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -8,6 +8,9 @@
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
   
+  <global>
+    <package-namespace package="org.jboss.test.ws.jaxws.samples.wsaddressing" namespace="http://org.jboss.ws/samples/wsaddressing"/>
+  </global>
   <wsdl-java file="resources/jaxws/samples/wsaddressing/META-INF/wsdl/TestService.wsdl">
     <mapping file="jaxrpc-mapping.xml"/>
   </wsdl-java>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/jaxrpc-mapping.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/jaxrpc-mapping.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/jaxrpc-mapping.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -1,10 +1,10 @@
 <?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
  <package-mapping>
-  <package-type>ws.jboss.org.addressing.replyto</package-type>
+  <package-type>org.jboss.test.ws.jaxws.wsaddressing.replyto</package-type>
   <namespaceURI>http://org.jboss.ws/addressing/replyto</namespaceURI>
  </package-mapping>
  <service-interface-mapping>
-  <service-interface>ws.jboss.org.addressing.replyto.FaultToEndpointService</service-interface>
+  <service-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.FaultToEndpointService</service-interface>
   <wsdl-service-name xmlns:serviceNS='http://org.jboss.ws/addressing/replyto'>serviceNS:FaultToEndpointService</wsdl-service-name>
   <port-mapping>
    <port-name>FaultToEndpointPort</port-name>
@@ -12,7 +12,7 @@
   </port-mapping>
  </service-interface-mapping>
  <service-endpoint-interface-mapping>
-  <service-endpoint-interface>ws.jboss.org.addressing.replyto.FaultToEndpoint</service-endpoint-interface>
+  <service-endpoint-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.FaultToEndpoint</service-endpoint-interface>
   <wsdl-port-type xmlns:portTypeNS='http://org.jboss.ws/addressing/replyto'>portTypeNS:FaultToEndpoint</wsdl-port-type>
   <wsdl-binding xmlns:bindingNS='http://org.jboss.ws/addressing/replyto'>bindingNS:FaultToEndpointBinding</wsdl-binding>
   <service-endpoint-method-mapping>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/wstools-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/wstools-config.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/FaultTo-META-INF/wstools-config.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -8,6 +8,9 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
   
+  <global>
+    <package-namespace package="org.jboss.test.ws.jaxws.wsaddressing.replyto" namespace="http://org.jboss.ws/addressing/replyto"/>
+  </global>
   <wsdl-java file="http://localhost:8080/jaxws-wsaddressing-faultto/FaultToEndpoint?wsdl">    
     <mapping file="jaxrpc-mapping.xml" />
   </wsdl-java>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -1,10 +1,10 @@
 <?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
  <package-mapping>
-  <package-type>ws.jboss.org.addressing.replyto</package-type>
+  <package-type>org.jboss.test.ws.jaxws.wsaddressing.replyto</package-type>
   <namespaceURI>http://org.jboss.ws/addressing/replyto</namespaceURI>
  </package-mapping>
  <service-interface-mapping>
-  <service-interface>ws.jboss.org.addressing.replyto.InitialEndpointService</service-interface>
+  <service-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.InitialEndpointService</service-interface>
   <wsdl-service-name xmlns:serviceNS='http://org.jboss.ws/addressing/replyto'>serviceNS:InitialEndpointService</wsdl-service-name>
   <port-mapping>
    <port-name>InitialEndpointPort</port-name>
@@ -12,7 +12,7 @@
   </port-mapping>
  </service-interface-mapping>
  <service-endpoint-interface-mapping>
-  <service-endpoint-interface>ws.jboss.org.addressing.replyto.InitialEndpoint</service-endpoint-interface>
+  <service-endpoint-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.InitialEndpoint</service-endpoint-interface>
   <wsdl-port-type xmlns:portTypeNS='http://org.jboss.ws/addressing/replyto'>portTypeNS:InitialEndpoint</wsdl-port-type>
   <wsdl-binding xmlns:bindingNS='http://org.jboss.ws/addressing/replyto'>bindingNS:InitialEndpointBinding</wsdl-binding>
   <service-endpoint-method-mapping>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -8,6 +8,9 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
   
+  <global>
+    <package-namespace package="org.jboss.test.ws.jaxws.wsaddressing.replyto" namespace="http://org.jboss.ws/addressing/replyto"/>
+  </global>
   <wsdl-java file="http://localhost:8080/jaxws-wsaddressing-initial/InitialService?wsdl">
     <mapping file="jaxrpc-mapping.xml" />
   </wsdl-java>

Modified: branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml
===================================================================
--- branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml	2006-10-06 18:44:22 UTC (rev 1167)
+++ branches/tdiesler/jbossws-1.0/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml	2006-10-07 00:02:13 UTC (rev 1168)
@@ -8,6 +8,9 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
   
+  <global>
+    <package-namespace package="org.jboss.test.ws.jaxws.wsaddressing.replyto" namespace="http://org.jboss.ws/addressing/replyto"/>
+  </global>
   <wsdl-java file="http://localhost:8080/jaxws-wsaddressing-replyto/ReplyToService?wsdl">    
     <mapping file="jaxrpc-mapping.xml" />
   </wsdl-java>




More information about the jboss-svn-commits mailing list