geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r394442 - in /geronimo/branches/1.1/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/ axis-builder/src/test/org/apache/geronimo/axis/builder/ axis/ axis/src/java/org/apache/geronimo/axis/client/
Date Sun, 16 Apr 2006 08:08:15 GMT
Author: djencks
Date: Sun Apr 16 01:08:12 2006
New Revision: 394442

URL: http://svn.apache.org/viewcvs?rev=394442&view=rev
Log:
GERONIMO-1863 stop saving enhanced classes in web service clients

Added:
    geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/AxisServiceReference.java
Modified:
    geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
    geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
    geronimo/branches/1.1/modules/axis/project.xml
    geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java

Modified: geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?rev=394442&r1=394441&r2=394442&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
(original)
+++ geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
Sun Apr 16 01:08:12 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.geronimo.axis.builder;
 
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URI;
@@ -33,6 +31,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.jar.JarFile;
+
 import javax.wsdl.Binding;
 import javax.wsdl.BindingOperation;
 import javax.wsdl.Definition;
@@ -44,28 +43,16 @@
 import javax.xml.namespace.QName;
 import javax.xml.rpc.handler.HandlerInfo;
 
-import net.sf.cglib.core.DefaultGeneratorStrategy;
-import net.sf.cglib.proxy.Callback;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.NoOp;
-import net.sf.cglib.reflect.FastClass;
-import net.sf.cglib.reflect.FastConstructor;
-import org.apache.axis.client.Service;
 import org.apache.axis.constants.Style;
 import org.apache.axis.description.JavaServiceDesc;
 import org.apache.axis.handlers.HandlerInfoChainFactory;
 import org.apache.axis.handlers.soap.SOAPService;
 import org.apache.axis.providers.java.RPCProvider;
 import org.apache.axis.soap.SOAPConstants;
-import org.apache.geronimo.axis.client.GenericServiceEndpointWrapper;
-import org.apache.geronimo.axis.client.NoOverrideCallbackFilter;
+import org.apache.geronimo.axis.client.AxisServiceReference;
 import org.apache.geronimo.axis.client.OperationInfo;
 import org.apache.geronimo.axis.client.SEIFactory;
 import org.apache.geronimo.axis.client.SEIFactoryImpl;
-import org.apache.geronimo.axis.client.SerializableNoOp;
-import org.apache.geronimo.axis.client.ServiceImpl;
-import org.apache.geronimo.axis.client.ServiceMethodInterceptor;
 import org.apache.geronimo.axis.server.AxisWebServiceContainer;
 import org.apache.geronimo.axis.server.POJOProvider;
 import org.apache.geronimo.axis.server.ServiceInfo;
