geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r149105 - in geronimo/trunk/modules: axis-builder/src/java/org/apache/geronimo/axis/builder axis/src/java/org/apache/geronimo/axis/client
Date Sun, 30 Jan 2005 05:43:59 GMT
Author: djencks
Date: Sat Jan 29 21:43:58 2005
New Revision: 149105

URL: http://svn.apache.org/viewcvs?view=rev&rev=149105
Log:
compute the superIndex in the deserialized objects classloader
Modified:
   geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
   geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/OperationInfo.java
   geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
   geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?view=diff&rev=149105&p1=geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java&r1=149104&p2=geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java&r2=149105
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
Sat Jan 29 21:43:58 2005
@@ -49,16 +49,14 @@
 import javax.wsdl.extensions.soap.SOAPBody;
 import javax.wsdl.extensions.soap.SOAPOperation;
 import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
 import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
 import net.sf.cglib.core.DefaultGeneratorStrategy;
-import net.sf.cglib.core.Signature;
 import net.sf.cglib.proxy.Callback;
 import net.sf.cglib.proxy.Enhancer;
 import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
 import net.sf.cglib.proxy.NoOp;
 import net.sf.cglib.reflect.FastClass;
 import net.sf.cglib.reflect.FastConstructor;
@@ -87,9 +85,9 @@
 import org.apache.geronimo.naming.reference.DeserializingReference;
 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingDocument;
 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType;
+import org.apache.geronimo.xbeans.j2ee.MethodParamPartsMappingType;
 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointInterfaceMappingType;
 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType;
-import org.apache.geronimo.xbeans.j2ee.MethodParamPartsMappingType;
 import org.apache.xmlbeans.XmlException;
 import org.objectweb.asm.Type;
 import org.xml.sax.InputSource;
@@ -249,32 +247,32 @@
             Style portStyle = Style.getStyle(portStyleString);
             PortType portType = binding.getPortType();
             SOAPAddress soapAddress = (SOAPAddress) getExtensibilityElement(SOAPAddress.class,
port.getExtensibilityElements());
-             String locationURIString = soapAddress.getLocationURI();
-             URL location = null;
-             try {
-                 location = new URL(locationURIString);
-             } catch (MalformedURLException e) {
-                 throw new DeploymentException("Could not construct web service location
URL from " + locationURIString);
-             }
+            String locationURIString = soapAddress.getLocationURI();
+            URL location = null;
+            try {
+                location = new URL(locationURIString);
+            } catch (MalformedURLException e) {
+                throw new DeploymentException("Could not construct web service location URL
from " + locationURIString);
+            }
 
-                        SEIFactory seiFactory;
+            SEIFactory seiFactory;
 
             Class serviceEndpointInterface = null;
             ServiceEndpointInterfaceMappingType[] endpointMappings = mapping.getServiceEndpointInterfaceMappingArray();
+            //port type corresponds to SEI
+            List operations = portType.getOperations();
+            OperationInfo[] operationInfos = new OperationInfo[operations.size()];
             if (endpointMappings.length == 0) {
                 serviceEndpointInterface = getServiceEndpointInterfaceLightweight(serviceInterface,
port);
                 Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface,
context, module, classloader);
 
-                 //port type corresponds to SEI
-                List operations = portType.getOperations();
-                OperationInfo[] operationInfos = new OperationInfo[FastClass.create(enhancedServiceEndpointClass).getMaxIndex()
+ 1];
+                int i = 0;
                 for (Iterator ops = operations.iterator(); ops.hasNext();) {
                     Operation operation = (Operation) ops.next();
                     Method method = getMethodForOperation(enhancedServiceEndpointClass, operation);
-                    BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(),
operation.getInput().getName(), operation.getOutput() == null? null: operation.getOutput().getName());
+                    BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(),
operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
                     OperationInfo operationInfo = buildOperationInfo(method, bindingOperation,
portStyle, soapVersion);
-                    int methodIndex = getSuperIndex(enhancedServiceEndpointClass, method);
-                    operationInfos[methodIndex] = operationInfo;
+                    operationInfos[i++] = operationInfo;
                 }
                 List typeMappings = new ArrayList();
                 seiFactory = createSEIFactory(enhancedServiceEndpointClass, serviceImpl,
typeMappings, location, operationInfos, context, classloader);
@@ -289,13 +287,11 @@
                 }
                 Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface,
