More explicit error messages.
This commit is contained in:
parent
691feaee81
commit
6f663d2d81
1 changed files with 29 additions and 6 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.servlet.setup;
|
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 java.io.File;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
@ -21,7 +23,8 @@ import edu.cornell.mannlib.vitro.webapp.filestorage.backend.FileStorageSetup;
|
||||||
import edu.cornell.mannlib.vitro.webapp.filestorage.updater.FileStorageUpdater;
|
import edu.cornell.mannlib.vitro.webapp.filestorage.updater.FileStorageUpdater;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* Check that the conditions are met for updating uploaded files. If everything
|
||||||
|
* is in place, call the updater.
|
||||||
*/
|
*/
|
||||||
public class UpdateUploadedFiles implements ServletContextListener {
|
public class UpdateUploadedFiles implements ServletContextListener {
|
||||||
private static final Log log = LogFactory.getLog(UpdateUploadedFiles.class);
|
private static final Log log = LogFactory.getLog(UpdateUploadedFiles.class);
|
||||||
|
@ -46,19 +49,40 @@ public class UpdateUploadedFiles implements ServletContextListener {
|
||||||
WebappDaoFactory wadf = (WebappDaoFactory) ctx
|
WebappDaoFactory wadf = (WebappDaoFactory) ctx
|
||||||
.getAttribute("webappDaoFactory");
|
.getAttribute("webappDaoFactory");
|
||||||
if (wadf == null) {
|
if (wadf == null) {
|
||||||
throw new IllegalStateException("Webapp DAO Factory is null");
|
throw new IllegalStateException("Webapp DAO Factory is null. "
|
||||||
|
+ "The ServletContext does not contain an attribute "
|
||||||
|
+ "for '" + "webappDaoFactory" + "'. "
|
||||||
|
+ "Does the log contain a previous exception from "
|
||||||
|
+ "JenaDataSourceSetup? Have you looked in "
|
||||||
|
+ "localhost.log for such an exception? Is it "
|
||||||
|
+ "possible that web.xml is not set up to run "
|
||||||
|
+ "JenaDataSourceSetup before UpdateUploadedFiles?");
|
||||||
}
|
}
|
||||||
|
|
||||||
OntModel jenaOntModel = (OntModel) ctx
|
OntModel jenaOntModel = (OntModel) ctx
|
||||||
.getAttribute(JenaBaseDao.JENA_ONT_MODEL_ATTRIBUTE_NAME);
|
.getAttribute(JENA_ONT_MODEL_ATTRIBUTE_NAME);
|
||||||
if (jenaOntModel == null) {
|
if (jenaOntModel == null) {
|
||||||
throw new IllegalStateException("Ontology model is null");
|
throw new IllegalStateException("Ontology model is null. "
|
||||||
|
+ "The ServletContext does not contain an attribute "
|
||||||
|
+ "for '" + JENA_ONT_MODEL_ATTRIBUTE_NAME + "'. "
|
||||||
|
+ "Does the log contain a previous exception from "
|
||||||
|
+ "JenaDataSourceSetup? Have you looked in "
|
||||||
|
+ "localhost.log for such an exception? Is it "
|
||||||
|
+ "possible that web.xml is not set up to run "
|
||||||
|
+ "JenaDataSourceSetup before UpdateUploadedFiles?");
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStorage fileStorage = (FileStorage) ctx
|
FileStorage fileStorage = (FileStorage) ctx
|
||||||
.getAttribute(FileStorageSetup.ATTRIBUTE_NAME);
|
.getAttribute(FileStorageSetup.ATTRIBUTE_NAME);
|
||||||
if (fileStorage == null) {
|
if (fileStorage == null) {
|
||||||
throw new IllegalStateException("File storage system is null");
|
throw new IllegalStateException("File storage system is null. "
|
||||||
|
+ "The ServletContext does not contain an attribute "
|
||||||
|
+ "for '" + FileStorageSetup.ATTRIBUTE_NAME + "'. "
|
||||||
|
+ "Does the log contain a previous exception from "
|
||||||
|
+ "FileStorageSetup? Have you looked in "
|
||||||
|
+ "localhost.log for such an exception? Is it "
|
||||||
|
+ "possible that web.xml is not set up to run "
|
||||||
|
+ "FileStorageSetup before UpdateUploadedFiles?");
|
||||||
}
|
}
|
||||||
|
|
||||||
String uploadDirectoryName = ConfigurationProperties
|
String uploadDirectoryName = ConfigurationProperties
|
||||||
|
@ -73,7 +97,6 @@ public class UpdateUploadedFiles implements ServletContextListener {
|
||||||
+ "' does not exist.");
|
+ "' does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FileStorageUpdater fsu = new FileStorageUpdater(wadf, jenaOntModel,
|
FileStorageUpdater fsu = new FileStorageUpdater(wadf, jenaOntModel,
|
||||||
fileStorage, uploadDirectory);
|
fileStorage, uploadDirectory);
|
||||||
fsu.update();
|
fsu.update();
|
||||||
|
|
Loading…
Add table
Reference in a new issue