@@ -91,7 +78,7 @@
  * @version $Rev$ $Date$
  */
 public class AxisBuilder implements ServiceReferenceBuilder, WebServiceBuilder {
-    private static final Class[] SERVICE_CONSTRUCTOR_TYPES = new Class[]{Map.class, Map.class};
+//    private static final Class[] SERVICE_CONSTRUCTOR_TYPES = new Class[]{Map.class, Map.class};
 
     private static final SOAPConstants SOAP_VERSION = SOAPConstants.SOAP11_CONSTANTS;
 
@@ -122,13 +109,13 @@
         HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(serviceInfo.getHandlerInfos());
         service.setOption(org.apache.axis.Constants.ATTR_HANDLERINFOCHAIN, handlerInfoChainFactory);
 
-        URI location = null;
+        URI location;
         try {
             location = new URI(serviceDesc.getEndpointURL());
         } catch (URISyntaxException e) {
             throw new DeploymentException("Invalid webservice endpoint URI", e);
         }
-        URI wsdlURI = null;
+        URI wsdlURI;
         try {
             wsdlURI = new URI(serviceDesc.getWSDLFile());
         } catch (URISyntaxException e) {
@@ -145,10 +132,9 @@
         ServiceInfo serviceInfo = AxisServiceBuilder.createServiceInfo(portInfo, classLoader);
         targetGBean.setAttribute("serviceInfo", serviceInfo);
         JavaServiceDesc serviceDesc = serviceInfo.getServiceDesc();
-        URI location = null;
-        location = portInfo.getContextURI();
+       URI location = portInfo.getContextURI();
         targetGBean.setAttribute("location", location);
-        URI wsdlURI = null;
+        URI wsdlURI;
         try {
             wsdlURI = new URI(serviceDesc.getWSDLFile());
         } catch (URISyntaxException e) {
@@ -170,20 +156,19 @@
             mapping = WSDescriptorParser.readJaxrpcMapping(moduleFile, jaxrpcMappingURI);
         }
 
-        Object service = createService(serviceInterface, schemaInfoBuilder, mapping, serviceQName,
SOAP_VERSION, handlerInfos, gerServiceRefType, deploymentContext, module, classLoader);
-        return service;
+        return createService(serviceInterface, schemaInfoBuilder, mapping, serviceQName,
SOAP_VERSION, handlerInfos, gerServiceRefType, deploymentContext, module, classLoader);
     }
 
     public Object createService(Class serviceInterface, SchemaInfoBuilder schemaInfoBuilder,
JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, List handlerInfos,
GerServiceRefType serviceRefType, DeploymentContext context, Module module, ClassLoader classloader)
throws DeploymentException {
         Map seiPortNameToFactoryMap = new HashMap();
         Map seiClassNameToFactoryMap = new HashMap();
-        Object serviceInstance = createServiceInterfaceProxy(serviceInterface, seiPortNameToFactoryMap,
seiClassNameToFactoryMap, context, module, classloader);
         if (schemaInfoBuilder != null) {
-            buildSEIFactoryMap(serviceInterface, schemaInfoBuilder, serviceRefType, mapping,
handlerInfos, serviceQName, soapVersion, seiPortNameToFactoryMap, seiClassNameToFactoryMap,
serviceInstance, context, module, classloader);
+            buildSEIFactoryMap(schemaInfoBuilder, serviceRefType, mapping, handlerInfos,
serviceQName, soapVersion, seiPortNameToFactoryMap, seiClassNameToFactoryMap, classloader);
         }
-        return serviceInstance;
+        return new AxisServiceReference(serviceInterface.getName(), seiPortNameToFactoryMap,
seiClassNameToFactoryMap);
     }
 
+/*
     public Object createServiceInterfaceProxy(Class serviceInterface, Map seiPortNameToFactoryMap,
Map seiClassNameToFactoryMap, DeploymentContext deploymentContext, Module module, ClassLoader
classLoader) throws DeploymentException {
 
         Callback callback = new ServiceMethodInterceptor(seiPortNameToFactoryMap);
@@ -216,8 +201,9 @@
             throw new DeploymentException("Could not construct service instance", e.getTargetException());
         }
     }
+*/
 
-    public void buildSEIFactoryMap(Class serviceInterface, SchemaInfoBuilder schemaInfoBuilder,
GerServiceRefType serviceRefType, JavaWsdlMappingType mapping, List handlerInfos, QName serviceQName,
SOAPConstants soapVersion, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, Object
serviceImpl, DeploymentContext context, Module module, ClassLoader classLoader) throws DeploymentException
{
+    public void buildSEIFactoryMap(SchemaInfoBuilder schemaInfoBuilder, GerServiceRefType
serviceRefType, JavaWsdlMappingType mapping, List handlerInfos, QName serviceQName, SOAPConstants
soapVersion, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, ClassLoader classLoader)
throws DeploymentException {
         Map exceptionMap = WSDescriptorParser.getExceptionMap(mapping);
 
         Definition definition = schemaInfoBuilder.getDefinition();
@@ -246,7 +232,7 @@
                     throw new DeploymentException("No binding found with qname: " + bindingQName);
                 }
                 String credentialsName = port.isSetCredentialsName() ? port.getCredentialsName().trim()
: null;
-                mapBinding(binding, mapping, serviceQName, classLoader, context, module,
soapVersion, schemaInfoBuilder, portName, serviceImpl, location, handlerInfos, seiPortNameToFactoryMap,
seiClassNameToFactoryMap, credentialsName, exceptionMap);
+                mapBinding(binding, mapping, serviceQName, classLoader, soapVersion, schemaInfoBuilder,
portName, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName,
exceptionMap);
 
             }
         } else {
@@ -288,12 +274,12 @@
 
                 Binding binding = port.getBinding();
 
-                mapBinding(binding, mapping, serviceQName, classLoader, context, module,
soapVersion, schemaInfoBuilder, portName, serviceImpl, location, handlerInfos, seiPortNameToFactoryMap,
seiClassNameToFactoryMap, credentialsName, exceptionMap);
+                mapBinding(binding, mapping, serviceQName, classLoader, soapVersion, schemaInfoBuilder,
portName, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName,
exceptionMap);
             }
         }
     }
 