context, module, classloader);
 
-                 //port type corresponds to SEI
-                List operations = portType.getOperations();
                 ServiceEndpointMethodMappingType[] methodMappings = endpointMapping.getServiceEndpointMethodMappingArray();
-                OperationInfo[] operationInfos = new OperationInfo[FastClass.create(enhancedServiceEndpointClass).getMaxIndex()
+ 1];
+                int i = 0;
                 for (Iterator ops = operations.iterator(); ops.hasNext();) {
                     Operation operation = (Operation) ops.next();
-                    BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(),
operation.getInput().getName(), operation.getOutput() == null? null: operation.getOutput().getName());
+                    BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(),
operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
                     ServiceEndpointMethodMappingType methodMapping = getMethodMappingForOperation(operation,
methodMappings);
                     String javaMethodName = methodMapping.getJavaMethodName().getStringValue().trim();
                     Class[] types = getParameterTypes(methodMapping, classloader);
@@ -306,8 +302,7 @@
                         throw new DeploymentException("Could not find method for operation",
e);
                     }
                     OperationInfo operationInfo = buildOperationInfo(method, bindingOperation,
portStyle, soapVersion);
-                    int methodIndex = getSuperIndex(enhancedServiceEndpointClass, method);
-                    operationInfos[methodIndex] = operationInfo;
+                    operationInfos[i++] = operationInfo;
                 }
                 List typeMappings = new ArrayList();
                 seiFactory = createSEIFactory(enhancedServiceEndpointClass, serviceImpl,
typeMappings, location, operationInfos, context, classloader);
@@ -458,13 +453,13 @@
         QName returnQName = null;
 
         Message inputMessage = operation.getInput().getMessage();
-        Message outputMessage = operation.getOutput() == null? null: operation.getOutput().getMessage();
+        Message outputMessage = operation.getOutput() == null ? null : operation.getOutput().getMessage();
 
         if (order == null || order.size() == 0) {
             if (outputMessage != null && outputMessage.getParts().size() > 1)
{
 //                throw new DeploymentException("We don't handle multiple out params unless
you supply the parameter order!");
                 System.out.println("We don't handle multiple out params unless you supply
the parameter order!");
-                return null;
+                return new OperationInfo(null, false, null, null, null, method.getName(),
Type.getMethodDescriptor(method));
             }
             Class[] methodParamTypes = method.getParameterTypes();
             Map inputParts = inputMessage.getParts();
@@ -495,7 +490,7 @@
             //todo fix this
 //            throw new DeploymentException("specified parameter order NYI");
             System.out.println("specified parameter order NYI");
-            return null;
+            return new OperationInfo(null, false, null, null, null, method.getName(), Type.getMethodDescriptor(method));
         }
         ParameterDesc[] parameterDescs = (ParameterDesc[]) parameterList.toArray(new ParameterDesc[parameterList.size()]);
         OperationDesc operationDesc = new OperationDesc(operationName, parameterDescs, returnQName);
@@ -526,18 +521,10 @@
         boolean usesSOAPAction = (soapActionURI != null);
         QName operationQName = new QName("", operation.getName());
 
-        OperationInfo operationInfo = new OperationInfo(operationDesc, usesSOAPAction, soapActionURI,
soapVersion, operationQName);
+        String methodName = method.getName();
+        String methodDesc = Type.getMethodDescriptor(method);
+        OperationInfo operationInfo = new OperationInfo(operationDesc, usesSOAPAction, soapActionURI,
soapVersion, operationQName, methodName, methodDesc);
         return operationInfo;
-    }
-
-    //from openejb MethodHelper
-    public static int getSuperIndex(Class proxyType, Method method) {
-        Signature signature = new Signature(method.getName(), Type.getReturnType(method),
Type.getArgumentTypes(method));
-        MethodProxy methodProxy = MethodProxy.find(proxyType, signature);
-        if (methodProxy != null) {
-            return methodProxy.getSuperIndex();
-        }
-        return -1;
     }
 
 

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/OperationInfo.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/OperationInfo.java?view=diff&rev=149105&p1=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/OperationInfo.java&r1=149104&p2=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/OperationInfo.java&r2=149105
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/OperationInfo.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/OperationInfo.java
Sat Jan 29 21:43:58 2005
@@ -23,6 +23,7 @@
 import org.apache.axis.description.OperationDesc;
 import org.apache.axis.client.Call;
 import org.apache.axis.soap.SOAPConstants;
