You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/02/08 03:14:35 UTC
svn commit: r504764 -
/incubator/woden/branches/M7/src/org/apache/woden/internal/util/ComponentModelBuilder.java
Author: jkaputin
Date: Wed Feb 7 18:14:34 2007
New Revision: 504764
URL: http://svn.apache.org/viewvc?view=rev&rev=504764
Log:
WODEN-143 Implemented CR145 so that the only schema components
that appear in the Component model are those that are
referenceable by the WSDL document(s).
Modified:
incubator/woden/branches/M7/src/org/apache/woden/internal/util/ComponentModelBuilder.java
Modified: incubator/woden/branches/M7/src/org/apache/woden/internal/util/ComponentModelBuilder.java
URL: http://svn.apache.org/viewvc/incubator/woden/branches/M7/src/org/apache/woden/internal/util/ComponentModelBuilder.java?view=diff&rev=504764&r1=504763&r2=504764
==============================================================================
--- incubator/woden/branches/M7/src/org/apache/woden/internal/util/ComponentModelBuilder.java (original)
+++ incubator/woden/branches/M7/src/org/apache/woden/internal/util/ComponentModelBuilder.java Wed Feb 7 18:14:34 2007
@@ -66,6 +66,8 @@
import org.apache.woden.wsdl20.xml.WSDLElement;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaExternal;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
import org.apache.ws.commons.schema.XmlSchemaObjectTable;
@@ -152,12 +154,26 @@
URI typeSystemURI = URI.create(Constants.TYPE_XSD_2001); //TODO support other type systems?
TypesElement types = desc.getTypesElement();
if (types != null) {
- Schema[] schemas = types.getSchemas(); //schema inline/imported directly by <types>
+ //first, get the list of imported schema namespaces
+ Schema[] importedSchemas = types.getImportedSchemas();
+ List importedNSpaces = new Vector();
+ for(int j=0; j<importedSchemas.length; j++) {
+ URI nsURI = importedSchemas[j].getNamespace();
+ if(nsURI != null) {
+ String ns = nsURI.toString();
+ if(!importedNSpaces.contains(ns)) {
+ importedNSpaces.add(ns);
+ }
+ }
+ }
+ //second, process all schemas inlined or imported directly by <types>
+ Schema[] schemas = types.getSchemas();
XmlSchema xmlSchema;
for(int i=0; i<schemas.length; i++) {
xmlSchema = schemas[i].getSchemaDefinition();
if(xmlSchema != null && !fSchemasDone.contains(xmlSchema)) {
- buildElementsAndTypes(xmlSchema, xmlSchema.getTargetNamespace(), typeSystemURI);
+ buildElementsAndTypes(
+ xmlSchema, xmlSchema.getTargetNamespace(), typeSystemURI, importedNSpaces);
}
}
}
@@ -196,7 +212,7 @@
//}
}
- private void buildElementsAndTypes(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) {
+ private void buildElementsAndTypes(XmlSchema schemaDef, String schemaTns, URI typeSystemURI, List importedNSpaces) {
if(fSchemasDone.contains(schemaDef)) {
return;
@@ -224,7 +240,11 @@
XmlSchema schema = externalSchema.getSchema();
if(schema != null )
{
- buildElementsAndTypes(schema, schema.getTargetNamespace(), typeSystemURI);
+ String schemaTNS = schema.getTargetNamespace();
+ if( externalSchema instanceof XmlSchemaInclude ||
+ (externalSchema instanceof XmlSchemaImport && importedNSpaces.contains(schemaTNS)) ) {
+ buildElementsAndTypes(schema, schemaTNS, typeSystemURI, importedNSpaces);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org