-    private void mapBinding(Binding binding, JavaWsdlMappingType mapping, QName serviceQName,
ClassLoader classLoader, DeploymentContext context, Module module, SOAPConstants soapVersion,
SchemaInfoBuilder schemaInfoBuilder, String portName, Object serviceImpl, URL location, List
handlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, String credentialsName,
Map exceptionMap) throws DeploymentException {
+    private void mapBinding(Binding binding, JavaWsdlMappingType mapping, QName serviceQName,
ClassLoader classLoader, SOAPConstants soapVersion, SchemaInfoBuilder schemaInfoBuilder, String
portName, URL location, List handlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap,
String credentialsName, Map exceptionMap) throws DeploymentException {
         Style portStyle = getStyle(binding);
 
         PortType portType = binding.getPortType();
@@ -305,9 +291,9 @@
         List operations = portType.getOperations();
         OperationInfo[] operationInfos = new OperationInfo[operations.size()];
         if (endpointMappings.length == 0) {
-            doLightweightMapping(serviceQName, portType, mapping, classLoader, context, module,
operations, binding, portStyle, soapVersion, operationInfos, schemaInfoBuilder, portName,
serviceImpl, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName);
+            doLightweightMapping(serviceQName, portType, mapping, classLoader, operations,
binding, portStyle, soapVersion, operationInfos, schemaInfoBuilder, portName, location, handlerInfos,
seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName);
         } else {
-            doHeavyweightMapping(serviceQName, portType, endpointMappings, classLoader, context,
module, operations, binding, portStyle, soapVersion, exceptionMap, schemaInfoBuilder, mapping,
operationInfos, portName, serviceImpl, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap,
credentialsName);
+            doHeavyweightMapping(serviceQName, portType, endpointMappings, classLoader, operations,
binding, portStyle, soapVersion, exceptionMap, schemaInfoBuilder, mapping, operationInfos,
portName, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName);
         }
     }
 
@@ -351,12 +337,11 @@
         SOAPBinding soapBinding = (SOAPBinding) SchemaInfoBuilder.getExtensibilityElement(SOAPBinding.class,
binding.getExtensibilityElements());
 //            String transportURI = soapBinding.getTransportURI();
         String portStyleString = soapBinding.getStyle();
-        Style portStyle = Style.getStyle(portStyleString);
-        return portStyle;
+        return Style.getStyle(portStyleString);
     }
 
     private URL getAddressLocation(Port port) throws DeploymentException {
-        SOAPAddress soapAddress = null;
+        SOAPAddress soapAddress;
         try {
             soapAddress = (SOAPAddress) SchemaInfoBuilder.getExtensibilityElement(SOAPAddress.class,
port.getExtensibilityElements());
         } catch (DeploymentException e) {
@@ -364,7 +349,7 @@
             return null;
         }
         String locationURIString = soapAddress.getLocationURI();
-        URL location = null;
+        URL location;
         try {
             location = new URL(locationURIString);
         } catch (MalformedURLException e) {
@@ -373,7 +358,7 @@
         return location;
     }
 
-    private void doHeavyweightMapping(QName serviceName, PortType portType, ServiceEndpointInterfaceMappingType[]
endpointMappings, ClassLoader classLoader, DeploymentContext context, Module module, List
operations, Binding binding, Style portStyle, SOAPConstants soapVersion, Map exceptionMap,
SchemaInfoBuilder schemaInfoBuilder, JavaWsdlMappingType mapping, OperationInfo[] operationInfos,
String portName, Object serviceImpl, URL location, List handlerInfos, Map seiPortNameToFactoryMap,
Map seiClassNameToFactoryMap, String credentialsName) throws DeploymentException {
+    private void doHeavyweightMapping(QName serviceName, PortType portType, ServiceEndpointInterfaceMappingType[]
endpointMappings, ClassLoader classLoader, List operations, Binding binding, Style portStyle,
SOAPConstants soapVersion, Map exceptionMap, SchemaInfoBuilder schemaInfoBuilder, JavaWsdlMappingType
mapping, OperationInfo[] operationInfos, String portName, URL location, List handlerInfos,
Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, String credentialsName) throws
DeploymentException {
         Class serviceEndpointInterface;
         SEIFactory seiFactory;
         //complete jaxrpc mapping file supplied
@@ -385,7 +370,7 @@
         } catch (ClassNotFoundException e) {
             throw new DeploymentException("Could not load service endpoint interface", e);
         }
-        Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface,
context, module, classLoader);
+//        Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface,
context, module, classLoader);
 
         Collection operationDescs = new ArrayList();
         ServiceEndpointMethodMappingType[] methodMappings = endpointMapping.getServiceEndpointMethodMappingArray();