+import net.sf.cglib.core.Signature;
 
 /**
  * @version $Rev:  $ $Date:  $
@@ -34,13 +35,21 @@
     private final String soapActionURI;
     private final SOAPConstants soapVersion;
     private final QName operationName;
+    private final String methodName;
+    private final String methodDesc;
 
-    public OperationInfo(OperationDesc operationDesc, boolean useSOAPAction, String soapActionURI,
SOAPConstants soapVersion, QName operationName) {
+    public OperationInfo(OperationDesc operationDesc, boolean useSOAPAction, String soapActionURI,
SOAPConstants soapVersion, QName operationName, String methodName, String methodDesc) {
         this.operationDesc = operationDesc;
         this.useSOAPAction = useSOAPAction;
         this.soapActionURI = soapActionURI;
         this.soapVersion = soapVersion;
         this.operationName = operationName;
+        this.methodName = methodName;
+        this.methodDesc = methodDesc;
+    }
+
+    public Signature getSignature() {
+        return new Signature(methodName, methodDesc);
     }
 
     public OperationDesc getOperationDesc() {

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java?view=diff&rev=149105&p1=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java&r1=149104&p2=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java&r2=149105
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
Sat Jan 29 21:43:58 2005
@@ -27,8 +27,10 @@
 
 import net.sf.cglib.proxy.Callback;
 import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodProxy;
 import net.sf.cglib.reflect.FastConstructor;
 import net.sf.cglib.reflect.FastClass;
+import net.sf.cglib.core.Signature;
 import org.apache.axis.client.Service;
 
 /**
@@ -43,6 +45,7 @@
     private final Object serviceImpl;
     private final List typeMappings;
     private final URL location;
+    private transient OperationInfo[] sortedOperationInfos;
 
     public SEIFactoryImpl(Class serviceEndpointClass, OperationInfo[] operationInfos, Object
serviceImpl, List typeMappings, URL location, ClassLoader classLoader) throws ClassNotFoundException
{
         this.serviceEndpointClass = serviceEndpointClass;
@@ -53,12 +56,20 @@
         this.serviceImpl = serviceImpl;
         this.typeMappings = typeMappings;
         this.location = location;
+        sortedOperationInfos = new OperationInfo[FastClass.create(serviceEndpointClass).getMaxIndex()
+ 1];
+        for (int i = 0; i < operationInfos.length; i++) {
+            OperationInfo operationInfo = operationInfos[i];
+            Signature signature = operationInfo.getSignature();
+            MethodProxy methodProxy = MethodProxy.find(serviceEndpointClass, signature);
+            int index = methodProxy.getSuperIndex();
+            sortedOperationInfos[index] = operationInfo;
+        }
     }
 
     public Remote createServiceEndpoint() throws ServiceException {
         Service service = ((ServiceImpl)serviceImpl).getService();
         GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(service, typeMappings,
location);
-        Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, operationInfos);
+        Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, sortedOperationInfos);
         Callback[] callbacks = new Callback[]{SerializableNoOp.INSTANCE, callback};
         Enhancer.registerCallbacks(serviceEndpointClass, callbacks);
         try {

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java?view=diff&rev=149105&p1=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java&r1=149104&p2=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java&r2=149105
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
Sat Jan 29 21:43:58 2005
@@ -18,6 +18,7 @@
 
 import java.lang.reflect.Method;
 import java.io.Serializable;
+import java.util.Arrays;
 
 import net.sf.cglib.proxy.MethodInterceptor;
 import net.sf.cglib.proxy.MethodProxy;
@@ -40,7 +41,7 @@
         int index = methodProxy.getSuperIndex();
         OperationInfo operationInfo = operations[index];
         if (operationInfo == null) {
-            throw new RuntimeException("Operation not mapped: " + method.getName());
+            throw new RuntimeException("Operation not mapped: " + method.getName() + " index:
" + index + "\n OperationInfos: " + Arrays.asList(operations));
         }
         stub.checkCachedEndpoint();
 

Mime
View raw message