VIVO-906 Assemble application at runtime.

Create an object to represent VitroHomeDirectory
Instantiate TripleSources, FileStorage, etc, based on the config file.
This commit is contained in:
j2blake 2014-11-13 17:17:38 -05:00
parent 66bee080fc
commit 78241be685
4 changed files with 42 additions and 11 deletions

View file

@ -34,6 +34,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
@ -213,13 +214,8 @@ public class FileHarvestController extends FreemarkerHttpServlet {
*/
private static String getUploadPathBase(ServletContext context) throws Exception
{
String vitroHomeDirectoryName = ConfigurationProperties.getBean(context).getProperty(FileStorageImplWrapper.PROPERTY_VITRO_HOME_DIR);
if (vitroHomeDirectoryName == null) {
throw new Exception("Vitro home directory name could not be found.");
}
String pathBase = vitroHomeDirectoryName + "/" + FileStorageImplWrapper.FILE_STORAGE_SUBDIRECTORY + "/" + PATH_TO_UPLOADS;
return pathBase;
String vitroHomeDirectoryName = ApplicationUtils.instance().getHomeDirectory().getPath().toString();
return vitroHomeDirectoryName + "/" + FileStorageImplWrapper.FILE_STORAGE_SUBDIRECTORY + "/" + PATH_TO_UPLOADS;
}
/**