@@ -411,7 +396,7 @@
                 throw new DeploymentException("No BindingOperation for operation: " + operationName
+ ", input: " + operation.getInput().getName() + ", output: " + (operation.getOutput() ==
null ? "<none>" : operation.getOutput().getName()));
             }
             ServiceEndpointMethodMappingType methodMapping = WSDescriptorParser.getMethodMappingForOperation(operationName,
methodMappings);
-            HeavyweightOperationDescBuilder operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation,
mapping, methodMapping, portStyle, exceptionMap, schemaInfoBuilder, javaXmlTypeMappings, classLoader,
enhancedServiceEndpointClass);
+            HeavyweightOperationDescBuilder operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation,
mapping, methodMapping, portStyle, exceptionMap, schemaInfoBuilder, javaXmlTypeMappings, classLoader,
serviceEndpointInterface);
             OperationInfo operationInfo = operationDescBuilder.buildOperationInfo(soapVersion);
             operationInfos[i++] = operationInfo;
             operationDescs.add(operationInfo.getOperationDesc());
@@ -421,30 +406,29 @@
         HeavyweightTypeInfoBuilder builder = new HeavyweightTypeInfoBuilder(classLoader,
schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), wrapperElementQNames, operationDescs,
hasEncoded);
         List typeInfo = builder.buildTypeInfo(mapping);
 
-        seiFactory = createSEIFactory(serviceName, portName, enhancedServiceEndpointClass,
serviceImpl, typeInfo, location, operationInfos, handlerInfos, credentialsName, context, classLoader);
+        seiFactory = createSEIFactory(serviceName, portName, serviceEndpointInterface.getName(),
typeInfo, location, operationInfos, handlerInfos, credentialsName);
         seiPortNameToFactoryMap.put(portName, seiFactory);
         seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), seiFactory);
     }
 
-    private void doLightweightMapping(QName serviceName, PortType portType, JavaWsdlMappingType
mapping, ClassLoader classLoader, DeploymentContext context, Module module, List operations,
Binding binding, Style portStyle, SOAPConstants soapVersion, OperationInfo[] operationInfos,
SchemaInfoBuilder schemaInfoBuilder, String portName, Object serviceImpl, URL location, List
handlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, String credentialsName)
throws DeploymentException {
+    private void doLightweightMapping(QName serviceName, PortType portType, JavaWsdlMappingType
mapping, ClassLoader classLoader, List operations, Binding binding, Style portStyle, SOAPConstants
soapVersion, OperationInfo[] operationInfos, SchemaInfoBuilder schemaInfoBuilder, String portName,
URL location, List handlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap,
String credentialsName) throws DeploymentException {
         Class serviceEndpointInterface;
         SEIFactory seiFactory;
         //lightweight jaxrpc mapping supplied
         serviceEndpointInterface = getServiceEndpointInterfaceLightweight(portType, mapping,
classLoader);
-        Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface,
context, module, classLoader);
+//        Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface,
context, module, classLoader);
 
         int i = 0;
         for (Iterator ops = operations.iterator(); ops.hasNext();) {
             Operation operation = (Operation) ops.next();
-            Method method = WSDescriptorParser.getMethodForOperation(enhancedServiceEndpointClass,
operation);
+            Method method = WSDescriptorParser.getMethodForOperation(serviceEndpointInterface,
operation);
             BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(),
operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
-            OperationInfo operationInfo = buildOperationInfoLightweight(method, bindingOperation,
portStyle, soapVersion);
-            operationInfos[i++] = operationInfo;
+            operationInfos[i++] = buildOperationInfoLightweight(method, bindingOperation,
portStyle, soapVersion);
         }
         LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader,
schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), Collections.EMPTY_SET);
         List typeInfo = builder.buildTypeInfo(mapping);
 
-        seiFactory = createSEIFactory(serviceName, portName, enhancedServiceEndpointClass,
serviceImpl, typeInfo, location, operationInfos, handlerInfos, credentialsName, context, classLoader);
+        seiFactory = createSEIFactory(serviceName, portName, serviceEndpointInterface.getName(),
typeInfo, location, operationInfos, handlerInfos, credentialsName);
         seiPortNameToFactoryMap.put(portName, seiFactory);
         seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), seiFactory);
     }
@@ -465,14 +449,9 @@
     }
 
 
