}
final String log_prefix = "_loadDataOfWorkingOntologiesForMapping(" +currentIdx+ "): ";
String uri = uris.get(currentIdx);
BaseOntologyInfo ontologyInfo = VineMain.getOntologyInfo(uri);
if ( ontologyInfo == null ) {
// Not a registered ontology; continue to next entry:
Orr.log(log_prefix +"VineMain.getOntologyInfo returned null: " +uri);
_loadDataOfWorkingOntologiesForMapping(pePopup, currentIdx + 1);
return;
}
if ( ontologyInfo.getError() != null ) {
// continue to next entry:
_loadDataOfWorkingOntologiesForMapping(pePopup, currentIdx + 1);
return;
}
OntologyData ontologyData = ontologyInfo.getOntologyData();
if ( ontologyData != null ) {
// this entry already has data; continue to next entry:
Orr.log(log_prefix +"already with OntologyData: " +uri);
_loadDataOfWorkingOntologiesForMapping(pePopup, currentIdx + 1);
return;
}
// this entry needs data.
if (! (ontologyInfo instanceof RegisteredOntologyInfo)) {
Orr.log(log_prefix +"Ontology from VineMain is not a RegisteredOntologyInfo: " +uri);
_loadDataOfWorkingOntologiesForMapping(pePopup, currentIdx + 1);
return;
}
RegisteredOntologyInfo registeredOntologyInfo = (RegisteredOntologyInfo) ontologyInfo;
AsyncCallback<RegisteredOntologyInfo> callback = new AsyncCallback<RegisteredOntologyInfo>() {
public void onFailure(Throwable thr) {
String error = thr.getClass().getName()+ ": " +thr.getMessage();
while ( (thr = thr.getCause()) != null ) {
error += "\ncaused by: " +thr.getClass().getName()+ ": " +thr.getMessage();
}
Orr.log(log_prefix + " ERROR: " +error);
Window.alert(error);
}
public void onSuccess(RegisteredOntologyInfo ontologyInfo) {
Orr.log(log_prefix +ontologyInfo.getUri()+ " completed.");
pePopup.appendToTextArea("done\n");
if ( ontologyInfo.getOntologyData() == null ) {
Orr.log(" UNEXPECTED: data not retrieved");
}
VineMain.ontologySucessfullyLoaded(ontologyInfo);
VineMain.addWorkingUri(ontologyInfo.getUri());
if ( mapperPage != null ) {
mapperPage.notifyWorkingOntologyAdded(ontologyInfo);
}
// continue with next entry:
DeferredCommand.addCommand(new Command() {
public void execute() {
_loadDataOfWorkingOntologiesForMapping(pePopup, currentIdx + 1);
}
});
}
};
String ontologyUri = ontologyInfo.getUri();
pePopup.appendToTextArea(" Loading : " + ontologyUri + " ... ");
Orr.log(log_prefix +ontologyUri+ " starting");
Orr.service.getOntologyContents(registeredOntologyInfo, null, callback);
}