protected Map<String,IFile> loadAllSchemaNamespaces() { Map<String,IFile> allSchemaNamespaces = new HashMap<String, IFile>(); HashMap<String,IDirectory> nonOverridden = getNonOverriddenCollectionPaths(); List<Pair<String,IFile>> pairs = getModule().getFileRepository().findAllFilesByExtension(_fileExtension); for ( Pair<String, IFile> pair : pairs ) { IFile file = pair.getSecond(); String packageName = pair.getFirst(); String path = getParentPath(packageName); IDirectory useDirectory = nonOverridden.get(path); if (useDirectory != null && !useDirectory.equals(file.getParent())) { continue; } packageName = convertPathToPackage( packageName ); // TODO-dp the second check is a hack to prevent wsdls from pc-cmdline from being processed here if ( packageName.startsWith( "config." ) || packageName.startsWith( "webservices." )) { continue; } String schemaNamespace = XmlSchemaIndex.normalizeSchemaNamespace(packageName, pair.getFirst()); if ( ! CommonServices.getXmlSchemaCompatibilityConfig().useCompatibilityMode(schemaNamespace) ) { if ( ! allSchemaNamespaces.containsKey( schemaNamespace ) ) { allSchemaNamespaces.put( schemaNamespace, file ); } } } return allSchemaNamespaces; }
private static void getAllSchemas( URL schemaUrl, Set<URL> seenResources, List<Pair<XmlElement, String>> allSchemas, Map<String, String> fakeExternalLocationAliases, boolean isInclude ) { if ( ! seenResources.contains( schemaUrl ) ) { seenResources.add( schemaUrl ); XmlElement schema; IModule currentModule = TypeSystem.getGlobalModule(); // IModule currentModule = TypeSystem.getExecutionEnvironment().getModule( schemaUrl ); if ( isInclude ) { schema = XmlElement.parse( schemaUrl ); String fakeUrl = "file:/" + currentModule.getFileRepository().getResourceName( schemaUrl ); addSchema( allSchemas, schema, fakeUrl, fakeExternalLocationAliases, seenResources, schemaUrl, currentModule ); } else { String gosuNamespace = XmlSchemaIndex.getGosuNamespace( schemaUrl, currentModule ); XmlSchemaIndex<?> schemaIndex = XmlSchemaResourceTypeLoaderBase.findSchemaForNamespace( currentModule, gosuNamespace ); if ( schemaIndex == null ) { if ( CommonServices.getXmlSchemaCompatibilityConfig().useCompatibilityMode( gosuNamespace ) ) { throw new XmlException( "A non-compatibility-mode schema cannot import a compatibility-mode schema (" + gosuNamespace + ")" ); } else { throw new IllegalStateException( "Schema not found for Gosu namespace " + gosuNamespace ); } } schema = XmlElement.parse( schemaIndex.getXSDSource().getInputStream( false ) ); addSchemaOrWsdl( schemaUrl, seenResources, allSchemas, fakeExternalLocationAliases, schema, currentModule ); } } }
XmlSchemaIndex<?> referencedSchemaIndex = XmlSchemaResourceTypeLoaderBase.findSchemaForNamespace( currentModule, gosuNamespace ); if ( referencedSchemaIndex == null ) { if ( CommonServices.getXmlSchemaCompatibilityConfig().useCompatibilityMode( gosuNamespace ) ) { throw new XmlException( "A non-compatibility-mode schema cannot import a compatibility-mode schema (" + gosuNamespace + ")" );