VIVO-2 Modify the build so installers can create a container-neutral VIVO.
Split deploy.properties into build.properties and runtime.properties, with runtime.properties going into the Vitro home directory. Modify ConfigurationProperties to locate the Vitro home directory, either by System property or JNDI Environment variable, or from build.properties, and to read from both build.properties and runtime.properties. Revise the install and upgrade documents for VIVO and Vitro. Change comments and error messages that referred to deploy.properties by name. Change vitro.home.directory to vitro.home
This commit is contained in:
parent
6901a67670
commit
c2a1195fec
23 changed files with 739 additions and 590 deletions
|
@ -120,7 +120,7 @@ public class RootUserPolicy implements PolicyIface {
|
|||
PROPERTY_ROOT_USER_EMAIL);
|
||||
if (email == null) {
|
||||
throw new IllegalStateException(
|
||||
"deploy.properties must contain a value for '"
|
||||
"runtime.properties must contain a value for '"
|
||||
+ PROPERTY_ROOT_USER_EMAIL + "'");
|
||||
} else {
|
||||
return email;
|
||||
|
@ -177,7 +177,7 @@ public class RootUserPolicy implements PolicyIface {
|
|||
|
||||
private void complainAboutMultipleRootUsers() {
|
||||
for (String other : otherRootUsers) {
|
||||
ss.warning(this, "deploy.properties specifies '"
|
||||
ss.warning(this, "runtime.properties specifies '"
|
||||
+ configuredRootUser + "' as the value for '"
|
||||
+ PROPERTY_ROOT_USER_EMAIL
|
||||
+ "', but the system also contains this root user: "
|
||||
|
@ -189,7 +189,7 @@ public class RootUserPolicy implements PolicyIface {
|
|||
|
||||
private void complainAboutWrongRootUsers() {
|
||||
for (String other : otherRootUsers) {
|
||||
ss.warning(this, "deploy.properties specifies '"
|
||||
ss.warning(this, "runtime.properties specifies '"
|
||||
+ configuredRootUser + "' as the value for '"
|
||||
+ PROPERTY_ROOT_USER_EMAIL
|
||||
+ "', but the system contains this root user instead: "
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.apache.commons.logging.LogFactory;
|
|||
* are attached to the servlet context.
|
||||
*
|
||||
* The customary behavior is for ConfigurationPropertiesSetup to create a
|
||||
* ConfigurationPropertiesImpl, which will parse the deploy.properties file for
|
||||
* these properties.
|
||||
* ConfigurationPropertiesImpl, which will obtain the properties from the
|
||||
* build.properties file and the runtime.properties file.
|
||||
*/
|
||||
public abstract class ConfigurationProperties {
|
||||
private static final Log log = LogFactory
|
||||
|
|
|
@ -9,13 +9,16 @@ import java.util.Enumeration;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* The basic implementation of ConfigurationProperties. It loads the
|
||||
* configuration properties from a properties file and stores them in a map.
|
||||
* configuration properties from a properties file and stores them in a map. It
|
||||
* also permits the caller to supply a map of "preemptive" properties that will
|
||||
* be included and will override any matching properties from the file.
|
||||
*
|
||||
* Leading and trailing white space are trimmed from the property values.
|
||||
*
|
||||
|
@ -27,23 +30,25 @@ public class ConfigurationPropertiesImpl extends ConfigurationProperties {
|
|||
|
||||
private final Map<String, String> propertyMap;
|
||||
|
||||
public ConfigurationPropertiesImpl(InputStream stream) {
|
||||
public ConfigurationPropertiesImpl(InputStream stream,
|
||||
Map<String, String> preemptiveProperties) throws IOException {
|
||||
Properties props = loadFromPropertiesFile(stream);
|
||||
Map<String, String> map = copyPropertiesToMap(props);
|
||||
trimWhiteSpaceFromValues(map);
|
||||
this.propertyMap = Collections.unmodifiableMap(map);
|
||||
|
||||
if (preemptiveProperties != null) {
|
||||
map.putAll(preemptiveProperties);
|
||||
}
|
||||
|
||||
trimWhiteSpaceFromValues(map);
|
||||
|
||||
this.propertyMap = Collections.unmodifiableMap(map);
|
||||
log.debug("Configuration properties are: " + map);
|
||||
}
|
||||
|
||||
private Properties loadFromPropertiesFile(InputStream stream) {
|
||||
private Properties loadFromPropertiesFile(InputStream stream)
|
||||
throws IOException {
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
props.load(stream);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(
|
||||
"Failed to parse the configuration properties file.", e);
|
||||
}
|
||||
props.load(stream);
|
||||
return props;
|
||||
}
|
||||
|
||||
|
@ -84,7 +89,8 @@ public class ConfigurationPropertiesImpl extends ConfigurationProperties {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ConfigurationPropertiesImpl[propertyMap=" + propertyMap + "]";
|
||||
return "ConfigurationPropertiesImpl[propertyMap="
|
||||
+ new TreeMap<String, String>(propertyMap) + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,11 +4,13 @@ package edu.cornell.mannlib.vitro.webapp.config;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import javax.servlet.ServletContext;
|
||||
|
@ -21,61 +23,45 @@ import org.apache.commons.logging.LogFactory;
|
|||
import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
||||
|
||||
/**
|
||||
* Reads the configuration properties from a file and stores them in the servlet
|
||||
* Locates the runtime configuration properties and stores them in the servlet
|
||||
* context.
|
||||
*
|
||||
* This must be invoked before any listener that requires configuration
|
||||
* properties.
|
||||
*
|
||||
* The path to the file can be specified by an Environment name in the Context,
|
||||
* like this:
|
||||
* The properties file must be called 'runtime.properties' in the Vitro home
|
||||
* directory. The path to the Vitro home directory can be specifed by an JNDI
|
||||
* value, or by a System property, or by a property in
|
||||
* WEB-INF/resources/build.properties, in that order. If the Vitro home
|
||||
* directory is specified in more than one way, a warning is issued and the
|
||||
* first value is used.
|
||||
*
|
||||
* <pre>
|
||||
* If the Vitro home directory cannot be located, or if it does not contain a
|
||||
* file called 'runtime.properties', or if the file cannot be loaded, a fatal
|
||||
* error is registered to abort the startup.
|
||||
*
|
||||
* <Context override="true">
|
||||
* <Environment name="path.configuration"
|
||||
* value="/wherever/the/file/lives/deploy.properties"
|
||||
* type="java.lang.String"
|
||||
* override="false" />
|
||||
* </Context>
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* We look in this environment variable to find the path to the properties file.
|
||||
* If there is no such environment variable, the default path is used.
|
||||
*
|
||||
* Once the path has been determined, we will use it to look for a resource in
|
||||
* the classpath. So if the path is "deploy.properties", it might be found in
|
||||
* "tomcat/webapps/vivo/WEB-INF/classes/deploy.properties". Of course, it might
|
||||
* also be found in any other portion of the classpath as well.
|
||||
*
|
||||
* If we can't find the resource in the classpath, we will use it to look for an
|
||||
* external file. So, one might reasonably set this value to something like
|
||||
* "/usr/local/vitro/stuff/my.deploy.properties".
|
||||
*
|
||||
* If neither a resource nor an external file can be found, we throw an
|
||||
* exception and set AbortStartup.
|
||||
* The ConfigurationProperties bean is created from the key/value pairs found in
|
||||
* 'runtime.properties', and is stored in the servlet context. The value that
|
||||
* was determined for 'vitro.home' is also included in the bean.
|
||||
*/
|
||||
public class ConfigurationPropertiesSetup implements ServletContextListener {
|
||||
private static final Log log = LogFactory
|
||||
.getLog(ConfigurationPropertiesSetup.class);
|
||||
|
||||
/**
|
||||
* The JNDI naming context where Tomcat stores environment attributes.
|
||||
*/
|
||||
static final String JNDI_BASE = "java:comp/env";
|
||||
/** JNDI path that defines the Vitro home directory */
|
||||
private static final String VHD_JNDI_PATH = "java:comp/env/vitro/home";
|
||||
|
||||
/**
|
||||
* The name of the JNDI environment mapping for the path to the
|
||||
* configuration file (or resource).
|
||||
*/
|
||||
static final String PATH_CONFIGURATION = "path.configuration";
|
||||
/** System property that defines the Vitro home directory */
|
||||
private static final String VHD_SYSTEM_PROPERTY = "vitro.home";
|
||||
|
||||
/**
|
||||
* If we don't find the path to the config properties from a JNDI mapping,
|
||||
* use this. Not final, so we can jigger it for unit tests.
|
||||
*/
|
||||
private static String DEFAULT_CONFIG_PATH = "deploy.properties";
|
||||
/** build.properties property that defines the Vitro home directory */
|
||||
private static final String VHD_BUILD_PROPERTY = "vitro.home";
|
||||
|
||||
/** Configuration property to store the Vitro home directory */
|
||||
private static final String VHD_CONFIGURATION_PROPERTY = "vitro.home";
|
||||
|
||||
/** Name of the file that contains runtime properties. */
|
||||
private static final String FILE_RUNTIME_PROPERTIES = "runtime.properties";
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
|
@ -85,12 +71,18 @@ public class ConfigurationPropertiesSetup implements ServletContextListener {
|
|||
try {
|
||||
InputStream stream = null;
|
||||
try {
|
||||
stream = locatePropertiesFile();
|
||||
|
||||
File vitroHomeDir = locateVitroHomeDirectory(ctx, ss);
|
||||
|
||||
File runtimePropertiesFile = locateRuntimePropertiesFile(
|
||||
vitroHomeDir, ss);
|
||||
stream = new FileInputStream(runtimePropertiesFile);
|
||||
|
||||
Map<String, String> preempts = createPreemptiveProperties(
|
||||
VHD_CONFIGURATION_PROPERTY, vitroHomeDir);
|
||||
ConfigurationPropertiesImpl bean = new ConfigurationPropertiesImpl(
|
||||
stream);
|
||||
stream, preempts);
|
||||
|
||||
ConfigurationProperties.setBean(ctx, bean);
|
||||
|
||||
ss.info(this, "Loaded " + bean.getPropertyMap().size()
|
||||
+ " properties.");
|
||||
} finally {
|
||||
|
@ -102,81 +94,171 @@ public class ConfigurationPropertiesSetup implements ServletContextListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (IllegalStateException e) {
|
||||
ss.fatal(this, e.getMessage(), e);
|
||||
} catch (Exception e) {
|
||||
log.error(e, e);
|
||||
ss.fatal(this, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private InputStream locatePropertiesFile() {
|
||||
String path = determinePathToProperties();
|
||||
log.debug("Configuration properties path is '" + path + "'");
|
||||
|
||||
if (resourceExists(path)) {
|
||||
log.debug("Found configuration properties as a resource.");
|
||||
return getResourceStream(path);
|
||||
}
|
||||
|
||||
if (externalFileExists(path)) {
|
||||
log.debug("Found configuration properties as an external file.");
|
||||
return getExternalFileStream(path);
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Can't find the properties file at '"
|
||||
+ path + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
* If we can't find it with JNDI, use the default.
|
||||
* Look in the JDNI environment, the system properties, and the
|
||||
* build.properties file.
|
||||
*
|
||||
* If we don't find it, fail. If we find it more than once, warn and use the
|
||||
* first one.
|
||||
*
|
||||
* Confirm that it is an existing, readable directory.
|
||||
*/
|
||||
private String determinePathToProperties() {
|
||||
private File locateVitroHomeDirectory(ServletContext ctx, StartupStatus ss) {
|
||||
Map<String, String> whereWasIt = new LinkedHashMap<String, String>();
|
||||
getVhdFromJndi(whereWasIt);
|
||||
getVhdFromSystemProperties(whereWasIt);
|
||||
getVhdFromBuildProperties(ctx, whereWasIt);
|
||||
|
||||
if (whereWasIt.isEmpty()) {
|
||||
String message = String.format("Can't find a value "
|
||||
+ "for the Vitro home directory. "
|
||||
+ "Looked in JNDI environment at '%s'. "
|
||||
+ "Looked for a system property named '%s'. "
|
||||
+ "Looked in 'WEB-INF/resources/build.properties' "
|
||||
+ "for '%s'.", VHD_JNDI_PATH, VHD_SYSTEM_PROPERTY,
|
||||
VHD_BUILD_PROPERTY);
|
||||
throw new IllegalStateException(message);
|
||||
} else if (whereWasIt.size() > 1) {
|
||||
String message = String.format("Found multiple values for the "
|
||||
+ "Vitro home directory: " + whereWasIt.keySet());
|
||||
ss.warning(this, message);
|
||||
}
|
||||
String message = whereWasIt.keySet().iterator().next();
|
||||
String vhdPath = whereWasIt.values().iterator().next();
|
||||
|
||||
ss.info(this, message);
|
||||
|
||||
File vhd = new File(vhdPath);
|
||||
if (!vhd.exists()) {
|
||||
throw new IllegalStateException("Vitro home directory '" + vhdPath
|
||||
+ "' does not exist.");
|
||||
}
|
||||
if (!vhd.isDirectory()) {
|
||||
throw new IllegalStateException("Vitro home directory '" + vhdPath
|
||||
+ "' is not a directory.");
|
||||
}
|
||||
if (!vhd.canRead()) {
|
||||
throw new IllegalStateException("Vitro home directory '" + vhdPath
|
||||
+ "' cannot be read.");
|
||||
}
|
||||
if (!vhd.canWrite()) {
|
||||
throw new IllegalStateException(
|
||||
"Can't write to Vitro home directory: '" + vhdPath + "'.");
|
||||
}
|
||||
|
||||
return vhd;
|
||||
}
|
||||
|
||||
private void getVhdFromJndi(Map<String, String> whereWasIt) {
|
||||
try {
|
||||
Context envCtx = (Context) new InitialContext().lookup(JNDI_BASE);
|
||||
if (envCtx == null) {
|
||||
log.debug("JNDI Lookup on '" + JNDI_BASE + "' failed.");
|
||||
return DEFAULT_CONFIG_PATH;
|
||||
String vhdPath = (String) new InitialContext()
|
||||
.lookup(VHD_JNDI_PATH);
|
||||
|
||||
if (vhdPath == null) {
|
||||
log.debug("Didn't find a JNDI value at '" + VHD_JNDI_PATH
|
||||
+ "'.");
|
||||
return;
|
||||
}
|
||||
|
||||
String configPath = (String) envCtx.lookup(PATH_CONFIGURATION);
|
||||
if (configPath == null) {
|
||||
log.debug("JNDI Lookup on '" + PATH_CONFIGURATION + "' failed.");
|
||||
return DEFAULT_CONFIG_PATH;
|
||||
}
|
||||
|
||||
log.debug("deploy.property as specified by JNDI: " + configPath);
|
||||
return configPath;
|
||||
log.debug("'" + VHD_JNDI_PATH + "' as specified by JNDI: "
|
||||
+ vhdPath);
|
||||
String message = String.format(
|
||||
"JNDI environment '%s' was set to '%s'", VHD_JNDI_PATH,
|
||||
vhdPath);
|
||||
whereWasIt.put(message, vhdPath);
|
||||
} catch (NamingException e) {
|
||||
log.warn("JNDI lookup failed. "
|
||||
+ "Using default path for config properties.", e);
|
||||
return DEFAULT_CONFIG_PATH;
|
||||
log.debug("JNDI lookup failed. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean resourceExists(String path) {
|
||||
return getResourceStream(path) != null;
|
||||
private void getVhdFromSystemProperties(Map<String, String> whereWasIt) {
|
||||
String vhdPath = System.getProperty(VHD_SYSTEM_PROPERTY);
|
||||
|
||||
if (vhdPath == null) {
|
||||
log.debug("Didn't find a system property value at '"
|
||||
+ VHD_SYSTEM_PROPERTY + "'.");
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug("'" + VHD_SYSTEM_PROPERTY
|
||||
+ "' as specified by system property: " + vhdPath);
|
||||
String message = String.format("System property '%s' was set to '%s'",
|
||||
VHD_SYSTEM_PROPERTY, vhdPath);
|
||||
whereWasIt.put(message, vhdPath);
|
||||
}
|
||||
|
||||
private InputStream getResourceStream(String path) {
|
||||
return getClass().getClassLoader().getResourceAsStream(path);
|
||||
}
|
||||
private void getVhdFromBuildProperties(ServletContext ctx,
|
||||
Map<String, String> whereWasIt) {
|
||||
String resourcePath = "/WEB-INF/resources/build.properties";
|
||||
|
||||
private boolean externalFileExists(String path) {
|
||||
File file = new File(path);
|
||||
return file.isFile();
|
||||
}
|
||||
|
||||
private InputStream getExternalFileStream(String path) {
|
||||
InputStream stream = null;
|
||||
File file = new File(path);
|
||||
if (file.isFile()) {
|
||||
try {
|
||||
stream = new FileInputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
// testing file.isFile() should have prevented this
|
||||
log.error(e, e);
|
||||
try {
|
||||
stream = ctx.getResourceAsStream(resourcePath);
|
||||
if (stream == null) {
|
||||
log.debug("Didn't find a resource at '" + resourcePath + "'.");
|
||||
return;
|
||||
}
|
||||
|
||||
Properties props = new Properties();
|
||||
props.load(stream);
|
||||
String vhdPath = props.getProperty(VHD_BUILD_PROPERTY);
|
||||
if (vhdPath == null) {
|
||||
log.debug("'" + resourcePath + "' didn't contain a value for '"
|
||||
+ VHD_BUILD_PROPERTY + "'.");
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug("'" + VHD_BUILD_PROPERTY
|
||||
+ "' as specified by build.properties: " + vhdPath);
|
||||
String message = String.format(
|
||||
"In resource '%s', '%s' was set to '%s'.", resourcePath,
|
||||
VHD_BUILD_PROPERTY, vhdPath);
|
||||
whereWasIt.put(message, vhdPath);
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to load from '" + resourcePath + "'.", e);
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
private File locateRuntimePropertiesFile(File vitroHomeDir, StartupStatus ss) {
|
||||
File rpf = new File(vitroHomeDir, FILE_RUNTIME_PROPERTIES);
|
||||
|
||||
if (!rpf.exists()) {
|
||||
throw new IllegalStateException("Did not find '"
|
||||
+ FILE_RUNTIME_PROPERTIES + "' in vitro home directory '"
|
||||
+ vitroHomeDir + "'");
|
||||
}
|
||||
if (!rpf.isFile()) {
|
||||
throw new IllegalStateException("'" + rpf.getPath()
|
||||
+ "' is not a file.");
|
||||
}
|
||||
if (!rpf.canRead()) {
|
||||
throw new IllegalStateException("Cannot read '" + rpf.getPath()
|
||||
+ "'.");
|
||||
}
|
||||
ss.info(this, "Loading runtime properties from '" + rpf.getPath() + "'");
|
||||
return rpf;
|
||||
}
|
||||
|
||||
private Map<String, String> createPreemptiveProperties(
|
||||
String propertyVitroHome, File vitroHomeDir) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(propertyVitroHome, vitroHomeDir.getAbsolutePath());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ConfigurationPropertiesSmokeTests implements
|
|||
private static final Log log = LogFactory
|
||||
.getLog(ConfigurationPropertiesSmokeTests.class);
|
||||
|
||||
private static final String PROPERTY_HOME_DIRECTORY = "vitro.home.directory";
|
||||
private static final String PROPERTY_HOME_DIRECTORY = "vitro.home";
|
||||
private static final String PROPERTY_DB_URL = "VitroConnection.DataSource.url";
|
||||
private static final String PROPERTY_DB_USERNAME = "VitroConnection.DataSource.username";
|
||||
private static final String PROPERTY_DB_PASSWORD = "VitroConnection.DataSource.password";
|
||||
|
@ -61,7 +61,7 @@ public class ConfigurationPropertiesSmokeTests implements
|
|||
ConfigurationProperties props, StartupStatus ss) {
|
||||
String homeDirectoryPath = props.getProperty(PROPERTY_HOME_DIRECTORY);
|
||||
if (homeDirectoryPath == null || homeDirectoryPath.isEmpty()) {
|
||||
ss.fatal(this, "deploy.properties does not contain a value for '"
|
||||
ss.fatal(this, "Can't find a value for the home directory: '"
|
||||
+ PROPERTY_HOME_DIRECTORY + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -97,19 +97,19 @@ public class ConfigurationPropertiesSmokeTests implements
|
|||
ConfigurationProperties props, StartupStatus ss) {
|
||||
String url = props.getProperty(PROPERTY_DB_URL);
|
||||
if (url == null || url.isEmpty()) {
|
||||
ss.fatal(this, "deploy.properties does not contain a value for '"
|
||||
ss.fatal(this, "runtime.properties does not contain a value for '"
|
||||
+ PROPERTY_DB_URL + "'");
|
||||
return;
|
||||
}
|
||||
String username = props.getProperty(PROPERTY_DB_USERNAME);
|
||||
if (username == null || username.isEmpty()) {
|
||||
ss.fatal(this, "deploy.properties does not contain a value for '"
|
||||
ss.fatal(this, "runtime.properties does not contain a value for '"
|
||||
+ PROPERTY_DB_USERNAME + "'");
|
||||
return;
|
||||
}
|
||||
String password = props.getProperty(PROPERTY_DB_PASSWORD);
|
||||
if (password == null || password.isEmpty()) {
|
||||
ss.fatal(this, "deploy.properties does not contain a value for '"
|
||||
ss.fatal(this, "runtime.properties does not contain a value for '"
|
||||
+ PROPERTY_DB_PASSWORD + "'");
|
||||
return;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ public class ConfigurationPropertiesSmokeTests implements
|
|||
ConfigurationProperties props, StartupStatus ss) {
|
||||
String ns = props.getProperty(PROPERTY_DEFAULT_NAMESPACE);
|
||||
if (ns == null || ns.isEmpty()) {
|
||||
ss.fatal(this, "deploy.properties does not contain a value for '"
|
||||
ss.fatal(this, "runtime.properties does not contain a value for '"
|
||||
+ PROPERTY_DEFAULT_NAMESPACE + "'");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public class ExternalAuthHelper {
|
|||
}
|
||||
|
||||
if (externalAuthServerUrl == null) {
|
||||
log.debug("deploy.properties doesn't contain a value for '"
|
||||
log.debug("runtime.properties doesn't contain a value for '"
|
||||
+ PROPERTY_EXTERNAL_AUTH_SERVER_URL
|
||||
+ "' -- sending directly to '" + returnUrl + "'");
|
||||
return returnUrl;
|
||||
|
@ -142,7 +142,7 @@ public class ExternalAuthHelper {
|
|||
|
||||
if (externalAuthHeaderName == null) {
|
||||
log.error("User asked for external authentication, "
|
||||
+ "but deploy.properties doesn't contain a value for '"
|
||||
+ "but runtime.properties doesn't contain a value for '"
|
||||
+ PROPERTY_EXTERNAL_AUTH_ID_HEADER + "'");
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class LoginExternalAuthReturn extends BaseLoginServlet {
|
|||
* the header will contain the name of the user who just logged in.
|
||||
*
|
||||
* Deal with these possibilities:
|
||||
* - The header name was not configured in deploy.properties. Complain.
|
||||
* - The header name was not configured in runtime.properties. Complain.
|
||||
* - No username: the login failed. Complain
|
||||
* - User corresponds to a User acocunt. Record the login.
|
||||
* - User corresponds to an Individual (self-editor).
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ContactMailController extends FreemarkerHttpServlet {
|
|||
private final static String TEMPLATE_ERROR = "contactForm-error.ftl";
|
||||
private final static String TEMPLATE_FORM = "contactForm-form.ftl";
|
||||
|
||||
private static final String PROPERTY_VITRO_HOME_DIR = "vitro.home.directory";
|
||||
private static final String PROPERTY_VITRO_HOME_DIR = "vitro.home";
|
||||
private static final String EMAIL_JOURNAL_FILE_DIR = "emailJournal";
|
||||
private static final String EMAIL_JOURNAL_FILE_NAME = "contactFormEmails.html";
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ public class JSONReconcileServlet extends VitroHttpServlet {
|
|||
viewJson.put("url", urlBuf.toString() + "/individual?uri={{id}}");
|
||||
json.put("view", viewJson);
|
||||
|
||||
// parse defaultTypeList from deploy.properties
|
||||
// parse defaultTypeList from runtime.properties
|
||||
if (defaultTypeList != null) {
|
||||
String[] splitList = defaultTypeList.split(";");
|
||||
String[][] idNameArray = new String[splitList.length][splitList.length];
|
||||
|
|
|
@ -35,7 +35,7 @@ public class FileStorageSetup implements ServletContextListener {
|
|||
* {@link ConfigurationProperties} for the vivo home directory. The file
|
||||
* storage base directory is in a subdirectory below this one.
|
||||
*/
|
||||
public static final String PROPERTY_VITRO_HOME_DIR = "vitro.home.directory";
|
||||
public static final String PROPERTY_VITRO_HOME_DIR = "vitro.home";
|
||||
public static final String FILE_STORAGE_SUBDIRECTORY = "uploads";
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,7 +89,7 @@ public class SolrSetup implements javax.servlet.ServletContextListener{
|
|||
/* setup the http connection with the solr server */
|
||||
String solrServerUrlString = ConfigurationProperties.getBean(sce).getProperty("vitro.local.solr.url");
|
||||
if( solrServerUrlString == null ){
|
||||
ss.fatal(this, "Could not find vitro.local.solr.url in deploy.properties. "+
|
||||
ss.fatal(this, "Could not find vitro.local.solr.url in runtime.properties. "+
|
||||
"Vitro application needs a URL of a solr server that it can use to index its data. " +
|
||||
"It should be something like http://localhost:${port}" + context.getContextPath() + "solr"
|
||||
);
|
||||
|
@ -101,7 +101,7 @@ public class SolrSetup implements javax.servlet.ServletContextListener{
|
|||
solrServerUrl = new URL(solrServerUrlString);
|
||||
} catch (MalformedURLException e) {
|
||||
ss.fatal(this, "Can't connect with the solr server. " +
|
||||
"The value for vitro.local.solr.url in deploy.properties is not a valid URL: " + solrServerUrlString);
|
||||
"The value for vitro.local.solr.url in runtime.properties is not a valid URL: " + solrServerUrlString);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -546,7 +546,7 @@ public class JenaDataSourceSetupBase extends JenaBaseDaoCon {
|
|||
if ((dns != null) && (!dns.isEmpty())) {
|
||||
return dns;
|
||||
} else {
|
||||
throw new IllegalStateException("deploy.properties does not "
|
||||
throw new IllegalStateException("runtime.properties does not "
|
||||
+ "contain a value for '" + VITRO_DEFAULT_NAMESPACE + "'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SolrSmokeTest implements ServletContextListener {
|
|||
.getProperty("vitro.local.solr.url", "");
|
||||
if (solrUrlString.isEmpty()) {
|
||||
ss.fatal(this, "Can't connect to Solr search engine. "
|
||||
+ "deploy.properties must contain a value for "
|
||||
+ "runtime.properties must contain a value for "
|
||||
+ "vitro.local.solr.url");
|
||||
return;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class SolrSmokeTest implements ServletContextListener {
|
|||
} catch (MalformedURLException e) {
|
||||
ss.fatal(this, "Can't connect to Solr search engine. "
|
||||
+ "The value for vitro.local.solr.url "
|
||||
+ "in deploy.properties is not a valid URL: '"
|
||||
+ "in runtime.properties is not a valid URL: '"
|
||||
+ solrUrlString + "'", e);
|
||||
}
|
||||
|
||||
|
@ -124,9 +124,7 @@ public class SolrSmokeTest implements ServletContextListener {
|
|||
int status = e.getStatusCode();
|
||||
Throwable cause = e.getCause();
|
||||
|
||||
if (status == HttpStatus.SC_FORBIDDEN) {
|
||||
warnForbidden();
|
||||
} else if (status == SOCKET_TIMEOUT_STATUS) {
|
||||
if (status == SOCKET_TIMEOUT_STATUS) {
|
||||
warnSocketTimeout();
|
||||
} else if (status != 0) {
|
||||
warnBadHttpStatus(status);
|
||||
|
@ -151,23 +149,14 @@ public class SolrSmokeTest implements ServletContextListener {
|
|||
ss.warning(listener, "Can't connect to the Solr search engine. "
|
||||
+ "The socket connection has repeatedly timed out. "
|
||||
+ "Check the value of vitro.local.solr.url in "
|
||||
+ "deploy.properties. Is Solr responding at that URL?");
|
||||
}
|
||||
|
||||
private void warnForbidden() {
|
||||
ss.warning(listener, "Can't connect to the Solr search engine. "
|
||||
+ "The Solr server will not accept connections from this "
|
||||
+ "host. Check the value of "
|
||||
+ "vitro.local.solr.ipaddress.mask in "
|
||||
+ "deploy.properties -- "
|
||||
+ "does it authorize access from this IP address?");
|
||||
+ "runtime.properties. Is Solr responding at that URL?");
|
||||
}
|
||||
|
||||
private void warnBadHttpStatus(int status) {
|
||||
ss.warning(listener, "Can't connect to the Solr search engine. "
|
||||
+ "The Solr server returned a status code of " + status
|
||||
+ ". Check the value of vitro.local.solr.url in "
|
||||
+ "deploy.properties.");
|
||||
+ "runtime.properties.");
|
||||
}
|
||||
|
||||
private void warnProtocolViolation(HttpException e) {
|
||||
|
@ -179,7 +168,7 @@ public class SolrSmokeTest implements ServletContextListener {
|
|||
ss.warning(listener, "Can't connect to the Solr search engine. '"
|
||||
+ e.getMessage() + "' is an unknown host."
|
||||
+ "Check the value of vitro.local.solr.url in "
|
||||
+ "deploy.properties.", e);
|
||||
+ "runtime.properties.", e);
|
||||
}
|
||||
|
||||
private void warnConnectionRefused(ConnectException e) {
|
||||
|
@ -187,7 +176,7 @@ public class SolrSmokeTest implements ServletContextListener {
|
|||
+ "The host refused the connection. "
|
||||
+ "Is it possible that the port number is incorrect? "
|
||||
+ "Check the value of vitro.local.solr.url in "
|
||||
+ "deploy.properties.", e);
|
||||
+ "runtime.properties.", e);
|
||||
}
|
||||
|
||||
private void warnTransportError(IOException e) {
|
||||
|
|
|
@ -182,10 +182,10 @@ public class UpdatePermissionSetUris implements ServletContextListener {
|
|||
|
||||
Journal(ServletContext ctx) throws IOException {
|
||||
String homeDirectoryPath = ConfigurationProperties.getBean(ctx)
|
||||
.getProperty("vitro.home.directory");
|
||||
.getProperty("vitro.home");
|
||||
if (homeDirectoryPath == null) {
|
||||
throw new IllegalStateException(
|
||||
"No value found for vitro.home.directory");
|
||||
"No value found for vitro.home");
|
||||
}
|
||||
File homeDirectory = new File(homeDirectoryPath);
|
||||
confirmIsDirectory(homeDirectory);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class OpenSocialSmokeTests implements ServletContextListener {
|
|||
configProps = ConfigurationProperties.getBean(ctx);
|
||||
|
||||
/*
|
||||
* If OpenSocial is not configured in deploy.properties, skip the tests.
|
||||
* If OpenSocial is not configured in runtime.properties, skip the tests.
|
||||
*/
|
||||
if (!configurationPresent()) {
|
||||
ss.info(this, "The OpenSocial connection is not configured.");
|
||||
|
@ -188,7 +188,7 @@ public class OpenSocialSmokeTests implements ServletContextListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check that the Token Key file has been specified in deploy.properties,
|
||||
* Check that the Token Key file has been specified in runtime.properties,
|
||||
* and that it actually does exist.
|
||||
*/
|
||||
private void checkTokenKeyFile() {
|
||||
|
@ -210,14 +210,14 @@ public class OpenSocialSmokeTests implements ServletContextListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the Token Service info from deploy.properties. It must be in the form
|
||||
* Get the Token Service info from runtime.properties. It must be in the form
|
||||
* of host:port, and may not refer to localhost.
|
||||
*/
|
||||
private void checkTokenServiceInfo() {
|
||||
String tsInfo = configProps.getProperty(PROPERTY_SHINDIG_TOKEN_SERVICE);
|
||||
if (StringUtils.isEmpty(tsInfo)) {
|
||||
warnings.add(new Warning("There is no value for '"
|
||||
+ PROPERTY_SHINDIG_TOKEN_SERVICE + "' in deploy.properties"));
|
||||
+ PROPERTY_SHINDIG_TOKEN_SERVICE + "' in runtime.properties"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ public class OpenSocialSmokeTests implements ServletContextListener {
|
|||
|
||||
private static class NoSuchPropertyException extends Exception {
|
||||
NoSuchPropertyException(String key) {
|
||||
super("There is no value for '" + key + "' in deploy.properties");
|
||||
super("There is no value for '" + key + "' in build.properties");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue