NIHVIVO-1261 Convert to use the new ConfigurationProperties class.
This commit is contained in:
parent
b7510fa355
commit
3fccf3fa04
11 changed files with 91 additions and 71 deletions
|
@ -9,7 +9,7 @@ import javax.servlet.http.HttpSession;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,14 +41,14 @@ public class SelfEditingConfiguration {
|
||||||
*/
|
*/
|
||||||
public static SelfEditingConfiguration getBean(ServletRequest request) {
|
public static SelfEditingConfiguration getBean(ServletRequest request) {
|
||||||
if (!(request instanceof HttpServletRequest)) {
|
if (!(request instanceof HttpServletRequest)) {
|
||||||
log.trace("Not an HttpServletRequest: " + request);
|
log.error("Not an HttpServletRequest: " + request);
|
||||||
return buildBean();
|
return new SelfEditingConfiguration(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpSession session = ((HttpServletRequest) request).getSession(false);
|
HttpSession session = ((HttpServletRequest) request).getSession(false);
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
log.trace("No session; no need to create one.");
|
log.trace("No session; no need to create one.");
|
||||||
return buildBean();
|
return new SelfEditingConfiguration(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object attr = session.getAttribute(BEAN_ATTRIBUTE);
|
Object attr = session.getAttribute(BEAN_ATTRIBUTE);
|
||||||
|
@ -57,14 +57,14 @@ public class SelfEditingConfiguration {
|
||||||
return (SelfEditingConfiguration) attr;
|
return (SelfEditingConfiguration) attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelfEditingConfiguration bean = buildBean();
|
SelfEditingConfiguration bean = buildBean(session);
|
||||||
log.debug("Created a bean: " + bean);
|
log.debug("Created a bean: " + bean);
|
||||||
session.setAttribute(BEAN_ATTRIBUTE, bean);
|
session.setAttribute(BEAN_ATTRIBUTE, bean);
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SelfEditingConfiguration buildBean() {
|
private static SelfEditingConfiguration buildBean(HttpSession session) {
|
||||||
String selfEditingIdMatchingProperty = ConfigurationProperties
|
String selfEditingIdMatchingProperty = ConfigurationProperties.getBean(session)
|
||||||
.getProperty(PROPERTY_SELF_EDITING_ID_MATCHING_PROPERTY);
|
.getProperty(PROPERTY_SELF_EDITING_ID_MATCHING_PROPERTY);
|
||||||
return new SelfEditingConfiguration(selfEditingIdMatchingProperty);
|
return new SelfEditingConfiguration(selfEditingIdMatchingProperty);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
|
|
||||||
public class ContactMailServlet extends VitroHttpServlet {
|
public class ContactMailServlet extends VitroHttpServlet {
|
||||||
public static final String SMTPHOST_PROPERTY = "Vitro.smtpHost";
|
public static final String SMTPHOST_PROPERTY = "Vitro.smtpHost";
|
||||||
|
@ -44,12 +44,14 @@ public class ContactMailServlet extends VitroHttpServlet {
|
||||||
private static String smtpHost = null;
|
private static String smtpHost = null;
|
||||||
|
|
||||||
public static boolean isSmtpHostConfigured(HttpServletRequest req) {
|
public static boolean isSmtpHostConfigured(HttpServletRequest req) {
|
||||||
return ConfigurationProperties.getProperty(SMTPHOST_PROPERTY, "").length() > 0;
|
return ConfigurationProperties.getBean(req)
|
||||||
|
.getProperty(SMTPHOST_PROPERTY, "").length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
smtpHost = ConfigurationProperties.getProperty(SMTPHOST_PROPERTY, "");
|
smtpHost = ConfigurationProperties.getBean(getServletContext())
|
||||||
|
.getProperty(SMTPHOST_PROPERTY, "");
|
||||||
if (smtpHost.isEmpty()) {
|
if (smtpHost.isEmpty()) {
|
||||||
log.debug("No Vitro.smtpHost specified");
|
log.debug("No Vitro.smtpHost specified");
|
||||||
} else {
|
} else {
|
||||||
|
@ -203,7 +205,8 @@ public class ContactMailServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPost( HttpServletRequest request, HttpServletResponse response )
|
@Override
|
||||||
|
public void doPost( HttpServletRequest request, HttpServletResponse response )
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet( request, response );
|
doGet( request, response );
|
||||||
|
|
|
@ -35,12 +35,12 @@ import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
import com.ibm.icu.util.Calendar;
|
import com.ibm.icu.util.Calendar;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
@ -93,8 +93,9 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons
|
||||||
/**
|
/**
|
||||||
* The get will present a form to the user.
|
* The get will present a form to the user.
|
||||||
*/
|
*/
|
||||||
public void doGet( HttpServletRequest req, HttpServletResponse res )
|
@Override
|
||||||
throws IOException, ServletException {
|
public void doGet(HttpServletRequest req, HttpServletResponse res)
|
||||||
|
throws IOException, ServletException {
|
||||||
try {
|
try {
|
||||||
super.doGet(req, res);
|
super.doGet(req, res);
|
||||||
log.debug("In doGet");
|
log.debug("In doGet");
|
||||||
|
@ -217,8 +218,9 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPost(HttpServletRequest rawRequest, HttpServletResponse res)
|
@Override
|
||||||
throws ServletException,IOException {
|
public void doPost(HttpServletRequest rawRequest, HttpServletResponse res)
|
||||||
|
throws ServletException, IOException {
|
||||||
try{
|
try{
|
||||||
FileUploadServletRequest req = FileUploadServletRequest.parseRequest(rawRequest, maxFileSize);
|
FileUploadServletRequest req = FileUploadServletRequest.parseRequest(rawRequest, maxFileSize);
|
||||||
if (req.hasFileUploadException()) {
|
if (req.hasFileUploadException()) {
|
||||||
|
@ -547,13 +549,16 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void init() throws ServletException {
|
public void init() throws ServletException {
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
baseDirectoryForFiles = ConfigurationProperties.getProperty(
|
ConfigurationProperties configProperties = ConfigurationProperties
|
||||||
|
.getBean(getServletContext());
|
||||||
|
baseDirectoryForFiles = configProperties.getProperty(
|
||||||
"n3.baseDirectoryForFiles", DEFAULT_BASE_DIR);
|
"n3.baseDirectoryForFiles", DEFAULT_BASE_DIR);
|
||||||
|
|
||||||
String maxSize = ConfigurationProperties.getProperty("n3.maxSize", Long
|
String maxSize = configProperties.getProperty("n3.maxSize", Long
|
||||||
.toString(DEFAULT_MAX_SIZE));
|
.toString(DEFAULT_MAX_SIZE));
|
||||||
try {
|
try {
|
||||||
maxFileSize = Integer.parseInt(maxSize);
|
maxFileSize = Integer.parseInt(maxSize);
|
||||||
|
@ -669,7 +674,7 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons
|
||||||
public FdcException(String message) {
|
public FdcException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
private static final String RELOAD_MSG =
|
private static final String RELOAD_MSG =
|
||||||
"<p>The fedora configuartion file will be reloaded if " +
|
"<p>The fedora configuartion file will be reloaded if " +
|
||||||
|
|
|
@ -23,8 +23,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||||
|
|
||||||
public class MailUsersServlet extends VitroHttpServlet {
|
public class MailUsersServlet extends VitroHttpServlet {
|
||||||
|
@ -37,7 +37,8 @@ public class MailUsersServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
smtpHost = ConfigurationProperties.getProperty(ContactMailServlet.SMTPHOST_PROPERTY, "");
|
smtpHost = ConfigurationProperties.getBean(getServletContext())
|
||||||
|
.getProperty(ContactMailServlet.SMTPHOST_PROPERTY, "");
|
||||||
if (smtpHost.isEmpty()) {
|
if (smtpHost.isEmpty()) {
|
||||||
log.debug("No Vitro.smtpHost specified");
|
log.debug("No Vitro.smtpHost specified");
|
||||||
} else {
|
} else {
|
||||||
|
@ -226,7 +227,8 @@ public class MailUsersServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPost( HttpServletRequest request, HttpServletResponse response )
|
@Override
|
||||||
|
public void doPost( HttpServletRequest request, HttpServletResponse response )
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet( request, response );
|
doGet( request, response );
|
||||||
|
|
|
@ -13,7 +13,7 @@ import javax.servlet.http.HttpSession;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Capture the properties used by the External Authorization system, and use
|
* Capture the properties used by the External Authorization system, and use
|
||||||
|
@ -58,17 +58,17 @@ public class ExternalAuthHelper {
|
||||||
return DUMMY_HELPER;
|
return DUMMY_HELPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServletContext context = session.getServletContext();
|
ServletContext ctx = session.getServletContext();
|
||||||
|
|
||||||
Object attr = context.getAttribute(BEAN_ATTRIBUTE);
|
Object attr = ctx.getAttribute(BEAN_ATTRIBUTE);
|
||||||
if (attr instanceof ExternalAuthHelper) {
|
if (attr instanceof ExternalAuthHelper) {
|
||||||
log.trace("Found a bean: " + attr);
|
log.trace("Found a bean: " + attr);
|
||||||
return (ExternalAuthHelper) attr;
|
return (ExternalAuthHelper) attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalAuthHelper bean = buildBean();
|
ExternalAuthHelper bean = buildBean(ctx);
|
||||||
log.debug("Created a bean: " + bean);
|
log.debug("Created a bean: " + bean);
|
||||||
setBean(context, bean);
|
setBean(ctx, bean);
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,10 +78,10 @@ public class ExternalAuthHelper {
|
||||||
context.setAttribute(BEAN_ATTRIBUTE, bean);
|
context.setAttribute(BEAN_ATTRIBUTE, bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ExternalAuthHelper buildBean() {
|
private static ExternalAuthHelper buildBean(ServletContext ctx) {
|
||||||
String externalAuthServerUrl = ConfigurationProperties
|
String externalAuthServerUrl = ConfigurationProperties.getBean(ctx)
|
||||||
.getProperty(PROPERTY_EXTERNAL_AUTH_SERVER_URL);
|
.getProperty(PROPERTY_EXTERNAL_AUTH_SERVER_URL);
|
||||||
String externalAuthHeaderName = ConfigurationProperties
|
String externalAuthHeaderName = ConfigurationProperties.getBean(ctx)
|
||||||
.getProperty(PROPERTY_EXTERNAL_AUTH_USERNAME_HEADER);
|
.getProperty(PROPERTY_EXTERNAL_AUTH_USERNAME_HEADER);
|
||||||
|
|
||||||
return new ExternalAuthHelper(externalAuthServerUrl,
|
return new ExternalAuthHelper(externalAuthServerUrl,
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||||
|
@ -86,28 +86,27 @@ public class N3MultiPartUpload extends VitroHttpServlet {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init() throws ServletException {
|
public void init() throws ServletException {
|
||||||
super.init();
|
ConfigurationProperties configProperties = ConfigurationProperties
|
||||||
|
.getBean(getServletContext());
|
||||||
|
|
||||||
fileUriPrefix = ConfigurationProperties.getProperty("n3.defaultUriPrefix",
|
fileUriPrefix = configProperties.getProperty("n3.defaultUriPrefix",
|
||||||
DEFAULT_FILE_URI_PREFIX);
|
DEFAULT_FILE_URI_PREFIX);
|
||||||
baseDirectoryForFiles = ConfigurationProperties.getProperty("n3.baseDirectoryForFiles",
|
baseDirectoryForFiles = configProperties.getProperty(
|
||||||
DEFAULT_BASE_DIR);
|
"n3.baseDirectoryForFiles", DEFAULT_BASE_DIR);
|
||||||
|
|
||||||
String postUploadProcess = ConfigurationProperties.getProperty("n3.postUploadProcess");
|
String postUploadProcess = configProperties.getProperty("n3.postUploadProcess");
|
||||||
System.out.println("Attempting to load postUploadProcess "
|
System.out.println("Attempting to load postUploadProcess "
|
||||||
+ postUploadProcess);
|
+ postUploadProcess);
|
||||||
postUpload = getPostUpload(postUploadProcess);
|
postUpload = getPostUpload(postUploadProcess);
|
||||||
|
|
||||||
String maxSize = ConfigurationProperties.getProperty("n3.maxSize", Long
|
String maxSize = configProperties.getProperty("n3.maxSize", Long.toString(DEFAULT_MAX_SIZE));
|
||||||
.toString(DEFAULT_MAX_SIZE));
|
log.debug("Max size is " + maxSize);
|
||||||
//DEBUG ADDED
|
try {
|
||||||
System.out.println("Max size is " + maxSize);
|
maxFileSize = Integer.parseInt(maxSize);
|
||||||
try {
|
} catch (NumberFormatException nfe) {
|
||||||
maxFileSize = Integer.parseInt(maxSize);
|
log.error(nfe);
|
||||||
} catch (NumberFormatException nfe) {
|
maxFileSize = DEFAULT_MAX_SIZE;
|
||||||
log.error(nfe);
|
}
|
||||||
maxFileSize = DEFAULT_MAX_SIZE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,8 +25,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
|
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException;
|
||||||
|
@ -55,7 +55,8 @@ public class ContactMailController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
smtpHost = ConfigurationProperties.getProperty(ContactMailServlet.SMTPHOST_PROPERTY, "");
|
smtpHost = ConfigurationProperties.getBean(getServletContext())
|
||||||
|
.getProperty(ContactMailServlet.SMTPHOST_PROPERTY, "");
|
||||||
if (smtpHost.isEmpty()) {
|
if (smtpHost.isEmpty()) {
|
||||||
log.debug("No Vitro.smtpHost specified");
|
log.debug("No Vitro.smtpHost specified");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,8 +13,8 @@ import javax.servlet.ServletContext;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import freemarker.cache.ClassTemplateLoader;
|
import freemarker.cache.ClassTemplateLoader;
|
||||||
import freemarker.cache.FileTemplateLoader;
|
import freemarker.cache.FileTemplateLoader;
|
||||||
|
@ -89,7 +89,7 @@ public class FreemarkerConfigurationLoader {
|
||||||
|
|
||||||
Configuration config = new Configuration();
|
Configuration config = new Configuration();
|
||||||
|
|
||||||
String buildEnv = ConfigurationProperties.getProperty("Environment.build");
|
String buildEnv = ConfigurationProperties.getBean(context).getProperty("Environment.build");
|
||||||
log.debug("Current build environment: " + buildEnv);
|
log.debug("Current build environment: " + buildEnv);
|
||||||
if ("development".equals(buildEnv)) { // Set Environment.build = development in deploy.properties
|
if ("development".equals(buildEnv)) { // Set Environment.build = development in deploy.properties
|
||||||
log.debug("Disabling Freemarker template caching in development build.");
|
log.debug("Disabling Freemarker template caching in development build.");
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.AuthorizationHelper;
|
import edu.cornell.mannlib.vitro.webapp.auth.AuthorizationHelper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||||
|
@ -25,6 +24,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddDataPro
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropObjectPropStmt;
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropObjectPropStmt;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.EditObjPropStmt;
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.EditObjPropStmt;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
|
||||||
|
@ -50,9 +50,6 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
private static final String ATTRIBUTE_REFERRING_PAGE = "ImageUploadController.referringPage";
|
private static final String ATTRIBUTE_REFERRING_PAGE = "ImageUploadController.referringPage";
|
||||||
|
|
||||||
private static final String DEFAULT_NAMESPACE = ConfigurationProperties
|
|
||||||
.getProperty("Vitro.defaultNamespace");
|
|
||||||
|
|
||||||
public static final String DUMMY_THUMBNAIL_PERSON_URL = "/images/placeholders/person.thumbnail.jpg";
|
public static final String DUMMY_THUMBNAIL_PERSON_URL = "/images/placeholders/person.thumbnail.jpg";
|
||||||
public static final String DUMMY_THUMBNAIL_NON_PERSON_URL = "/images/placeholders/non.person.thumbnail.jpg";
|
public static final String DUMMY_THUMBNAIL_NON_PERSON_URL = "/images/placeholders/non.person.thumbnail.jpg";
|
||||||
|
|
||||||
|
@ -477,12 +474,13 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
return referrer;
|
return referrer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEFAULT_NAMESPACE == null) {
|
String defaultNamespace = getDefaultNamespace();
|
||||||
|
if (defaultNamespace == null) {
|
||||||
return "";
|
return "";
|
||||||
} else if (!entityUri.startsWith(DEFAULT_NAMESPACE)) {
|
} else if (!entityUri.startsWith(defaultNamespace)) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
String tail = entityUri.substring(DEFAULT_NAMESPACE.length());
|
String tail = entityUri.substring(defaultNamespace.length());
|
||||||
if (!tail.startsWith("/")) {
|
if (!tail.startsWith("/")) {
|
||||||
tail = "/" + tail;
|
tail = "/" + tail;
|
||||||
}
|
}
|
||||||
|
@ -641,4 +639,10 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
return authorized;
|
return authorized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDefaultNamespace() {
|
||||||
|
return ConfigurationProperties.getBean(getServletContext())
|
||||||
|
.getProperty("Vitro.defaultNamespace");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
@ -39,6 +38,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RdfResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RdfResponseValues;
|
||||||
|
@ -56,7 +56,6 @@ import edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasoner;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper;
|
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapperFactory;
|
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapperFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
|
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.methods.IndividualLocalNameMethod;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividualTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividualTemplateModel;
|
||||||
import freemarker.ext.beans.BeansWrapper;
|
import freemarker.ext.beans.BeansWrapper;
|
||||||
|
@ -549,7 +548,8 @@ public class IndividualController extends FreemarkerHttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getTemporalVisualizationFlag() {
|
private boolean getTemporalVisualizationFlag() {
|
||||||
String property = ConfigurationProperties.getProperty("visualization.temporal");
|
String property = ConfigurationProperties.getBean(getServletContext())
|
||||||
|
.getProperty("visualization.temporal");
|
||||||
return "enabled".equals(property);
|
return "enabled".equals(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,8 @@ public class IndividualController extends FreemarkerHttpServlet {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
@Override
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException,IOException {
|
throws ServletException,IOException {
|
||||||
doGet(request, response);
|
doGet(request, response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@ import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.dbcp.BasicDataSource;
|
import org.apache.commons.dbcp.BasicDataSource;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -22,7 +25,6 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Exc
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasoner;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupSDB;
|
import edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupSDB;
|
||||||
|
|
||||||
public class SDBSetupController extends FreemarkerHttpServlet {
|
public class SDBSetupController extends FreemarkerHttpServlet {
|
||||||
|
@ -59,7 +61,7 @@ public class SDBSetupController extends FreemarkerHttpServlet {
|
||||||
body.put("sdbstatus"," ");
|
body.put("sdbstatus"," ");
|
||||||
}
|
}
|
||||||
else if(setupsignal!=null && setupsignal.equals("setup")){
|
else if(setupsignal!=null && setupsignal.equals("setup")){
|
||||||
new Thread(new SDBSetupRunner(jenaDataSourceSetupSDB)).start();
|
new Thread(new SDBSetupRunner(jenaDataSourceSetupSDB, vreq)).start();
|
||||||
messageStr = "SDB setup started.";
|
messageStr = "SDB setup started.";
|
||||||
getServletContext().setAttribute("sdbsetup", "showButton");
|
getServletContext().setAttribute("sdbsetup", "showButton");
|
||||||
}
|
}
|
||||||
|
@ -81,15 +83,18 @@ public class SDBSetupController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
private JenaDataSourceSetupSDB jenaDataSourceSetupSDB;
|
private JenaDataSourceSetupSDB jenaDataSourceSetupSDB;
|
||||||
final OntModelSpec MEM_ONT_MODEL_SPEC = OntModelSpec.OWL_MEM;
|
final OntModelSpec MEM_ONT_MODEL_SPEC = OntModelSpec.OWL_MEM;
|
||||||
|
private final ServletContext ctx;
|
||||||
|
|
||||||
public SDBSetupRunner(JenaDataSourceSetupSDB jenaDataSourceSetupSDB) {
|
public SDBSetupRunner(JenaDataSourceSetupSDB jenaDataSourceSetupSDB, HttpServletRequest req) {
|
||||||
this.jenaDataSourceSetupSDB = jenaDataSourceSetupSDB;
|
this.jenaDataSourceSetupSDB = jenaDataSourceSetupSDB;
|
||||||
|
this.ctx = req.getSession().getServletContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
@Override
|
||||||
|
public void run() {
|
||||||
Boolean done = true;
|
Boolean done = true;
|
||||||
getServletContext().setAttribute("done",done);
|
getServletContext().setAttribute("done",done);
|
||||||
StoreDesc storeDesc = jenaDataSourceSetupSDB.makeStoreDesc();
|
StoreDesc storeDesc = jenaDataSourceSetupSDB.makeStoreDesc(ctx);
|
||||||
BasicDataSource bds = jenaDataSourceSetupSDB.makeDataSourceFromConfigurationProperties(getServletContext());
|
BasicDataSource bds = jenaDataSourceSetupSDB.makeDataSourceFromConfigurationProperties(getServletContext());
|
||||||
Store store = null;
|
Store store = null;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue