//DebugInfo.debug("Reading dependsOn: " + depSchema);
//if (depSchema.equals("dmv"))
// DebugInfo.debugWithTrace("Parsing DMV");
ConfigVersion config = finder.getConfig(depSchema);
ConfigLocation location = null;
if (config == null){
ResultException ex = new ResultException();
ex.addError("Couldn't find schema: " + depSchema + " on which schema: " + currSchema.getObjectName() + " depends.");
throw(ex);
}
location = config.getLatestVersion();
currFile = location.getFileName();
if (loadedFiles.containsKey(currFile) == false){
// Only load the schema if we haven't already parsed it
if ( (newSchema = this.parseSchemaInternal(depSchema)) == null){
ResultException ex = new ResultException();
ex.result.addResult(Result.FATAL,"Failed to parse schema: " + depSchema);
throw(ex);
}
currSchema.addDependsOnRef(newSchema);
// Now reset schemaLoading to be null once more to
// mask the schema that we just read
schemaLoading = null;
}
else{
// We've already loaded this file, but we still
// need to update the dependsOnRef
// System.out.println("Adding ref to previously parsed schema: " + ((SchemaDefinition)loadedFiles.get(currFile)).getName());
currSchema.addDependsOnRef(loadedFiles.get(currFile));
}
}
// Switch back to the schema at this level of parsing
schemaLoading = currSchema;
//DebugInfo.debug("Switching back to : " + schemaLoading.getName());
allSchema.schemaBeingLoaded(schemaLoading);
}
// // We let the SchemaManager know that we're loading a new schema.
// // This gives it the opportunity to notify its schema extensions
// // that this is happening.
// allSchema.schemaBeingLoaded(schemaLoading);
if ((defFiles = schemaLoading.getDefFiles()) != null){
ConfigLocation location = finder.getConfig(schemaLoading.getName().getNameString()).getLatestVersion();
// And now load the files associated with this schema
while(defFiles.hasNext()){
if (location.isFromJAR())
currFile = "/" + location.getDirectory() + "/" + defFiles.next();
else
currFile = location.getDirectory() + File.separator + defFiles.next();
// currFile = schemaDir + File.separator + defFiles.next();
//DebugInfo.debug("Reading def file: " + currFile);
if (!terseV){
if (location.isFromJAR())
System.out.println(" Reading " + currFile + " - from " + location.getJarFilename());
else
System.out.println(" Reading " + currFile);
}
if (location.isFromJAR()){
defParser.parseFile(currFile,true);
}
else{
defParser.parseFile(currFile);
}