NIHVIVO-962 Merge 5537 from branch

This commit is contained in:
jeb228 2010-07-29 13:28:52 +00:00
parent 6bb9980fc3
commit be57b724ec
2 changed files with 14 additions and 24 deletions

View file

@ -10,7 +10,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ResIterator;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
@ -193,26 +192,16 @@ public class FileStorageUpdater implements FSUController {
* properties, we have work to do.
*/
private boolean isThereAnythingToDo() {
ResIterator haveImage = model.listResourcesWithProperty(model
.createProperty(IMAGEFILE));
try {
if (haveImage.hasNext()) {
return true;
}
} finally {
haveImage.close();
if (!ModelWrapper.listResourcesWithProperty(model,
model.createProperty(IMAGEFILE)).isEmpty()) {
return true;
}
ResIterator haveThumb = model.listResourcesWithProperty(model
.createProperty(IMAGETHUMB));
try {
if (haveThumb.hasNext()) {
return true;
}
} finally {
haveThumb.close();
if (!ModelWrapper.listResourcesWithProperty(model,
model.createProperty(IMAGETHUMB)).isEmpty()) {
return true;
}
return false;
}

View file

@ -2,8 +2,6 @@
package edu.cornell.mannlib.vitro.webapp.servlet.setup;
import static edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao.JENA_ONT_MODEL_ATTRIBUTE_NAME;
import java.io.File;
import javax.servlet.ServletContext;
@ -17,6 +15,7 @@ import com.hp.hpl.jena.ontology.OntModel;
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao;
import edu.cornell.mannlib.vitro.webapp.filestorage.backend.FileStorage;
import edu.cornell.mannlib.vitro.webapp.filestorage.backend.FileStorageSetup;
import edu.cornell.mannlib.vitro.webapp.filestorage.updater.FileStorageUpdater;
@ -46,11 +45,11 @@ public class UpdateUploadedFiles implements ServletContextListener {
ServletContext ctx = sce.getServletContext();
WebappDaoFactory wadf = (WebappDaoFactory) ctx
.getAttribute("webappDaoFactory");
.getAttribute("assertionsWebappDaoFactory");
if (wadf == null) {
throw new IllegalStateException("Webapp DAO Factory is null. "
+ "The ServletContext does not contain an attribute "
+ "for '" + "webappDaoFactory" + "'. "
+ "for '" + "assertionsWebappDaoFactory" + "'. "
+ "Does the log contain a previous exception from "
+ "JenaDataSourceSetup? Is it possible that web.xml "
+ "is not set up to run JenaDataSourceSetup before "
@ -58,11 +57,13 @@ public class UpdateUploadedFiles implements ServletContextListener {
}
OntModel jenaOntModel = (OntModel) ctx
.getAttribute(JENA_ONT_MODEL_ATTRIBUTE_NAME);
.getAttribute(JenaBaseDao.ASSERTIONS_ONT_MODEL_ATTRIBUTE_NAME);
if (jenaOntModel == null) {
throw new IllegalStateException("Ontology model is null. "
+ "The ServletContext does not contain an attribute "
+ "for '" + JENA_ONT_MODEL_ATTRIBUTE_NAME + "'. "
+ "for '"
+ JenaBaseDao.ASSERTIONS_ONT_MODEL_ATTRIBUTE_NAME
+ "'. "
+ "Does the log contain a previous exception from "
+ "JenaDataSourceSetup? Is it possible that web.xml "
+ "is not set up to run JenaDataSourceSetup before "