Merge branch 'maint-rel-1.6' into develop

This commit is contained in:
j2blake 2013-12-10 11:38:24 -05:00
commit fc6e4ce2ed
5 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,50 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller.admin;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.SortedMap;
import java.util.TreeMap;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
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;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
/**
* Show the current ConfigurationProperties and the Java system properties.
*/
public class ShowConfiguration extends FreemarkerHttpServlet {
@Override
protected Actions requiredActions(VitroRequest vreq) {
return Actions.AUTHORIZED;
}
@Override
protected ResponseValues processRequest(VitroRequest vreq) {
Map<String, Object> body = new HashMap<String, Object>();
body.put("configurationProperties", getConfigurationProperties(vreq));
body.put("javaSystemProperties", getSystemProperties());
return new TemplateResponseValues("admin-showConfiguration.ftl", body);
}
private SortedMap<String, String> getConfigurationProperties(
VitroRequest vreq) {
return new TreeMap<>(ConfigurationProperties.getBean(vreq)
.getPropertyMap());
}
private SortedMap<String, String> getSystemProperties() {
Properties props = System.getProperties();
SortedMap<String, String> map = new TreeMap<>();
for (String key : props.stringPropertyNames()) {
map.put(key, props.getProperty(key));
}
return map;
}
}

View file

@ -20,6 +20,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Property;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
@ -292,6 +293,14 @@ public class GroupedPropertyList extends BaseTemplateModel {
} else if (op.getRangeVClassURI() == null) {
return (piOp.getRangeVClassURI() != null);
} else {
//Check and see if the range vclass exists for the possible piOp and populated op properties,
//because for populated properties, if the range class is a union,
//blank nodes will be broken and the code should instead use the existing or piOp range class uri
VClass piOpRangeClass = wadf.getVClassDao().getVClassByURI(piOp.getRangeVClassURI());
VClass opRangeClass = wadf.getVClassDao().getVClassByURI(op.getRangeVClassURI());
//if the possible range class exists but the populated one does not, then return true to allow the possible
//class to be utilized
if(piOpRangeClass != null && opRangeClass == null) return true;
return (wadf.getVClassDao().isSubClassOf(
piOp.getRangeVClassURI(), op.getRangeVClassURI()));
}

View file

@ -660,6 +660,15 @@
<url-pattern>/admin/showAuth</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ShowConfiguration</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.admin.ShowConfiguration</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ShowConfiguration</servlet-name>
<url-pattern>/admin/showConfiguration</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>StartupStatus</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.admin.StartupStatusController</servlet-class>

View file

@ -0,0 +1,28 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template viewing the authorization mechanisms: current identifiers, factories, policies, etc. -->
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/showAuth.css" />')}
<h2>Configuration settings</h2>
<section id="show-auth" role="region">
<h4>Build and runtime properties:</h4>
<table summary="Build and Runtime Properties">
<#list configurationProperties?keys as key>
<tr>
<td>${key}</td>
<td>${configurationProperties[key]}</td>
</tr>
</#list>
</table>
<h4>Java system properties:</h4>
<table summary="Java System Properties">
<#list javaSystemProperties?keys as key>
<tr>
<td>${key}</td>
<td>${javaSystemProperties[key]}</td>
</tr>
</#list>
</table>
</section>

View file

@ -56,6 +56,8 @@
Links
<br/>
<a href="${urls.base}/admin/log4j.jsp">Set log levels</a>
<a href="${urls.base}/admin/showConfiguration">Show Configuration</a>
<br/>
<a href="${urls.base}/admin/showAuth">Show authorization info</a>
<a href="${urls.base}/admin/showThreads">Show background threads</a>
</div>