-    public SEIFactory createSEIFactory(QName serviceName, String portName, Class enhancedServiceEndpointClass,
Object serviceImpl, List typeInfo, URL location, OperationInfo[] operationInfos, List handlerInfoInfos,
String credentialsName, DeploymentContext deploymentContext, ClassLoader classLoader) throws
DeploymentException {
+    public SEIFactory createSEIFactory(QName serviceName, String portName, String enhancedServiceEndpointClassName,
List typeInfo, URL location, OperationInfo[] operationInfos, List handlerInfoInfos, String
credentialsName) throws DeploymentException {
         List handlerInfos = buildHandlerInfosForPort(portName, handlerInfoInfos);
-        try {
-            SEIFactory factory = new SEIFactoryImpl(serviceName, portName, enhancedServiceEndpointClass,
operationInfos, serviceImpl, typeInfo, location, handlerInfos, classLoader, credentialsName);
-            return factory;
-        } catch (ClassNotFoundException e) {
-            throw new DeploymentException("Could not load GenericServiceEndpoint from application
classloader", e);
-        }
+        return new SEIFactoryImpl(serviceName, portName, enhancedServiceEndpointClassName,
operationInfos, typeInfo, location, handlerInfos, credentialsName);
     }
 
     private List buildHandlerInfosForPort(String portName, List handlerInfoInfos) {
@@ -490,6 +469,7 @@
         return handlerInfos;
     }
 
+/*
     public Class enhanceServiceEndpointInterface(Class serviceEndpointInterface, DeploymentContext
deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
         Enhancer enhancer = new Enhancer();
         enhancer.setClassLoader(classLoader);
@@ -512,12 +492,14 @@
         }
         return serviceEndpointClass;
     }
+*/
 
     public OperationInfo buildOperationInfoLightweight(Method method, BindingOperation bindingOperation,
Style defaultStyle, SOAPConstants soapVersion) throws DeploymentException {
         LightweightOperationDescBuilder operationDescBuilder = new LightweightOperationDescBuilder(bindingOperation,
method);
         return operationDescBuilder.buildOperationInfo(soapVersion);
     }
 
+/*
     private static class ByteArrayRetrievingGeneratorStrategy extends DefaultGeneratorStrategy
{
 
         private byte[] classBytes;
@@ -531,6 +513,7 @@
             return classBytes;
         }
     }
+*/
 
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?rev=394442&r1=394441&r2=394442&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
(original)
+++ geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
Sun Apr 16 01:08:12 2006
@@ -62,6 +62,7 @@
 import org.apache.geronimo.axis.client.OperationInfo;
 import org.apache.geronimo.axis.client.SEIFactory;
 import org.apache.geronimo.axis.client.ServiceImpl;
+import org.apache.geronimo.axis.client.AxisServiceReference;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.util.UnpackedJarFile;
@@ -77,6 +78,7 @@
 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingDocument;
 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType;
 import org.apache.geronimo.xbeans.j2ee.PackageMappingType;
+import org.apache.geronimo.naming.reference.ClassLoaderAwareReference;
 
 /**
  * @version $Rev:385232 $ $Date$
@@ -122,6 +124,7 @@
         super.tearDown();
     }
 
+/*
     public void testServiceProxy() throws Exception {
         //construct the SEI proxy
         Map portMap = new HashMap();
@@ -136,7 +139,9 @@
         MockPort mockPort = mockService.getMockPort();
         assertNotNull(mockPort);
     }
+*/
 
+/*
     public void testServiceEndpointProxy() throws Exception {
         AxisBuilder builder = new AxisBuilder();
 
@@ -152,9 +157,8 @@
         assertNotNull(serviceInterfaceFactory);
         Remote serviceInterface = serviceInterfaceFactory.createServiceEndpoint();
         assertTrue(serviceInterface instanceof MockPort);
-//        MockPort mockServiceInterface = (MockPort) serviceInterface;
-//        mockServiceInterface.doMockOperation(null);
     }
+*/
 
     public void testBuildOperationInfo() throws Exception {
         AxisBuilder builder = new AxisBuilder();
@@ -168,8 +172,12 @@
         JavaWsdlMappingType mapping = buildLightweightMappingType();
         QName serviceQName = new QName(NAMESPACE, "MockService");
         AxisBuilder builder = new AxisBuilder();
-        Object proxy = builder.createService(MockService.class, schemaInfoBuilder, mapping,
serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, gerServiceRefType, context, module,
isolatedCl);
-        assertNotNull(proxy);
+        Object reference = builder.createService(MockService.class, schemaInfoBuilder, mapping,
serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, gerServiceRefType, context, module,
isolatedCl);
+        assertNotNull(reference);
+        assertTrue(reference instanceof AxisServiceReference);
+        AxisServiceReference claReference = (AxisServiceReference) reference;
+        claReference.setClassLoader(isolatedCl);
+        Object proxy = claReference.getContent();
         assertTrue(proxy instanceof MockService);
         MockPort mockPort = ((MockService) proxy).getMockPort();
         assertNotNull(mockPort);
@@ -186,8 +194,12 @@
         JavaWsdlMappingType mapping = mappingDocument.getJavaWsdlMapping();
         QName serviceQName = new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote",
"BookQuoteService");
         AxisBuilder builder = new AxisBuilder();
-        Object proxy = builder.createService(BookQuoteService.class, schemaInfoBuilder, mapping,
serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, gerServiceRefType, context, module,
isolatedCl);
-        assertNotNull(proxy);
+        Object reference = builder.createService(BookQuoteService.class, schemaInfoBuilder,
mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, gerServiceRefType, context,
module, isolatedCl);
+        assertNotNull(reference);
+        assertTrue(reference instanceof AxisServiceReference);
+        AxisServiceReference claReference = (AxisServiceReference) reference;
+        claReference.setClassLoader(isolatedCl);
+        Object proxy = claReference.getContent();
         assertTrue(proxy instanceof BookQuoteService);
         BookQuote bookQuote = ((BookQuoteService) proxy).getBookQuotePort();
         assertNotNull(bookQuote);

Modified: geronimo/branches/1.1/modules/axis/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis/project.xml?rev=394442&r1=394441&r2=394442&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis/project.xml (original)
+++ geronimo/branches/1.1/modules/axis/project.xml Sun Apr 16 01:08:12 2006
@@ -52,6 +52,12 @@
 
         <dependency>
             <groupId>geronimo</groupId>
+            <artifactId>geronimo-naming</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
             <artifactId>geronimo-security</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>

Added: geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/AxisServiceReference.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/AxisServiceReference.java?rev=394442&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/AxisServiceReference.java
(added)
+++ geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/AxisServiceReference.java
Sun Apr 16 01:08:12 2006
@@ -0,0 +1,101 @@
+/**
+ *
+ * Copyright 2006 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.geronimo.axis.client;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.naming.NamingException;
+
+import net.sf.cglib.proxy.Callback;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.NoOp;
+import net.sf.cglib.reflect.FastClass;
+import net.sf.cglib.reflect.FastConstructor;
+import org.apache.axis.client.Service;
+import org.apache.geronimo.naming.reference.ClassLoaderAwareReference;
+import org.apache.geronimo.naming.reference.SimpleReference;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class AxisServiceReference extends SimpleReference implements ClassLoaderAwareReference
{
+    private static final Class[] SERVICE_CONSTRUCTOR_TYPES = new Class[]{Map.class, Map.class};
+
+    private String serviceInterfaceClassName;
+    private Map seiPortNameToFactoryMap;
+    private Map seiClassNameToFactoryMap;
+    private ClassLoader classLoader;
+
+    public AxisServiceReference(String serviceInterfaceClassName, Map seiPortNameToFactoryMap,
Map seiClassNameToFactoryMap) {
+        this.serviceInterfaceClassName = serviceInterfaceClassName;
+        this.seiPortNameToFactoryMap = seiPortNameToFactoryMap;
+        this.seiClassNameToFactoryMap = seiClassNameToFactoryMap;
+    }
+
+    public void setClassLoader(ClassLoader classLoader) {
+        this.classLoader = classLoader;
+    }
+
+    public Object getContent() throws NamingException {
+        Class serviceInterface;
+        try {
+            serviceInterface = classLoader.loadClass(serviceInterfaceClassName);
+        } catch (ClassNotFoundException e) {
+            throw new NamingException("Could not load service interface class " + serviceInterfaceClassName);
+        }
+        Object serviceInstance = createServiceInterfaceProxy(serviceInterface, seiPortNameToFactoryMap,
seiClassNameToFactoryMap, classLoader);
+        for (Iterator iterator = seiPortNameToFactoryMap.values().iterator(); iterator.hasNext();)
{
+            SEIFactoryImpl seiFactory = (SEIFactoryImpl) iterator.next();
+            try {
+                seiFactory.initialize(serviceInstance, classLoader);
+            } catch (ClassNotFoundException e) {
+                throw new NamingException("Could not load service interface class; " + e.getMessage());
+            }
+        }
+
+        return serviceInstance;
+    }
+
+    private Object createServiceInterfaceProxy(Class serviceInterface, Map seiPortNameToFactoryMap,
Map seiClassNameToFactoryMap, ClassLoader classLoader) throws NamingException {
+
+        Callback callback = new ServiceMethodInterceptor(seiPortNameToFactoryMap);
+        Callback[] methodInterceptors = new Callback[]{SerializableNoOp.INSTANCE, callback};
+
+        Enhancer enhancer = new Enhancer();
+        enhancer.setClassLoader(classLoader);
+        enhancer.setSuperclass(ServiceImpl.class);
+        enhancer.setInterfaces(new Class[]{serviceInterface});
+        enhancer.setCallbackFilter(new NoOverrideCallbackFilter(Service.class));
+        enhancer.setCallbackTypes(new Class[]{NoOp.class, MethodInterceptor.class});
+        enhancer.setUseFactory(false);
+        enhancer.setUseCache(false);
+        Class serviceClass = enhancer.createClass();
+
+        Enhancer.registerCallbacks(serviceClass, methodInterceptors);
+        FastConstructor constructor = FastClass.create(serviceClass).getConstructor(SERVICE_CONSTRUCTOR_TYPES);
+        try {
+            return constructor.newInstance(new Object[]{seiPortNameToFactoryMap, seiClassNameToFactoryMap});
+        } catch (InvocationTargetException e) {
+            throw (NamingException)new NamingException("Could not construct service instance").initCause(e.getTargetException());
+        }
+    }
+
+}

Modified: geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java?rev=394442&r1=394441&r2=394442&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
(original)
+++ geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
Sun Apr 16 01:08:12 2006
@@ -16,82 +16,77 @@
  */
 package org.apache.geronimo.axis.client;
 
-import java.io.InvalidClassException;
-import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
+import java.math.BigInteger;
 import java.net.MalformedURLException;
-import java.net.URL;
 import java.net.URI;
+import java.net.URL;
 import java.rmi.Remote;
 import java.util.Iterator;
 import java.util.List;
-import java.math.BigInteger;
 
 import javax.xml.namespace.QName;
 import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.encoding.SerializerFactory;
-import javax.xml.rpc.encoding.DeserializerFactory;
 import javax.xml.rpc.handler.HandlerChain;
 
 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;
-
-import org.apache.axis.client.Service;
-import org.apache.axis.description.TypeDesc;
-import org.apache.axis.handlers.HandlerInfoChainFactory;
 import org.apache.axis.AxisEngine;
 import org.apache.axis.Constants;
+import org.apache.axis.client.Service;
 import org.apache.axis.constants.Use;
-import org.apache.axis.encoding.TypeMappingRegistry;
+import org.apache.axis.description.TypeDesc;
 import org.apache.axis.encoding.TypeMapping;
-import org.apache.axis.encoding.ser.SimpleSerializerFactory;
+import org.apache.axis.encoding.TypeMappingRegistry;
 import org.apache.axis.encoding.ser.SimpleDeserializerFactory;
-import org.apache.axis.encoding.ser.BaseSerializerFactory;
-import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+import org.apache.axis.encoding.ser.SimpleSerializerFactory;
+import org.apache.axis.handlers.HandlerInfoChainFactory;
 
 /**
  * @version $Rev$ $Date$
  */
 public class SEIFactoryImpl implements SEIFactory, Serializable {
-    private static final Class[] SERVICE_ENDPOINT_CONSTRUCTOR_TYPES = new Class[]{GenericServiceEndpoint.class};
 
     private final QName serviceName;
     private final QName portQName;
-    private final Class serviceEndpointClass;
+    private final String serviceEndpointClassName;
     private final OperationInfo[] operationInfos;
-    private transient final FastConstructor constructor;
-    private final Object serviceImpl;
+    private transient FastConstructor constructor;
+    private Object serviceImpl;
     private final List typeInfo;
     private final URL location;
     private final List handlerInfos;
     private final String credentialsName;
     private transient HandlerInfoChainFactory handlerInfoChainFactory;
     private transient OperationInfo[] sortedOperationInfos;
-    private boolean initialized = false;
+    private Class serviceEndpointClass;
 
-    public SEIFactoryImpl(QName serviceName, String portName, Class serviceEndpointClass,
OperationInfo[] operationInfos, Object serviceImpl, List typeInfo, URL location, List handlerInfos,
ClassLoader classLoader, String credentialsName) throws ClassNotFoundException {
+    public SEIFactoryImpl(QName serviceName, String portName, String serviceEndpointClassName,
OperationInfo[] operationInfos, List typeInfo, URL location, List handlerInfos, String credentialsName)
{
         this.serviceName = serviceName;
         this.portQName = new QName("", portName);
-        this.serviceEndpointClass = serviceEndpointClass;
+        this.serviceEndpointClassName = serviceEndpointClassName;
         this.operationInfos = operationInfos;
-        Class[] constructorTypes = new java.lang.Class[0];
-        constructorTypes = classLoader == null ? SERVICE_ENDPOINT_CONSTRUCTOR_TYPES : new
Class[]{classLoader.loadClass(GenericServiceEndpoint.class.getName())};
-        this.constructor = FastClass.create(serviceEndpointClass).getConstructor(constructorTypes);
-        this.serviceImpl = serviceImpl;
         this.typeInfo = typeInfo;
         this.location = location;
         this.handlerInfos = handlerInfos;
         this.credentialsName = credentialsName;
-        this.handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos);
-        sortedOperationInfos = new OperationInfo[FastClass.create(serviceEndpointClass).getMaxIndex()
+ 1];
     }
 
-    void initialize() {
+    void initialize(Object serviceImpl, ClassLoader classLoader) throws ClassNotFoundException
{
+        this.serviceImpl = serviceImpl;
+        Class serviceEndpointBaseClass = classLoader.loadClass(serviceEndpointClassName);
+        serviceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointBaseClass,
classLoader);
+        Class[] constructorTypes = new Class[]{classLoader.loadClass(GenericServiceEndpoint.class.getName())};
+        this.constructor = FastClass.create(serviceEndpointClass).getConstructor(constructorTypes);
+        this.handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos);
+        sortedOperationInfos = new OperationInfo[FastClass.create(serviceEndpointClass).getMaxIndex()
+ 1];
         String encodingStyle = "";
         for (int i = 0; i < operationInfos.length; i++) {
             OperationInfo operationInfo = operationInfos[i];
@@ -127,14 +122,26 @@
         TypeInfo.register(typeInfo, typeMapping);
     }
 
+    private Class enhanceServiceEndpointInterface(Class serviceEndpointInterface, ClassLoader
classLoader) {
+        Enhancer enhancer = new Enhancer();
+        enhancer.setClassLoader(classLoader);
+        enhancer.setSuperclass(GenericServiceEndpointWrapper.class);
+        enhancer.setInterfaces(new Class[]{serviceEndpointInterface});
+        enhancer.setCallbackFilter(new NoOverrideCallbackFilter(GenericServiceEndpointWrapper.class));
+        enhancer.setCallbackTypes(new Class[]{NoOp.class, MethodInterceptor.class});
+        enhancer.setUseFactory(false);
+        enhancer.setUseCache(false);
+
+        return enhancer.createClass();
+    }
     public Remote createServiceEndpoint() throws ServiceException {
         //TODO figure out why this can't be called in readResolve!
-        synchronized (this) {
-            if (!initialized) {
-                initialize();
-                initialized = true;
-            }
-        }
+//        synchronized (this) {
+//            if (!initialized) {
+//                initialize();
+//                initialized = true;
+//            }
+//        }
         Service service = ((ServiceImpl) serviceImpl).getService();
         GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(portQName, service,
location);
         Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, sortedOperationInfos,
credentialsName);
@@ -149,19 +156,14 @@
     }
 
     public HandlerChain createHandlerChain() {
-        HandlerChain handlerChain = handlerInfoChainFactory.createHandlerChain();
-        return handlerChain;
+        return handlerInfoChainFactory.createHandlerChain();
     }
 
-    private Object readResolve() throws ObjectStreamException {
-        try {
-            SEIFactoryImpl seiFactory =  new SEIFactoryImpl(serviceName, portQName.getLocalPart(),
serviceEndpointClass, operationInfos, serviceImpl, typeInfo, location, handlerInfos, null,
credentialsName);
+//    private Object readResolve() throws ObjectStreamException {
+//            SEIFactoryImpl seiFactory =  new SEIFactoryImpl(serviceName, portQName.getLocalPart(),
serviceEndpointClassName, operationInfos, typeInfo, location, handlerInfos, credentialsName);
 //            seiFactory.initialize();
-            return seiFactory;
-        } catch (ClassNotFoundException e) {
-            throw new InvalidClassException(GenericServiceEndpoint.class.getName(), "this
is impossible");
-        }
-    }
+//            return seiFactory;
+//    }
 
     public OperationInfo[] getOperationInfos() {
         return operationInfos;



Mime
View raw message