Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 5543 invoked from network); 2 Mar 2005 00:22:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Mar 2005 00:22:50 -0000 Received: (qmail 44510 invoked by uid 500); 2 Mar 2005 00:22:50 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 44496 invoked by uid 500); 2 Mar 2005 00:22:50 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 44481 invoked by uid 99); 2 Mar 2005 00:22:49 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 01 Mar 2005 16:22:49 -0800 Received: (qmail 5523 invoked by uid 65534); 2 Mar 2005 00:22:48 -0000 Message-ID: <20050302002248.5521.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Wed, 02 Mar 2005 00:22:47 -0000 Subject: svn commit: r155844 - in geronimo/trunk/modules/axis-builder/src: java/org/apache/geronimo/axis/builder/AxisBuilder.java test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java To: scm@geronimo.apache.org From: dblevins@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: dblevins Date: Tue Mar 1 16:22:45 2005 New Revision: 155844 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D155844 Log: More poking at the AxisBuilder to clean it up a bit. Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/b= uilder/AxisBuilder.java geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/b= uilder/ServiceReferenceTest.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=3Ddiff&r1=3D155= 843&r2=3D155844 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/b= uilder/AxisBuilder.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/b= uilder/AxisBuilder.java Tue Mar 1 16:22:45 2005 @@ -115,14 +115,14 @@ public Object createService(Class serviceInterface, Definition definit= ion, JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVer= sion, List handlerInfos, Map portLocationMap, DeploymentContext context, Mo= dule module, ClassLoader classloader) throws DeploymentException { Map seiPortNameToFactoryMap =3D new HashMap(); Map seiClassNameToFactoryMap =3D new HashMap(); - Object serviceInstance =3D createService(serviceInterface, seiPort= NameToFactoryMap, seiClassNameToFactoryMap, context, module, classloader); + Object serviceInstance =3D createServiceInterfaceProxy(serviceInte= rface, seiPortNameToFactoryMap, seiClassNameToFactoryMap, context, module, = classloader); if (definition !=3D null) { buildSEIFactoryMap(serviceInterface, definition, portLocationM= ap, mapping, handlerInfos, serviceQName, soapVersion, seiPortNameToFactoryM= ap, seiClassNameToFactoryMap, serviceInstance, context, module, classloader= ); } return serviceInstance; } =20 - public Object createService(Class serviceInterface, Map seiPortNameToF= actoryMap, Map seiClassNameToFactoryMap, DeploymentContext deploymentContex= t, Module module, ClassLoader classLoader) throws DeploymentException { + public Object createServiceInterfaceProxy(Class serviceInterface, Map = seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, DeploymentContext de= ploymentContext, Module module, ClassLoader classLoader) throws DeploymentE= xception { =20 Callback callback =3D new ServiceMethodInterceptor(seiPortNameToFa= ctoryMap); Callback[] methodInterceptors =3D new Callback[]{SerializableNoOp.= INSTANCE, callback}; @@ -157,106 +157,134 @@ public void buildSEIFactoryMap(Class serviceInterface, Definition defi= nition, Map portLocationMap, JavaWsdlMappingType mapping, List handlerInfos= , QName serviceQName, SOAPConstants soapVersion, Map seiPortNameToFactoryMa= p, Map seiClassNameToFactoryMap, Object serviceImpl, DeploymentContext cont= ext, Module module, ClassLoader classLoader) throws DeploymentException { =20 //find the service we are working with - javax.wsdl.Service service; - if (serviceQName !=3D null) { - service =3D definition.getService(serviceQName); - } else { - Map services =3D definition.getServices(); - if (services.size() !=3D 1) { - throw new DeploymentException("no serviceQName supplied, a= nd there are " + services.size() + " services"); - } - service =3D (javax.wsdl.Service) services.values().iterator().= next(); - } - if (service =3D=3D null) { - throw new DeploymentException("No service wsdl for supplied se= rvice qname " + serviceQName); - } + javax.wsdl.Service service =3D getService(serviceQName, definition= ); + if (portLocationMap !=3D null) { WSDescriptorParser.updatePortLocations(service, portLocationMa= p); } =20 - Map wsdlPortMap =3D service.getPorts(); - Map exceptionMap =3D WSDescriptorParser.getExceptionMap(mapping); Map schemaTypeKeyToSchemaTypeMap =3D WSDescriptorParser.buildSchem= aTypeKeyToSchemaTypeMap(definition); Map complexTypeMap =3D WSDescriptorParser.getComplexTypesInWsdl(sc= hemaTypeKeyToSchemaTypeMap); =20 + Map wsdlPortMap =3D service.getPorts(); for (Iterator iterator =3D wsdlPortMap.entrySet().iterator(); iter= ator.hasNext();) { Map.Entry entry =3D (Map.Entry) iterator.next(); String portName =3D (String) entry.getKey(); Port port =3D (Port) entry.getValue(); =20 - SOAPAddress soapAddress =3D (SOAPAddress) WSDescriptorParser.g= etExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); - String locationURIString =3D soapAddress.getLocationURI(); - URL location =3D null; - try { - location =3D new URL(locationURIString); - } catch (MalformedURLException e) { - throw new DeploymentException("Could not construct web ser= vice location URL from " + locationURIString); - } + URL location =3D getAddressLocation(port); =20 Binding binding =3D port.getBinding(); - SOAPBinding soapBinding =3D (SOAPBinding) WSDescriptorParser.g= etExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements(= )); -// String transportURI =3D soapBinding.getTransportURI(); - String portStyleString =3D soapBinding.getStyle(); - Style portStyle =3D Style.getStyle(portStyleString); =20 - PortType portType =3D binding.getPortType(); + Style portStyle =3D getStyle(binding); =20 - SEIFactory seiFactory; + PortType portType =3D binding.getPortType(); =20 - Class serviceEndpointInterface =3D null; ServiceEndpointInterfaceMappingType[] endpointMappings =3D map= ping.getServiceEndpointInterfaceMappingArray(); + //port type corresponds to SEI List operations =3D portType.getOperations(); OperationInfo[] operationInfos =3D new OperationInfo[operation= s=2Esize()]; if (endpointMappings.length =3D=3D 0) { - //lightweight jaxrpc mapping supplied - serviceEndpointInterface =3D getServiceEndpointInterfaceLi= ghtweight(portType, mapping, classLoader); - Class enhancedServiceEndpointClass =3D enhanceServiceEndpo= intInterface(serviceEndpointInterface, context, module, classLoader); - - int i =3D 0; - for (Iterator ops =3D operations.iterator(); ops.hasNext()= ;) { - Operation operation =3D (Operation) ops.next(); - Method method =3D getMethodForOperation(enhancedServic= eEndpointClass, operation); - BindingOperation bindingOperation =3D binding.getBindi= ngOperation(operation.getName(), operation.getInput().getName(), operation.= getOutput() =3D=3D null ? null : operation.getOutput().getName()); - OperationInfo operationInfo =3D buildOperationInfoLigh= tweight(method, bindingOperation, portStyle, soapVersion); - operationInfos[i++] =3D operationInfo; - } - List typeMappings =3D new ArrayList(); - Map typeDescriptors =3D new HashMap(); - buildTypeInfoLightWeight(schemaTypeKeyToSchemaTypeMap, map= ping, classLoader, typeMappings, typeDescriptors); - seiFactory =3D createSEIFactory(portName, enhancedServiceE= ndpointClass, serviceImpl, typeMappings, typeDescriptors, location, operati= onInfos, handlerInfos, context, classLoader); + doLightweightMapping(portType, mapping, classLoader, conte= xt, module, operations, binding, portStyle, soapVersion, operationInfos, sc= hemaTypeKeyToSchemaTypeMap, portName, serviceImpl, location, handlerInfos, = seiPortNameToFactoryMap, seiClassNameToFactoryMap); } else { - //complete jaxrpc mapping file supplied - QName portTypeQName =3D portType.getQName(); - ServiceEndpointInterfaceMappingType endpointMapping =3D WS= DescriptorParser.getServiceEndpointInterfaceMapping(endpointMappings, portT= ypeQName); - String fqcn =3D endpointMapping.getServiceEndpointInterfac= e().getStringValue(); - try { - serviceEndpointInterface =3D classLoader.loadClass(fqc= n); - } catch (ClassNotFoundException e) { - throw new DeploymentException("Could not load service = endpoint interface", e); - } - Class enhancedServiceEndpointClass =3D enhanceServiceEndpo= intInterface(serviceEndpointInterface, context, module, classLoader); - - ServiceEndpointMethodMappingType[] methodMappings =3D endp= ointMapping.getServiceEndpointMethodMappingArray(); - int i =3D 0; - for (Iterator ops =3D operations.iterator(); ops.hasNext()= ;) { - Operation operation =3D (Operation) ops.next(); - String operationName =3D operation.getName(); - BindingOperation bindingOperation =3D binding.getBindi= ngOperation(operationName, operation.getInput().getName(), operation.getOut= put() =3D=3D null ? null : operation.getOutput().getName()); - ServiceEndpointMethodMappingType methodMapping =3D WSD= escriptorParser.getMethodMappingForOperation(operationName, methodMappings); - OperationInfo operationInfo =3D buildOperationInfoHeav= yweight(methodMapping, bindingOperation, portStyle, soapVersion, exceptionM= ap, complexTypeMap, mapping, classLoader); - operationInfos[i++] =3D operationInfo; - } - JavaXmlTypeMappingType[] javaXmlTypeMappings =3D mapping.g= etJavaXmlTypeMappingArray(); - List typeMappings =3D new ArrayList(); - Map typeDescriptors =3D new HashMap(); - buildTypeInfoHeavyweight(javaXmlTypeMappings, schemaTypeKe= yToSchemaTypeMap, classLoader, typeMappings, typeDescriptors); - seiFactory =3D createSEIFactory(portName, enhancedServiceE= ndpointClass, serviceImpl, typeMappings, typeDescriptors, location, operati= onInfos, handlerInfos, context, classLoader); + doHeavyweightMapping(portType, endpointMappings, classLoad= er, context, module, operations, binding, portStyle, soapVersion, exception= Map, complexTypeMap, mapping, operationInfos, schemaTypeKeyToSchemaTypeMap,= portName, serviceImpl, location, handlerInfos, seiPortNameToFactoryMap, se= iClassNameToFactoryMap); } - seiPortNameToFactoryMap.put(portName, seiFactory); - seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(= ), seiFactory); } + } + + private javax.wsdl.Service getService(QName serviceQName, Definition d= efinition) throws DeploymentException { + javax.wsdl.Service service; + if (serviceQName !=3D null) { + service =3D definition.getService(serviceQName); + } else { + Map services =3D definition.getServices(); + if (services.size() !=3D 1) { + throw new DeploymentException("no serviceQName supplied, a= nd there are " + services.size() + " services"); + } + service =3D (javax.wsdl.Service) services.values().iterator().= next(); + } + if (service =3D=3D null) { + throw new DeploymentException("No service wsdl for supplied se= rvice qname " + serviceQName); + } + return service; + } + + private Style getStyle(Binding binding) throws DeploymentException { + SOAPBinding soapBinding =3D (SOAPBinding) WSDescriptorParser.getEx= tensibilityElement(SOAPBinding.class, binding.getExtensibilityElements()); +// String transportURI =3D soapBinding.getTransportURI(); + String portStyleString =3D soapBinding.getStyle(); + Style portStyle =3D Style.getStyle(portStyleString); + return portStyle; + } + + private URL getAddressLocation(Port port) throws DeploymentException { + SOAPAddress soapAddress =3D (SOAPAddress) WSDescriptorParser.getEx= tensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); + String locationURIString =3D soapAddress.getLocationURI(); + URL location =3D null; + try { + location =3D new URL(locationURIString); + } catch (MalformedURLException e) { + throw new DeploymentException("Could not construct web service= location URL from " + locationURIString); + } + return location; + } + + private void doHeavyweightMapping(PortType portType, ServiceEndpointIn= terfaceMappingType[] endpointMappings, ClassLoader classLoader, DeploymentC= ontext context, Module module, List operations, Binding binding, Style port= Style, SOAPConstants soapVersion, Map exceptionMap, Map complexTypeMap, Jav= aWsdlMappingType mapping, OperationInfo[] operationInfos, Map schemaTypeKey= ToSchemaTypeMap, String portName, Object serviceImpl, URL location, List ha= ndlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap) thro= ws DeploymentException { + Class serviceEndpointInterface; + SEIFactory seiFactory; + //complete jaxrpc mapping file supplied + QName portTypeQName =3D portType.getQName(); + ServiceEndpointInterfaceMappingType endpointMapping =3D WSDescript= orParser.getServiceEndpointInterfaceMapping(endpointMappings, portTypeQName= ); + String fqcn =3D endpointMapping.getServiceEndpointInterface().getS= tringValue(); + try { + serviceEndpointInterface =3D classLoader.loadClass(fqcn); + } catch (ClassNotFoundException e) { + throw new DeploymentException("Could not load service endpoint= interface", e); + } + Class enhancedServiceEndpointClass =3D enhanceServiceEndpointInter= face(serviceEndpointInterface, context, module, classLoader); + + ServiceEndpointMethodMappingType[] methodMappings =3D endpointMapp= ing.getServiceEndpointMethodMappingArray(); + int i =3D 0; + for (Iterator ops =3D operations.iterator(); ops.hasNext();) { + Operation operation =3D (Operation) ops.next(); + String operationName =3D operation.getName(); + BindingOperation bindingOperation =3D binding.getBindingOperat= ion(operationName, operation.getInput().getName(), operation.getOutput() = =3D=3D null ? null : operation.getOutput().getName()); + ServiceEndpointMethodMappingType methodMapping =3D WSDescripto= rParser.getMethodMappingForOperation(operationName, methodMappings); + OperationInfo operationInfo =3D buildOperationInfoHeavyweight(= methodMapping, bindingOperation, portStyle, soapVersion, exceptionMap, comp= lexTypeMap, mapping, classLoader); + operationInfos[i++] =3D operationInfo; + } + JavaXmlTypeMappingType[] javaXmlTypeMappings =3D mapping.getJavaXm= lTypeMappingArray(); + List typeMappings =3D new ArrayList(); + Map typeDescriptors =3D new HashMap(); + buildTypeInfoHeavyweight(javaXmlTypeMappings, schemaTypeKeyToSchem= aTypeMap, classLoader, typeMappings, typeDescriptors); + seiFactory =3D createSEIFactory(portName, enhancedServiceEndpointC= lass, serviceImpl, typeMappings, typeDescriptors, location, operationInfos,= handlerInfos, context, classLoader); + seiPortNameToFactoryMap.put(portName, seiFactory); + seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), s= eiFactory); + } + + private void doLightweightMapping(PortType portType, JavaWsdlMappingTy= pe mapping, ClassLoader classLoader, DeploymentContext context, Module modu= le, List operations, Binding binding, Style portStyle, SOAPConstants soapVe= rsion, OperationInfo[] operationInfos, Map schemaTypeKeyToSchemaTypeMap, St= ring portName, Object serviceImpl, URL location, List handlerInfos, Map sei= PortNameToFactoryMap, Map seiClassNameToFactoryMap) throws DeploymentExcept= ion { + Class serviceEndpointInterface; + SEIFactory seiFactory; + //lightweight jaxrpc mapping supplied + serviceEndpointInterface =3D getServiceEndpointInterfaceLightweigh= t(portType, mapping, classLoader); + Class enhancedServiceEndpointClass =3D enhanceServiceEndpointInter= face(serviceEndpointInterface, context, module, classLoader); + + int i =3D 0; + for (Iterator ops =3D operations.iterator(); ops.hasNext();) { + Operation operation =3D (Operation) ops.next(); + Method method =3D getMethodForOperation(enhancedServiceEndpoin= tClass, operation); + BindingOperation bindingOperation =3D binding.getBindingOperat= ion(operation.getName(), operation.getInput().getName(), operation.getOutpu= t() =3D=3D null ? null : operation.getOutput().getName()); + OperationInfo operationInfo =3D buildOperationInfoLightweight(= method, bindingOperation, portStyle, soapVersion); + operationInfos[i++] =3D operationInfo; + } + List typeMappings =3D new ArrayList(); + Map typeDescriptors =3D new HashMap(); + buildTypeInfoLightWeight(schemaTypeKeyToSchemaTypeMap, mapping, cl= assLoader, typeMappings, typeDescriptors); + seiFactory =3D createSEIFactory(portName, enhancedServiceEndpointC= lass, serviceImpl, typeMappings, typeDescriptors, location, operationInfos,= handlerInfos, context, classLoader); + seiPortNameToFactoryMap.put(portName, seiFactory); + seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), s= eiFactory); } =20 private void buildTypeInfoLightWeight(Map schemaTypeKeyToSchemaTypeMap= , JavaWsdlMappingType mapping, ClassLoader classLoader, List typeMappings, = Map typeDescriptors) throws DeploymentException { Modified: geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/= axis/builder/ServiceReferenceTest.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/= test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?view=3Ddiff= &r1=3D155843&r2=3D155844 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/b= uilder/ServiceReferenceTest.java (original) +++ geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/b= uilder/ServiceReferenceTest.java Tue Mar 1 16:22:45 2005 @@ -119,7 +119,7 @@ Map seiClassNameToFactoryMap =3D new HashMap(); seiClassNameToFactoryMap.put(MockPort.class.getName(), factory); AxisBuilder builder =3D new AxisBuilder(); - Object service =3D builder.createService(MockService.class, portMa= p, seiClassNameToFactoryMap, context, module, isolatedCl); + Object service =3D builder.createServiceInterfaceProxy(MockService= .class, portMap, seiClassNameToFactoryMap, context, module, isolatedCl); assertTrue(service instanceof MockService); MockService mockService =3D (MockService) service; MockPort mockPort =3D mockService.getMockPort();