minor improvement for NIHVIVO-205 ontology upgrade

This commit is contained in:
bjl23 2010-04-02 22:52:34 +00:00
parent f5627b74a6
commit 4a3ef8d03d
2 changed files with 12 additions and 4 deletions

View file

@ -59,9 +59,12 @@ public class OntologyUpdater {
settings.getAddedDataFile(), settings.getRemovedDataFile());
}
public void update() throws IOException {
public boolean update() throws IOException {
// Check to see if the update is necessary.
if (updateRequired()) {
boolean updateRequired = updateRequired();
if (updateRequired) {
performUpdate();
if (!logger.errorsWritten()) {
@ -74,6 +77,9 @@ public class OntologyUpdater {
record.writeChanges();
logger.closeLogs();
}
return updateRequired;
}
private void performUpdate() throws IOException {

View file

@ -100,8 +100,10 @@ public class UpdateKnowledgeBase implements ServletContextListener {
settings.setNewTBoxAnnotationsModel(newTBoxAnnotationsModel);
try {
doMiscAppMetadataReplacements(ctx.getRealPath(MISC_REPLACEMENTS_FILE), oms);
(new OntologyUpdater(settings)).update();
boolean updateRequired = (new OntologyUpdater(settings)).update();
if (updateRequired) {
doMiscAppMetadataReplacements(ctx.getRealPath(MISC_REPLACEMENTS_FILE), oms);
}
} catch (IOException ioe) {
String errMsg = "IOException updating knowledge base " +
"for ontology changes: ";