gdaniels 02/02/04 16:38:54 Modified: java/src/org/apache/axis/deployment/wsdd WSDDService.java WSDDDeployment.java java/samples/echo deploy.wsdd Log: Don't actually require type mapping classes to be present at WSDD construction time. Instead, build the type mapping registries the first time they're asked for. This allows tools to work with WSDD in environments with different classpaths than the actual server. Revision Changes Path 1.36 +17 -17 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java Index: WSDDService.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- WSDDService.java 1 Feb 2002 22:08:25 -0000 1.35 +++ WSDDService.java 5 Feb 2002 00:38:54 -0000 1.36 @@ -113,16 +113,18 @@ { super(e); - Element [] typeMappings = getChildElements(e, "typeMapping"); - for (int i = 0; i < typeMappings.length; i++) { - WSDDTypeMapping typeMapping = new WSDDTypeMapping(typeMappings[i]); - deployTypeMapping(typeMapping); + Element [] typeMappingElements = getChildElements(e, "typeMapping"); + for (int i = 0; i < typeMappingElements.length; i++) { + WSDDTypeMapping mapping = + new WSDDTypeMapping(typeMappingElements[i]); + typeMappings.add(mapping); } - - Element [] beanMappings = getChildElements(e, "beanMapping"); - for (int i = 0; i < beanMappings.length; i++) { - WSDDBeanMapping beanMapping = new WSDDBeanMapping(beanMappings[i]); - deployTypeMapping(beanMapping); + + Element [] beanMappingElements = getChildElements(e, "beanMapping"); + for (int i = 0; i < beanMappingElements.length; i++) { + WSDDBeanMapping mapping = + new WSDDBeanMapping(beanMappingElements[i]); + typeMappings.add(mapping); } String typeStr = e.getAttribute("provider"); @@ -245,6 +247,10 @@ if (tmr == null) { tmr = new TypeMappingRegistryImpl(); } + for (int i = 0; i < typeMappings.size(); i++) { + deployTypeMapping((WSDDTypeMapping)typeMappings.get(i)); + } + service.setTypeMappingRegistry(tmr); tmr.delegate(registry.getTypeMappingRegistry()); @@ -307,7 +313,6 @@ mapping.getQName()); } tm.register( mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser); - typeMappings.add(mapping); } catch (ClassNotFoundException e) { throw new WSDDException(e); } catch (Exception e) { @@ -335,13 +340,8 @@ writeFlowsToContext(context); writeParamsToContext(context); - if (tmr != null) { - for (int i=0; i < typeMappings.size(); i++) { - ((WSDDTypeMapping) typeMappings.elementAt(i)).writeToContext(context); - } - // RJS_TEMP - // Need to provide a writeTypeMappingsToContext - //tmr.dumpToSerializationContext(context); + for (int i=0; i < typeMappings.size(); i++) { + ((WSDDTypeMapping) typeMappings.elementAt(i)).writeToContext(context); } context.endElement(); 1.22 +11 -4 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java Index: WSDDDeployment.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- WSDDDeployment.java 1 Feb 2002 22:08:25 -0000 1.21 +++ WSDDDeployment.java 5 Feb 2002 00:38:54 -0000 1.22 @@ -152,7 +152,8 @@ throws WSDDException { typeMappings.add(typeMapping); - deployMapping(typeMapping); + if (tmrDeployed) + deployMapping(typeMapping); } /** @@ -259,8 +260,6 @@ throws WSDDException { try { - TypeMappingRegistry tmr = getTypeMappingRegistry(); - TypeMapping tm = (TypeMapping) tmr.getTypeMapping(mapping.getEncodingStyle()); TypeMapping df = (TypeMapping) tmr.getDefaultTypeMapping(); if (tm == null || tm == df) { @@ -444,10 +443,18 @@ TypeMappingRegistry tmr = new TypeMappingRegistryImpl(); public TypeMapping getTypeMapping(String encodingStyle) throws ConfigurationException { - return (TypeMapping)tmr.getTypeMapping(encodingStyle); + return (TypeMapping)getTypeMappingRegistry().getTypeMapping(encodingStyle); } + private boolean tmrDeployed = false; public TypeMappingRegistry getTypeMappingRegistry() throws ConfigurationException { + if (false == tmrDeployed) { + for (int i = 0; i < typeMappings.size(); i++) { + WSDDTypeMapping mapping = (WSDDTypeMapping)typeMappings.get(i); + deployMapping(mapping); + } + tmrDeployed = true; + } return tmr; } 1.11 +1 -2 xml-axis/java/samples/echo/deploy.wsdd Index: deploy.wsdd =================================================================== RCS file: /home/cvs/xml-axis/java/samples/echo/deploy.wsdd,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- deploy.wsdd 31 Jan 2002 03:26:08 -0000 1.10 +++ deploy.wsdd 5 Feb 2002 00:38:54 -0000 1.11 @@ -13,7 +13,6 @@ <parameter name="className" value="samples.echo.EchoService" /> <parameter name="allowedMethods" value="*" /> <beanMapping xmlns:echo="http://soapinterop.org/xsd" qname="echo:SOAPStruct" - languageSpecificType="java:samples.echo.SOAPStruct"/> - + languageSpecificType="java:samples.echo.SOAPStruct"/> </service> </deployment>