Author: amilas Date: Tue Aug 16 08:21:32 2011 New Revision: 1158146 URL: http://svn.apache.org/viewvc?rev=1158146&view=rev Log: replace the existing schemas with the processed ones. for -uw option to work some metadata is required
Modified: axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Modified: axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?rev=1158146&r1=1158145&r2=1158146&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java (original) +++ axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java Tue Aug 16 08:21:32 2011 @@ -71,6 +71,7 @@ public class ExtensionUtility { // add all the schemas to the list for (AxisService service : configuration.getAxisServices()) { schemaList.addAll(service.getSchema()); + } //hashmap that keeps the targetnamespace and the xmlSchema object @@ -146,6 +147,28 @@ public class ExtensionUtility { } + + //replace the Axis2 schemas with the processed ones. + //otherwise it gives some problems if we try to code generate with multiple + //services with the -uw option. + //inorder to work for -uw option there must be some metadata with the schema list + + Map<String, XmlSchema> loadedSchemaMap = schemaCompiler.getLoadedSchemaMap(); + for (AxisService service : configuration.getAxisServices()) { + List<XmlSchema> serviceSchemaList = service.getSchema(); + List<XmlSchema> schemaListToAdd = new ArrayList<XmlSchema>(); + for (XmlSchema xmlSchema : serviceSchemaList){ + if (loadedSchemaMap.containsKey(xmlSchema.getTargetNamespace())){ + schemaListToAdd.add(loadedSchemaMap.get(xmlSchema.getTargetNamespace())); + } else { + schemaListToAdd.add(xmlSchema); + } + } + service.releaseSchemaList(); + service.addSchema(schemaListToAdd); + } + + //process the unwrapped parameters if (!configuration.isParametersWrapped()) { //figure out the unwrapped operations Modified: axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=1158146&r1=1158145&r2=1158146&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original) +++ axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Tue Aug 16 08:21:32 2011 @@ -2809,4 +2809,8 @@ public class SchemaCompiler { } return isExists; } + + public Map<String, XmlSchema> getLoadedSchemaMap(){ + return this.loadedSchemaMap; + } }