Improve output: distinguish between failed assertions (failures) and unexpected exceptions (errors), and print a filtered stack trace for any exception.

This commit is contained in:
jeb228 2010-01-29 22:13:57 +00:00
commit 4f2e303079
1839 changed files with 235630 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,114 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<html>
<%@ page contentType="text/html; charset=utf-8" %>
<%
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
%>
<%@ include file="i18nLib.jsp" %>
<%
// initialize a private HttpServletRequest
setRequest(request);
// set a resouce base
setResouceBase("i18n");
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Apache-Axis</title>
</head>
<body bgcolor="#FFFFFF">
<h1 align="center">Apache-AXIS</h1>
<%= getLocaleChoice() %>
<%
out.print(getMessage("welcomeMessage")+"<p/>");
out.print(getMessage("operationType"));
%>
<ul>
<li>
<%
out.print("<a href=\""+ getMessage("validationURL") +"\">");
out.print(getMessage("validation") +"</a> - ");
out.print(getMessage("validationFootnote00") +"<br>");
out.print("<i>"+ getMessage("validationFootnote01") +"</i>");
%>
</li>
<li>
<%
out.print("<a href=\""+ getMessage("serviceListURL") +"\">");
out.print(getMessage("serviceList") +"</a> - ");
out.print(getMessage("serviceListFootnote"));
%>
</li>
<li>
<%
out.print("<a href=\""+ getMessage("callAnEndpointURL") +"\">");
out.print(getMessage("callAnEndpoint") +"</a> - ");
out.print(getMessage("callAnEndpointFootnote00") +" ");
out.print(getMessage("callAnEndpointFootnote01"));
%>
</li>
<li>
<%
out.print("<a href=\""+ getMessage("visitURL") +"\">");
out.print(getMessage("visit") +"</a> - ");
out.print(getMessage("visitFootnote"));
%>
</li>
<li>
<%
out.print("<a href=\""+ getMessage("adminURL") +"\">");
out.print(getMessage("admin") +"</a> - ");
out.print(getMessage("adminFootnote"));
%>
</li>
<li>
<%
out.print("<a href=\""+ getMessage("soapMonitorURL") +"\">");
out.print(getMessage("soapMonitor") +"</a> - ");
out.print(getMessage("soapMonitorFootnote"));
%>
</li>
</ul>
<%
out.print(getMessage("sideNote") +"<p/>");
%>
<%
out.print("<h3>"+ getMessage("validatingAxis") +"</h3>");
out.print(getMessage("validationNote00") +"<p/>");
out.print(getMessage("validationNote01"));
%>
</body>
</html>

View file

@ -0,0 +1,274 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="java.io.File,
java.io.IOException,
java.util.Date"
session="false" %>
<html>
<head>
<title>System Fingerprint</title>
</head>
<body bgcolor=#ffffff>
<%!
/*
* Fingerprint the users system. This is mainly for use in
* diagnosing classpath problems. It is intended to dump out
* a copy of the environment this webapp is running in,
* and additionally attempt to identify versions of each jar
* in the classpath.
*
* @author Brian Ewins
*/
private java.util.Properties versionProps=new java.util.Properties();
/**
* Identify the version of a jar file. This uses a properties file
* containing known names and sizes in the format
* 'name(size)=version'. Version strings should be like 'xerces-1.4'
* ie they should include the name of the library.
*/
public String getFileVersion(File file) throws IOException {
String key="<td>"+file.getName()+"</td>";
key+= "<td>"+file.length()+"</td>";
Date timestamp=new Date(file.lastModified());
key+= "<td>"+timestamp.toString()+"</td>";
return key;
/* TODO: implement
String value=versionProps.getProperty(key);
if (value==null) {
// make it possible to have jars without version nos
value=versionProps.getProperty(file.getName());
}
if (value==null) {
// fall back on something obvious
value=key;
Date timestamp=new Date(file.lastModified());
value+=" / "+timestamp.toString();
}
return value;
*/
}
/**
* Split up a classpath-like variable. Returns a list of files.
* TODO: this can't cope with relative paths. I think theres code in BCEL that
* can be used for this?
*/
File[] splitClasspath(String path) throws IOException {
java.util.StringTokenizer st=
new java.util.StringTokenizer(path,
System.getProperty("path.separator"));
int toks=st.countTokens();
File[] files=new File[toks];
for(int i=0;i<toks;i++) {
files[i]=new File(st.nextToken());
}
return files;
}
/** given a list of files, return a list of jars which actually exist */
File[] scanFiles(File[] files) throws IOException {
File[] jars=new File[files.length];
int found=0;
for (int i=0; i<files.length; i++) {
if (files[i].getName().toLowerCase().endsWith(".jar")
&& files[i].exists()) {
jars[found]=files[i];
found++;
}
}
if (found<files.length) {
File[] temp=new File[found];
System.arraycopy(jars,0,temp,0,found);
jars=temp;
}
return jars;
}
private static final File[] NO_FILES=new File[0];
/** scan a directory for jars */
public File[] scanDir(String dir) throws IOException
{
if(dir==null) {
return NO_FILES;
}
return scanDir(new File(dir));
}
public File[] scanDir(File dir) throws IOException {
if (!dir.exists() || !dir.isDirectory()) {
return NO_FILES;
}
return scanFiles(dir.listFiles());
}
/** scan a classpath for jars */
public File[] scanClasspath(String path) throws IOException {
if (path==null) {
return NO_FILES;
}
return scanFiles(splitClasspath(path));
}
/**
* scan a 'dirpath' (like the java.ext.dirs system property) for jars
*/
public File[] scanDirpath(String path) throws IOException {
if (path==null) {
return NO_FILES;
}
File[] current=new File[0];
File[] dirs=splitClasspath(path);
for(int i=0; i<dirs.length; i++) {
File[] jars=scanDir(dirs[i]);
File[] temp=new File[current.length+jars.length];
System.arraycopy(current,0,temp,0,current.length);
System.arraycopy(jars,0,temp,current.length,jars.length);
current=temp;
}
return scanFiles(current);
}
/** print out the jar versions for a directory */
public void listDirectory(String title, JspWriter out,String dir, String comment) throws IOException {
listVersions(title, out,scanDir(dir), comment);
}
/** print out the jar versions for a directory-like system property */
public void listDirProperty(String title, JspWriter out,String key, String comment) throws IOException {
listVersions(title, out,scanDir(System.getProperty(key)), comment);
}
/** print out the jar versions for a classpath-like system property */
public void listClasspathProperty(String title, JspWriter out,String key, String comment) throws IOException {
listVersions(title, out,scanClasspath(System.getProperty(key)), comment);
}
/** print out the jar versions for a 'java.ext.dirs'-like system property */
public void listDirpathProperty(String title, JspWriter out,String key, String comment) throws IOException {
listVersions(title, out,scanDirpath(System.getProperty(key)), comment);
}
/** print out the jar versions for a context-relative directory */
public void listContextPath(String title, JspWriter out, String path, String comment) throws IOException {
listVersions(title, out,scanDir(getServletConfig().getServletContext().getRealPath(path)), comment);
}
/** print out the jar versions for a given list of files */
public void listVersions(String title, JspWriter out,File[] jars, String comment) throws IOException {
out.print("<h2>");
out.print(title);
out.println("</h2>");
out.println("<table>");
for (int i=0; i<jars.length; i++) {
out.println("<tr>"+getFileVersion(jars[i])+"</tr>");
}
out.println("</table>");
if(comment!=null && comment.length()>0) {
out.println("<p>");
out.println(comment);
out.println("<p>");
}
}
%>
<h1>System Fingerprint</h1>
<h2>JVM and Server Version</h2>
<table>
<tr>
<td>Servlet Engine</td>
<td><%= getServletConfig().getServletContext().getServerInfo() %></td>
<td><%= getServletConfig().getServletContext().getMajorVersion() %></td>
<td><%= getServletConfig().getServletContext().getMinorVersion() %></td>
</tr>
<tr>
<td>Java VM</td>
<td><%= System.getProperty("java.vm.vendor") %></td>
<td><%= System.getProperty("java.vm.name") %></td>
<td><%= System.getProperty("java.vm.version") %></td>
</tr>
<tr>
<td>Java RE</td>
<td><%= System.getProperty("java.vendor") %></td>
<td><%= System.getProperty("java.version") %></td>
<td> </td>
</tr>
<tr>
<td>Platform</td>
<td><%= System.getProperty("os.name") %></td>
<td><%= System.getProperty("os.arch") %></td>
<td><%= System.getProperty("os.version") %></td>
</tr>
</table>
<%
listClasspathProperty("Boot jars", out,"sun.boot.class.path", "Only valid on a sun jvm");
listClasspathProperty("System jars", out,"java.class.path", null);
listDirpathProperty("Extra system jars", out,"java.ext.dirs", null);
listContextPath("Webapp jars", out, "/WEB-INF/lib", null);
// identify the container...
String container=getServletConfig().getServletContext().getServerInfo();
if (container.startsWith("Tomcat Web Server/3.2")) {
String home=System.getProperty("tomcat.home");
if(home!=null) {
listDirectory("Tomcat 3.2 Common Jars", out,
home+File.separator
+"lib",
null);
}
} else if (container.startsWith("Tomcat Web Server/3.3")) {
String home=System.getProperty("tomcat.home");
if(home!=null) {
listDirectory("Tomcat 3.3 Container Jars", out,
home+File.separator
+"lib"+File.separator
+"container",
null);
listDirectory("Tomcat 3.3 Common Jars", out,
home+File.separator
+"lib"+File.separator
+"common",
null);
}
} else if (container.startsWith("Apache Tomcat/4.0")) {
//handle catalina common dir
String home=System.getProperty("catalina.home");
if(home!=null) {
listDirectory("Tomcat 4.0 Common Jars", out,
home+File.separator
+"common"+File.separator
+"lib",
null);
}
} else if (container.startsWith("Apache Tomcat/4.1")) {
//handle catalina common dir
String home=System.getProperty("catalina.home");
if(home!=null) {
listDirectory("Tomcat 4.1 Common Jars", out,
home+File.separator
+"shared"+File.separator
+"lib",
null);
}
} else if (System.getProperty("resin.home")!=null) {
String home=System.getProperty("resin.home");
if(home!=null) {
listDirectory("Resin Common Jars", out,
home+File.separator
+"lib",
null);
}
} else if (System.getProperty("weblogic.httpd.servlet.classpath")!=null) {
listClasspathProperty("Weblogic Servlet Jars", out,
"weblogic.httpd.servlet.classpath",
null);
} else {
//TODO: identify more servlet engine classpaths.
}
%>
</body>
</html>

View file

@ -0,0 +1,493 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<html>
<%@ page contentType="text/html; charset=utf-8"
import="java.io.InputStream,
java.io.IOException,
javax.xml.parsers.SAXParser,
java.lang.reflect.*,
javax.xml.parsers.SAXParserFactory"
session="false" %>
<%
/*
* Copyright 2002,2004,2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
%>
<%!
/*
* Happiness tests for axis. These look at the classpath and warn if things
* are missing. Normally addng this much code in a JSP page is mad
* but here we want to validate JSP compilation too, and have a drop-in
* page for easy re-use
* @author Steve 'configuration problems' Loughran
* @author dims
* @author Brian Ewins
*/
/**
* test for a class existing
* @param classname
* @return class iff present
*/
Class classExists(String classname) {
try {
return Class.forName(classname);
} catch (ClassNotFoundException e) {
return null;
}
}
/**
* test for resource on the classpath
* @param resource
* @return true iff present
*/
boolean resourceExists(String resource) {
boolean found;
InputStream instream=this.getClass().getResourceAsStream(resource);
found=instream!=null;
if(instream!=null) {
try {
instream.close();
} catch (IOException e) {
}
}
return found;
}
/**
* probe for a class, print an error message is missing
* @param out stream to print stuff
* @param category text like "warning" or "error"
* @param classname class to look for
* @param jarFile where this class comes from
* @param errorText extra error text
* @param homePage where to d/l the library
* @return the number of missing classes
* @throws IOException
*/
int probeClass(JspWriter out,
String category,
String classname,
String jarFile,
String description,
String errorText,
String homePage) throws IOException {
try {
Class clazz = classExists(classname);
if(clazz == null) {
String url="";
if(homePage!=null) {
url=getMessage("seeHomepage",homePage,homePage);
}
out.write(getMessage("couldNotFound",category,classname,jarFile,errorText,url));
return 1;
} else {
String location = getLocation(out, clazz);
if(location == null) {
out.write("<li>"+getMessage("foundClass00",description,classname)+"</li><br>");
}
else {
out.write("<li>"+getMessage("foundClass01",description,classname,location)+"</li><br>");
}
return 0;
}
} catch(NoClassDefFoundError ncdfe) {
String url="";
if(homePage!=null) {
url=getMessage("seeHomepage",homePage,homePage);
}
out.write(getMessage("couldNotFoundDep",category, classname, errorText, url));
out.write(getMessage("theRootCause",ncdfe.getMessage(), classname));
return 1;
}
}
/**
* get the location of a class
* @param out
* @param clazz
* @return the jar file or path where a class was found
*/
String getLocation(JspWriter out,
Class clazz) {
try {
java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
String location = url.toString();
if(location.startsWith("jar")) {
url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
location = url.toString();
}
if(location.startsWith("file")) {
java.io.File file = new java.io.File(url.getFile());
return file.getAbsolutePath();
} else {
return url.toString();
}
} catch (Throwable t){
}
return getMessage("classFoundError");
}
/**
* a class we need if a class is missing
* @param out stream to print stuff
* @param classname class to look for
* @param jarFile where this class comes from
* @param errorText extra error text
* @param homePage where to d/l the library
* @throws IOException when needed
* @return the number of missing libraries (0 or 1)
*/
int needClass(JspWriter out,
String classname,
String jarFile,
String description,
String errorText,
String homePage) throws IOException {
return probeClass(out,
"<b>"+getMessage("error")+"</b>",
classname,
jarFile,
description,
errorText,
homePage);
}
/**
* print warning message if a class is missing
* @param out stream to print stuff
* @param classname class to look for
* @param jarFile where this class comes from
* @param errorText extra error text
* @param homePage where to d/l the library
* @throws IOException when needed
* @return the number of missing libraries (0 or 1)
*/
int wantClass(JspWriter out,
String classname,
String jarFile,
String description,
String errorText,
String homePage) throws IOException {
return probeClass(out,
"<b>"+getMessage("warning")+"</b>",
classname,
jarFile,
description,
errorText,
homePage);
}
/**
* get servlet version string
*
*/
public String getServletVersion() {
ServletContext context=getServletConfig().getServletContext();
int major = context.getMajorVersion();
int minor = context.getMinorVersion();
return Integer.toString(major) + '.' + Integer.toString(minor);
}
/**
* what parser are we using.
* @return the classname of the parser
*/
private String getParserName() {
SAXParser saxParser = getSAXParser();
if (saxParser == null) {
return getMessage("couldNotCreateParser");
}
// check to what is in the classname
String saxParserName = saxParser.getClass().getName();
return saxParserName;
}
/**
* Create a JAXP SAXParser
* @return parser or null for trouble
*/
private SAXParser getSAXParser() {
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
if (saxParserFactory == null) {
return null;
}
SAXParser saxParser = null;
try {
saxParser = saxParserFactory.newSAXParser();
} catch (Exception e) {
}
return saxParser;
}
/**
* get the location of the parser
* @return path or null for trouble in tracking it down
*/
private String getParserLocation(JspWriter out) {
SAXParser saxParser = getSAXParser();
if (saxParser == null) {
return null;
}
String location = getLocation(out,saxParser.getClass());
return location;
}
/**
* Check if class implements specified interface.
* @param Class clazz
* @param String interface name
* @return boolean
*/
private boolean implementsInterface(Class clazz, String interfaceName) {
if (clazz == null) {
return false;
}
Class[] interfaces = clazz.getInterfaces();
if (interfaces.length != 0) {
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(interfaceName)) {
return true;
}
}
}
return false;
}
%>
<%@ include file="i18nLib.jsp" %>
<%
// initialize a private HttpServletRequest
setRequest(request);
// set a resouce base
setResouceBase("i18n");
%>
<head>
<title><%= getMessage("pageTitle") %></title>
</head>
<body bgcolor='#ffffff'>
<%
out.print("<h1>"+ getMessage("pageTitle") +"</h1>");
out.print("<h2>"+ getMessage("pageRole") +"</h2><p/>");
%>
<%= getLocaleChoice() %>
<%
out.print("<h3>"+ getMessage("neededComponents") +"</h3>");
%>
<UL>
<%
int needed=0,wanted=0;
/**
* the essentials, without these Axis is not going to work
*/
// need to check if the available version of SAAJ API meets requirements
String className = "javax.xml.soap.SOAPPart";
String interfaceName = "org.w3c.dom.Document";
Class clazz = classExists(className);
if (clazz == null || implementsInterface(clazz, interfaceName)) {
needed = needClass(out, "javax.xml.soap.SOAPMessage",
"saaj.jar",
"SAAJ API",
getMessage("criticalErrorMessage"),
"http://ws.apache.org/axis/");
} else {
String location = getLocation(out, clazz);
out.print(getMessage("invalidSAAJ",location));
out.print(getMessage("criticalErrorMessage"));
out.print(getMessage("seeHomepage","http://ws.apache.org/axis/java/install.html",getMessage("axisInstallation")));
out.print("<br>");
}
needed+=needClass(out, "javax.xml.rpc.Service",
"jaxrpc.jar",
"JAX-RPC API",
getMessage("criticalErrorMessage"),
"http://ws.apache.org/axis/");
needed+=needClass(out, "org.apache.axis.transport.http.AxisServlet",
"axis.jar",
"Apache-Axis",
getMessage("criticalErrorMessage"),
"http://ws.apache.org/axis/");
needed+=needClass(out, "org.apache.commons.discovery.Resource",
"commons-discovery.jar",
"Jakarta-Commons Discovery",
getMessage("criticalErrorMessage"),
"http://jakarta.apache.org/commons/discovery/");
needed+=needClass(out, "org.apache.commons.logging.Log",
"commons-logging.jar",
"Jakarta-Commons Logging",
getMessage("criticalErrorMessage"),
"http://jakarta.apache.org/commons/logging/");
needed+=needClass(out, "org.apache.log4j.Layout",
"log4j-1.2.8.jar",
"Log4j",
getMessage("uncertainErrorMessage"),
"http://jakarta.apache.org/log4j");
//should we search for a javax.wsdl file here, to hint that it needs
//to go into an approved directory? because we dont seem to need to do that.
needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl",
"wsdl4j.jar",
"IBM's WSDL4Java",
getMessage("criticalErrorMessage"),
null);
needed+=needClass(out, "javax.xml.parsers.SAXParserFactory",
"xerces.jar",
"JAXP implementation",
getMessage("criticalErrorMessage"),
"http://xml.apache.org/xerces-j/");
needed+=needClass(out,"javax.activation.DataHandler",
"activation.jar",
"Activation API",
getMessage("criticalErrorMessage"),
"http://java.sun.com/products/javabeans/glasgow/jaf.html");
%>
</UL>
<%
out.print("<h3>"+ getMessage("optionalComponents") +"</h3>");
%>
<UL>
<%
/*
* now the stuff we can live without
*/
wanted+=wantClass(out,"javax.mail.internet.MimeMessage",
"mail.jar",
"Mail API",
getMessage("attachmentsError"),
"http://java.sun.com/products/javamail/");
wanted+=wantClass(out,"org.apache.xml.security.Init",
"xmlsec.jar",
"XML Security API",
getMessage("xmlSecurityError"),
"http://xml.apache.org/security/");
wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory",
"jsse.jar or java1.4+ runtime",
"Java Secure Socket Extension",
getMessage("httpsError"),
"http://java.sun.com/products/jsse/");
/*
* resources on the classpath path
*/
/* add more libraries here */
%>
</UL>
<%
out.write("<h3>");
//is everythng we need here
if(needed==0) {
//yes, be happy
out.write(getMessage("happyResult00"));
} else {
//no, be very unhappy
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
out.write(getMessage("unhappyResult00",Integer.toString(needed)));
}
//now look at wanted stuff
if(wanted>0) {
out.write(getMessage("unhappyResult01",Integer.toString(wanted)));
} else {
out.write(getMessage("happyResult01"));
}
out.write("</h3>");
%>
<UL>
<%
//hint if anything is missing
if(needed>0 || wanted>0 ) {
out.write(getMessage("hintString"));
}
out.write(getMessage("noteString"));
%>
</UL>
<h2><%= getMessage("apsExamining") %></h2>
<UL>
<%
String servletVersion=getServletVersion();
String xmlParser=getParserName();
String xmlParserLocation = getParserLocation(out);
%>
<table border="1" cellpadding="10">
<tr><td>Servlet version</td><td><%= servletVersion %></td></tr>
<tr><td>XML Parser</td><td><%= xmlParser %></td></tr>
<tr><td>XML ParserLocation</td><td><%= xmlParserLocation %></td></tr>
</table>
</UL>
<% if(xmlParser.indexOf("crimson")>=0) { %>
<p>
<%= getMessage("recommendedParser") %>
</p>
<% } %>
<h2><%= getMessage("sysExamining") %></h2>
<UL>
<%
/**
* Dump the system properties
*/
java.util.Enumeration e=null;
try {
e= System.getProperties().propertyNames();
} catch (SecurityException se) {
}
if(e!=null) {
out.write("<pre>");
for (;e.hasMoreElements();) {
String key = (String) e.nextElement();
out.write(key + "=" + System.getProperty(key)+"\n");
}
out.write("</pre><p>");
} else {
out.write(getMessage("sysPropError"));
}
%>
</UL>
<hr>
<%= getMessage("apsPlatform") %>:
<%= getServletConfig().getServletContext().getServerInfo() %>
</body>
</html>

View file

@ -0,0 +1,223 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="java.util.*" %>
<%
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
%>
<%!
/*
* A library file to produce i18n web applications. This can be easily
* reused from your jsp(s) - just include and call any methods.
* @author toshi
*/
// private variable
HttpServletRequest _req = null;
// private variable
String _strResourceName = null;
/**
* Set a HttpServletRequest to a private variable.
* @param request HttpServletRequest
*/
void setRequest(HttpServletRequest request) {
_req = request;
}
/**
* Get the private variable of the HttpServletRequest.
* @return HttpServletRequest
*/
HttpServletRequest getRequest() {
return _req;
}
/**
* Set a resouce base name to a private variable.
* @param resouce The resouce base name
*/
void setResouceBase(String resource) {
_strResourceName = resource;
}
/**
* Get the private variable of the resouce base name.
* @return resouce The resouce base name
*/
String getResouceBase() {
return _strResourceName;
}
/**
* Get a ResourceBundle object.
* @return a ResourceBundle object
*/
ResourceBundle getRB() {
String strLocale = getRequest().getParameter("locale");
ResourceBundle objRb = null;
Locale objLcl = null;
if (strLocale!=null) {
objLcl=new Locale(strLocale,"");
} else {
objLcl=getRequest().getLocale();
}
Locale.setDefault(objLcl);
objRb = ResourceBundle.getBundle(getResouceBase(),objLcl);
return objRb;
}
/**
* Get a list of locale choice
* @return a list of supported locales
*/
String getLocaleChoice() {
String choice = getMessage("locales");
StringBuffer buf = new StringBuffer();
buf.append("<div align=\"right\">\n");
buf.append(getMessage("language"));
buf.append(": ");
StringTokenizer st = new StringTokenizer(choice);
String locale = null;
while (st.hasMoreTokens()) {
locale = st.nextToken();
buf.append("[<a href=\"?locale="+ locale +"\">"+ locale +"</a>] ");
}
buf.append("\n</div>\n");
return buf.toString();
}
/**
* Get a message from i18n.properties with several arguments.
* @param key The resource key
* @return The formatted message
*/
String getMessage(String key) {
return getMessage(key, null, null, null, null, null);
}
/**
* Get a message from i18n.properties with several arguments.
* @param key The resource key
* @param arg0 The argument to place in variable {0}
* @return The formatted message
*/
String getMessage(String key, String arg0) {
return getMessage(key, arg0, null, null, null, null);
}
/**
* Get a message from i18n.properties with several arguments.
* @param key The resource key
* @param arg0 The argument to place in variable {0}
* @param arg1 The argument to place in variable {1}
* @return The formatted message
*/
String getMessage(String key, String arg0, String arg1) {
return getMessage(key, arg0, arg1, null, null, null);
}
/**
* Get a message from i18n.properties with several arguments.
* @param key The resource key
* @param arg0 The argument to place in variable {0}
* @param arg1 The argument to place in variable {1}
* @param arg2 The argument to place in variable {2}
* @return The formatted message
*/
String getMessage(String key, String arg0, String arg1, String arg2) {
return getMessage(key, arg0, arg1, arg2, null, null);
}
/**
* Get a message from i18n.properties with several arguments.
* @param key The resource key
* @param arg0 The argument to place in variable {0}
* @param arg1 The argument to place in variable {1}
* @param arg2 The argument to place in variable {2}
* @param arg3 The argument to place in variable {3}
* @return The formatted message
*/
String getMessage(String key, String arg0, String arg1,
String arg2, String arg3) {
return getMessage(key, arg0, arg1, arg2, arg3, null);
}
/**
* Get a message from i18n.properties with several arguments.
* @param key The resource key
* @param arg0 The argument to place in variable {0}
* @param arg1 The argument to place in variable {1}
* @param arg2 The argument to place in variable {2}
* @param arg3 The argument to place in variable {3}
* @param arg4 The argument to place in variable {4}
* @return The formatted message
*/
String getMessage(String key, String arg0, String arg1,
String arg2, String arg3, String arg4) {
String strPattern = getRB().getString(key);
String [] params = { arg0, arg1, arg2, arg3, arg4 };
for (int i=0; i<5; i++) {
if (params[i]!=null) params[i]=replaceAll(params[i],"%20"," ");
}
if (arg0!=null) strPattern = replaceAll(strPattern,"{0}",params[0]);
if (arg1!=null) strPattern = replaceAll(strPattern,"{1}",params[1]);
if (arg2!=null) strPattern = replaceAll(strPattern,"{2}",params[2]);
if (arg3!=null) strPattern = replaceAll(strPattern,"{3}",params[3]);
if (arg4!=null) strPattern = replaceAll(strPattern,"{4}",params[4]);
return strPattern;
}
/**
* Get a replaced string by the specified message.
* @param source The original message
* @param pattern The key message for replacing
* @param replace The message to place in the key variable - 'pattern'
* @return The replaced message
*/
String replaceAll(String source, String pattern, String replace)
{
int i=0;
boolean ret = false;
StringBuffer buf = new StringBuffer();
int lenSource = source.length();
int lenPattern = pattern.length();
for (i=0; i<lenSource; i++) {
ret = source.regionMatches(i, pattern, 0, lenPattern);
if (ret) {
buf.append(source.substring(0,i));
buf.append(replace);
buf.append(source.substring(i+lenPattern));
source = replaceAll(buf.toString(), pattern, replace);
break;
}
}
return source;
}
%>

View file

@ -0,0 +1,86 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%
if(session == null || !LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {
%><c:redirect url="<%= Controllers.LOGIN %>" /><%
}
String conceptIdStr = request.getParameter("conceptId");
if (conceptIdStr != null) {
String describeQueryStr =
"PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n\n" +
"DESCRIBE ?bnode \n" +
"WHERE { \n" +
" FILTER(afn:bnode(?bnode) = \"" + conceptIdStr + "\")\n" +
"}";
OntModel ontModel = (OntModel) getServletContext().getAttribute("baseOntModel");
Model conceptDescription = ModelFactory.createDefaultModel();
try {
ontModel.enterCriticalSection(Lock.READ);
Query describeQuery = QueryFactory.create(describeQueryStr, Syntax.syntaxARQ);
QueryExecution qe = QueryExecutionFactory.create(describeQuery, ontModel);
qe.execDescribe(conceptDescription);
conceptDescription.add(ontModel.listStatements((Resource) null, (Property) null, ontModel.createResource(new AnonId(conceptIdStr))));
} finally {
ontModel.leaveCriticalSection();
}
List<String> actionStrList = (request.getParameterValues("action") != null)
? Arrays.asList(request.getParameterValues("action"))
: new ArrayList<String>();
if (actionStrList.contains("remove")) {
try {
ontModel.enterCriticalSection(Lock.WRITE);
ontModel.remove(conceptDescription);
} finally {
ontModel.leaveCriticalSection();
}
}
if (actionStrList.contains("describe")) {
conceptDescription.write(response.getOutputStream(), "TTL");
return;
}
}
%>
<%@page import="com.hp.hpl.jena.ontology.OntModel"%>
<%@page import="com.hp.hpl.jena.shared.Lock"%>
<%@page import="com.hp.hpl.jena.query.Syntax"%>
<%@page import="com.hp.hpl.jena.query.Query"%>
<%@page import="com.hp.hpl.jena.query.QueryFactory"%>
<%@page import="com.hp.hpl.jena.query.QueryExecutionFactory"%>
<%@page import="com.hp.hpl.jena.rdf.model.ModelFactory"%>
<%@page import="com.hp.hpl.jena.rdf.model.Model"%>
<%@page import="com.hp.hpl.jena.query.QueryExecution"%>
<%@page import="java.util.Arrays"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.hp.hpl.jena.rdf.model.Resource"%>
<%@page import="com.hp.hpl.jena.rdf.model.Property"%>
<%@page import="com.hp.hpl.jena.rdf.model.AnonId"%><html>
<head>
<title>Anonymous Concept Repair Tools</title>
</head>
<body>
<h1>Concept Repair</h1>
<form action="" method="post">
<p>Concept bnode id: <input name="conceptId"/></p>
<p><input type="checkbox" name="action" value="describe"/> describe concept</p>
<p><input type="checkbox" name="action" value="remove"/> remove concept</p>
<p><input type="submit" value="Perform action"/></p>
</form>
</body></html>

View file

@ -0,0 +1,62 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.FakeSelfEditingIdentifierFactory" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%
if(session == null || !LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {
%><c:redirect url="<%= Controllers.LOGIN %>" /><%
}
if( request.getParameter("force") != null ){
VitroRequestPrep.forceToSelfEditing(request);
String netid = request.getParameter("netid");
FakeSelfEditingIdentifierFactory.clearFakeIdInSession( session );
FakeSelfEditingIdentifierFactory.putFakeIdInSession( netid , session );%>
<c:redirect url="/entity">
<c:param name="netid" value="<%=netid%>" />
</c:redirect>
<% }
if( request.getParameter("stopfaking") != null){
VitroRequestPrep.forceOutOfSelfEditing(request);
FakeSelfEditingIdentifierFactory.clearFakeIdInSession( session );
}
String netid = (String)session.getAttribute(FakeSelfEditingIdentifierFactory.FAKE_SELF_EDIT_NETID);
String msg = "You have not configured a netid for testing self-editing. ";
if( netid != null ) {
msg = "You have are testing self-editing as '" + netid + "'.";%>
<c:redirect url="/entity">
<c:param name="netid" value="<%=netid%>"/>
</c:redirect>
<% } else {
netid = "";
}
%>
<html>
<title>Test Self-Edit</title>
<body>
<h2>Configure Self-Edit Testing</h2>
<p><%=msg %></p>
<form action="<c:url value="fakeselfedit.jsp"/>" >
<input type="text" name="netid" value="<%= netid %>"/>
<input type="hidden" name="force" value="1"/>
<input type="submit" value="use a netid for testing"/>
</form>
<p/>
<form action="<c:url value="fakeselfedit.jsp"/>" >
<input type="hidden" name="stopfaking" value="1"/>
<input type="submit" value="stop usng netid for testing"/>
</form>
</body>
</html>

View file

@ -0,0 +1,46 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@page import="edu.cornell.mannlib.vedit.beans.LoginFormBean"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%
if (session == null || !LoginFormBean.loggedIn(request, LoginFormBean.DBA)) {
%><c:redirect url="<%= Controllers.LOGIN %>" /><%
}
if( request.getParameter("uri") != null ){
%> <c:redirect url="/entity"><c:param name="uri" value="${param.uri}"/></c:redirect> <%
return;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <!-- gotoIndividual.jsp -->
<link rel="stylesheet" type="text/css" href="<c:url value="/${themeDir}css/screen.css"/>" media="screen"/>
<link rel="stylesheet" type="text/css" href="<c:url value="/${themeDir}css/formedit.css" />" media="screen"/>
<title>Enter a URI</title>
</head>
<body class="formsEdit">
<div id="wrap">
<% /* BJL23 put this is in a catch block because it seems to fail ungracefully for
some clones */ %>
<c:catch>
<jsp:include page="/${themeDir}jsp/identity.jsp" flush="true"/>
<div id="contentwrap">
<jsp:include page="/${themeDir}jsp/menu.jsp" flush="true"/>
<!-- end of formPrefix.jsp -->
</c:catch>
<form>
<input name="uri" type="text" size="200" />
<input type="submit" value="Lookup Individual for URI"/>
</form>

View file

@ -0,0 +1,27 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<html>
<head>
<title>Jena Admin Actions</title>
</head>
<body>
<h1>Jena Admin Actions</h1>
<p>(Right click and Save Target As with the following links)</p>
<ul>
<li>
<a href="../jenaAdmin?action=output">output entire in-memory model</a>
</li>
<li>
<a href="../jenaAdmin?action=output&amp;assertionsOnly=true">output in-memory assertions</a>
</li>
<li>
<a href="../jenaAdmin?action=output&amp;inferences=true">output in-memory inferences</a>
</li>
<li>
<a href="../jenaAdmin?action=output&amp;pellet=pellet">output Pellet model</a>
<li>
<a href="../jenaAdmin?action=outputTaxonomy">output taxonomy</a>
</li>
<ul>
</body>
</html>

161
webapp/web/admin/log4j.jsp Normal file
View file

@ -0,0 +1,161 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="org.apache.log4j.*" %>
<%@ page import="java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%--
This JSP will display all the log4j Logger objects, their
levels and their appenders. The levels of the Logger objects
can be changed and test messages can be sent.
Brian Cauros bdc34@cornell.edu
based on work by Volker Mentzner. --%>
<%
if (session == null || !LoginFormBean.loggedIn(request, LoginFormBean.DBA)) {
%><c:redirect url="<%= Controllers.LOGIN %>" /><%
}
try {
String name;
Level[] levels = new Level[]
{Level.OFF, Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG};
out.write("<HTML><HEAD><TITLE>log4j configuration</TITLE></HEAD>\r\n");
out.write("<BODY><H1>log4j</H1>\r\n");
// handle a request with query
if( request.getParameterMap().size() > 0){
if( request.getParameter("doTestMsg") != null){
//handle test message
Logger logger = LogManager.getLogger( request.getParameter("logger") );
Level level = (Level)Level.toLevel( request.getParameter("level"));
logger.log(level, request.getParameter("msg"));
out.write("<h3>message sent</h3>");
} else {
//handle logging level changes
Enumeration names = request.getParameterNames();
while(names.hasMoreElements()){
String catname = (String)names.nextElement();
String catval = request.getParameter(catname);
if( "root".equalsIgnoreCase(catname))
LogManager.getRootLogger().setLevel((Level)Level.toLevel(catval));
else
LogManager.getLogger(catname).setLevel((Level)Level.toLevel(catval));
}
}
}
out.write("<p>" + notes + "</p>");
// output category information in a form with a simple table
out.write("<form name=\"Formular\" ACTION=\""+request.getContextPath()+request.getServletPath()+"\" METHOD=\"POST\">");
out.write("<table cellpadding=4>\r\n");
out.write(" <tr>\r\n");
out.write(" <td><b>Logger</b></td>\r\n");
out.write(" <td><b>Level</b></td>\r\n");
out.write(" <td><b>Appender</b></td>\r\n");
out.write(" </tr>\r\n");
// output for all Loggers
List<String> logNames = new LinkedList<String>();
for(Enumeration en = LogManager.getCurrentLoggers(); en.hasMoreElements() ;){
logNames.add(((Logger)en.nextElement()).getName());
}
Collections.sort(logNames);
logNames.add(0,"root");
Logger cat;
for (String logName : logNames) {
if( "root".equalsIgnoreCase(logName))
cat = LogManager.getRootLogger();
else
cat = LogManager.getLogger(logName);
out.write(" <tr>\r\n");
out.write(" <td>" + cat.getName() + "</td>\r\n");
out.write(" <td>\r\n");
out.write(" <select size=1 name=\""+ cat.getName() +"\">");
for (int i = 0; i < levels.length; i++) {
if (cat.getEffectiveLevel().toString().equals(levels[i].toString()))
out.write("<option selected>"+levels[i].toString());
else
out.write("<option>"+levels[i].toString());
}
out.write("</select>\r\n");
out.write(" </td>\r\n");
out.write(" <td>\r\n");
for( Appender apd : getAllAppenders( cat )){
name = apd.getName();
if (name == null)
name = "<i>(no name)</i>";
out.write(name);
if (apd instanceof AppenderSkeleton) {
try {
AppenderSkeleton apskel = (AppenderSkeleton)apd;
out.write(" [" + apskel.getThreshold().toString() + "]");
} catch (Exception ex) {
}
}
out.write(" ");
}
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
}
out.write("</table>\r\n");
out.write("<input type=submit value=\"Submit changes to logging levels\">");
out.write("</form>\n");
/* write out form to do a test message */
out.write("<h2>Test the logging configuration by sending a test message</h2>\n");
out.write("<form name=\"TestForm\" ACTION=\""+request.getContextPath()+request.getServletPath()+"\" METHOD=\"PUT\">\n");
out.write("<input type=\"hidden\" name=\"doTestMsg\" value=\"true\">\n");
out.write("<table>\n\r");
out.write(" <tr><td>logger:</td>\n\r");
out.write(" <td><select name=\"logger\"/>\n\r");
for(String logName : logNames){
out.write(" <option>" + logName + "</option>\n\r");
}
out.write(" </select></td></tr>\n\r");
out.write(" <tr><td>level:</td>\n\r");
out.write(" <td><select name=\"level\">\n\r");
for (int i = 0; i < levels.length; i++) {
out.write(" <option>"+levels[i].toString() + "</option>\n\r");
}
out.write(" </select></td></tr>\n\r");
out.write(" <tr><td>message:</td> \n\r");
out.write(" <td><textarea name=\"msg\"></textarea></td></tr>\n\r");
out.write(" <tr><td><input type=\"submit\" value=\"submit test message\"/></td></tr>\n\r");
out.write("</table></form>\n");
out.write("</BODY></HTML>\r\n");
out.flush();
} catch (Exception ex) {
throw new Error( ex);
}
%>
<%!
String notes ="<p>Changing the level of a Logger on this form does not change the levels of that Logger's children."+
"<p>Example: if you change the level of the Logger edu.cornell.mannlib.utils from ERROR to DEBUG, the " +
"logging level of edu.cornell.mannlib.utils.StringUtils will not be modified." +
"<p>Loggers will write message to all of their Appenders; you cannot have a DEBUG level For Logger A, Appender A "+
" and a WARN level for a Logger A, Appender B.";
%>
<%!
private Collection<Appender> getAllAppenders(Category logger){
HashSet<Appender> appenders = new HashSet<Appender>();
Enumeration en = logger.getAllAppenders();
while( en.hasMoreElements()){
appenders.add((Appender) en.nextElement());
}
if( logger.getParent() != null )
appenders.addAll( getAllAppenders(logger.getParent()));
return appenders;
}
%>

View file

@ -0,0 +1,120 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%
if(session == null || !LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {
%><c:redirect url="/siteAdmin"></c:redirect><%
}
if (request.getParameter("execute") != null) {
OntModel ontModel = (OntModel) getServletContext().getAttribute(JenaBaseDao.ASSERTIONS_ONT_MODEL_ATTRIBUTE_NAME);
int results = doRemoval(ontModel);
request.setAttribute("removalCount", results);
}
%>
<%!
private int doRemoval(OntModel ontModel) {
int removedStmts = 0;
List<String> bnodeIds = new ArrayList<String>();
ontModel.enterCriticalSection(Lock.READ);
try {
Iterator<Restriction> restIt = ontModel.listRestrictions();
while(restIt.hasNext()) {
Restriction rest = restIt.next();
if (rest.isAnon()) {
boolean bad = false;
bad |= (rest.getPropertyValue(OWL.onProperty) == null);
bad |= ( !(
(rest.getPropertyValue(OWL.someValuesFrom) != null) ||
(rest.getPropertyValue(OWL.allValuesFrom) != null) ||
(rest.getPropertyValue(OWL.hasValue) != null) ||
(rest.getPropertyValue(OWL.cardinality) != null) ||
(rest.getPropertyValue(OWL.minCardinality) != null) ||
(rest.getPropertyValue(OWL.maxCardinality) != null)
)
);
if (bad) {
bnodeIds.add(rest.getId().toString());
}
}
}
} finally {
ontModel.leaveCriticalSection();
}
for (String id : bnodeIds) {
Model toRemove = describeBnode(id);
ontModel.enterCriticalSection(Lock.WRITE);
try {
ontModel.remove(toRemove);
} finally {
ontModel.leaveCriticalSection();
}
removedStmts += toRemove.size();
}
return removedStmts;
}
private Model describeBnode(String bnodeId) {
String describeQueryStr =
"PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n\n" +
"DESCRIBE ?bnode \n" +
"WHERE { \n" +
" FILTER(afn:bnode(?bnode) = \"" + bnodeId + "\")\n" +
"}";
OntModel ontModel = (OntModel) getServletContext().getAttribute("baseOntModel");
Model conceptDescription = ModelFactory.createDefaultModel();
try {
ontModel.enterCriticalSection(Lock.READ);
Query describeQuery = QueryFactory.create(describeQueryStr, Syntax.syntaxARQ);
QueryExecution qe = QueryExecutionFactory.create(describeQuery, ontModel);
qe.execDescribe(conceptDescription);
conceptDescription.add(ontModel.listStatements((Resource) null, (Property) null, ontModel.createResource(new AnonId(bnodeId))));
return conceptDescription;
} finally {
ontModel.leaveCriticalSection();
}
}
%>
<%@page import="com.hp.hpl.jena.ontology.OntModel"%>
<%@page import="com.hp.hpl.jena.shared.Lock"%>
<%@page import="com.hp.hpl.jena.query.Syntax"%>
<%@page import="com.hp.hpl.jena.query.Query"%>
<%@page import="com.hp.hpl.jena.query.QueryFactory"%>
<%@page import="com.hp.hpl.jena.query.QueryExecutionFactory"%>
<%@page import="com.hp.hpl.jena.rdf.model.ModelFactory"%>
<%@page import="com.hp.hpl.jena.rdf.model.Model"%>
<%@page import="com.hp.hpl.jena.query.QueryExecution"%>
<%@page import="java.util.Arrays"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.hp.hpl.jena.rdf.model.Resource"%>
<%@page import="com.hp.hpl.jena.rdf.model.Property"%>
<%@page import="com.hp.hpl.jena.rdf.model.AnonId"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao"%>
<%@page import="java.util.Iterator"%>
<%@page import="com.hp.hpl.jena.ontology.Restriction"%>
<%@page import="com.hp.hpl.jena.vocabulary.OWL"%><html>
<head>
<title>Remove Bad Restrictions</title>
</head>
<body>
<c:if test="${!empty requestScope.removalCount}">
<p>${removalCount} statements removed</p>
</c:if>
<h1>Remove Bad Restrictions</h1>
<form action="" method="post">
<p><input name="execute" type="submit" value="Remove now"/></p>
</form>
</body></html>

View file

@ -0,0 +1,83 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%
if(session == null || !LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {
%><c:redirect url="<%= Controllers.LOGIN %>" /><%
}
String resourceURIStr = request.getParameter("resourceURI");
if (resourceURIStr != null) {
String describeQueryStr =
"DESCRIBE <" + resourceURIStr + ">";
OntModel ontModel = (OntModel) getServletContext().getAttribute("baseOntModel");
Model resourceDescription = ModelFactory.createDefaultModel();
try {
ontModel.enterCriticalSection(Lock.READ);
Query describeQuery = QueryFactory.create(describeQueryStr, Syntax.syntaxARQ);
QueryExecution qe = QueryExecutionFactory.create(describeQuery, ontModel);
qe.execDescribe(resourceDescription);
resourceDescription.add(ontModel.listStatements((Resource) null, (Property) null, ontModel.getResource(resourceURIStr)));
} finally {
ontModel.leaveCriticalSection();
}
List<String> actionStrList = (request.getParameterValues("action") != null)
? Arrays.asList(request.getParameterValues("action"))
: new ArrayList<String>();
if (actionStrList.contains("remove")) {
try {
ontModel.enterCriticalSection(Lock.WRITE);
ontModel.remove(resourceDescription);
} finally {
ontModel.leaveCriticalSection();
}
}
if (actionStrList.contains("describe")) {
resourceDescription.write(response.getOutputStream(), "TTL");
return;
}
}
%>
<%@page import="com.hp.hpl.jena.ontology.OntModel"%>
<%@page import="com.hp.hpl.jena.shared.Lock"%>
<%@page import="com.hp.hpl.jena.query.Syntax"%>
<%@page import="com.hp.hpl.jena.query.Query"%>
<%@page import="com.hp.hpl.jena.query.QueryFactory"%>
<%@page import="com.hp.hpl.jena.query.QueryExecutionFactory"%>
<%@page import="com.hp.hpl.jena.rdf.model.ModelFactory"%>
<%@page import="com.hp.hpl.jena.rdf.model.Model"%>
<%@page import="com.hp.hpl.jena.query.QueryExecution"%>
<%@page import="java.util.Arrays"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.hp.hpl.jena.rdf.model.Resource"%>
<%@page import="com.hp.hpl.jena.rdf.model.Property"%>
<%@page import="com.hp.hpl.jena.rdf.model.AnonId"%><html>
<head>
<title>Anonymous Concept Repair Tools</title>
</head>
<body>
<h1>Remove resource using DESCRIBE</h1>
<form action="" method="post">
<p>Resource URI: <input name="resourceURI"/></p>
<p><input type="checkbox" name="action" value="describe"/> describe resource</p>
<p><input type="checkbox" name="action" value="remove"/> remove resource</p>
<p><input type="submit" value="Perform action"/></p>
</form>
</body></html>

View file

@ -0,0 +1,25 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@page
import="edu.cornell.mannlib.vitro.webapp.auth.identifier.ServletIdentifierBundleFactory"%>
<%@page
import="java.util.List"%>
<%
List idb = ServletIdentifierBundleFactory.getIdBundleForRequest(request, session, application);
out.write("<html><body>");
out.write("<h2>Identifiers in effect: </h2>");
out.write("<p>This is a utility that shows which identifiers are in effect.</p>\n");
out.write("<table><tr><th>class</th><th>value</th></tr>\n");
for( Object id : idb ){
out.write( "<tr>" );
out.write( "<td>" + id.getClass().getName() + "</td>");
out.write( "<td>" + id.toString() + "</td>" );
out.write( "</tr>\n" );
}
out.write("</table>\n");
out.write("</body></html>");
%>

View file

@ -0,0 +1,95 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@page import="com.hp.hpl.jena.rdf.model.ModelMaker"%>
<%@page import="java.util.Iterator"%>
<body>
<div id="content" class="sparqlform">
<h1>SPARQL Query</h1>
<form action='sparqlquery'>
query:
<div>
<textarea name='query' rows ='23' cols='100' class="span-23">
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX swrl: <http://www.w3.org/2003/11/swrl#>
PREFIX swrlb: <http://www.w3.org/2003/11/swrlb#>
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
PREFIX vivo: <http://vivo.library.cornell.edu/ns/0.1#>
#
# This example query gets the label, research focus, and netID
# for 20 Cornell employees.
#
SELECT ?person ?personLabel ?focus ?netid
WHERE
{
?person vivo:CornellemailnetId ?netid .
?person rdf:type vivo:CornellEmployee .
?person vivo:researchFocus ?focus.
OPTIONAL { ?person rdfs:label ?personLabel }
}
limit 20
</textarea>
</div>
<p>
<h4>Format for SELECT query results:</h4>
<input id='RS_XML_BUTTON' type='radio' name='resultFormat' value='RS_XML'> <label for='RS_XML_BUTTON'>RS_XML</label>
<input id='RS_TEXT_BUTTON' type='radio' name='resultFormat' value='RS_TEXT' checked='checked'> <label for='RS_TEXT_BUTTON'>RS_TEXT</label>
<input id='RS_CSV_BUTTON' type='radio' name='resultFormat' value='vitro:csv'> <label for='RS_CSV_BUTTON'>CSV</label>
<input id='RS_RDF_N3_BUTTON' type='radio' name='resultFormat' value='RS_RDF/N3'> <label for='RS_RDF_N3_BUTTON'>RS_RDF/N3</label>
<input id='RS_JSON_BUTTON' type='radio' name='resultFormat' value='RS_JSON'> <label for='RS_JSON_BUTTON'>RS_JSON</label>
<input id='RS_RDF_BUTTON' type='radio' name='resultFormat' value='RS_RDF'> <label for='RS_RDF_BUTTON'>RS_RDF</label>
</p>
<p>
<h4>Format for CONSTRUCT and DESCRIBE query results:</h4>
<input id='RR_RDFXML_BUTTON' type='radio' name='rdfResultFormat' value='RDF/XML'> <label for='RR_RDFXML_BUTTON'>RDF/XML</label>
<input id='RR_RDFXMLABBREV_BUTTON' type='radio' name='rdfResultFormat' value='RDF/XML-ABBREV' checked='checked'> <label for='RR_RDFXMLABBREV_BUTTON'>RDF/XML-ABBREV</label>
<input id='RR_N3_BUTTON' type='radio' name='rdfResultFormat' value='N3'> <label for='RR_N3_BUTTON'>N3</label>
<input id='RR_NTRIPLE_BUTTON' type='radio' name='rdfResultFormat' value='N-TRIPLE'> <label for='RR_NTRIPLE_BUTTON'>N-Triples</label>
<input id='RR_TURTLE_BUTTON' type='radio' name='rdfResultFormat' value='TTL'> <label for='RR_TURTLE_BUTTON'>Turtle</label>
</p>
<div>
<ul class="clean">
<%
try{
if( request.getSession() != null && application.getAttribute("vitroJenaModelMaker") != null ){
ModelMaker maker = (ModelMaker) application.getAttribute("vitroJenaModelMaker");
for (Iterator it = maker.listModels(); it.hasNext(); ) {
String modelName = (String) it.next();
%> <li> <input type="checkbox" name="sourceModelName" value="<%=modelName%>"/><%=modelName%></li>
<%
}
}else{
%><li>could not find named models in session</li><%
}
}catch(Exception ex){
%><li>could not find named models in ModelMaker</li><%
}
%>
</ul>
</div>
<input type="submit" value="Run Query">
</form>
<%--
<h4>Notes</h4>
<p>CONSTRUCT and DESCRIBE queries always return RDF XML</p>
<p>The parameter 'resultFormat' must not be null or zero length</p>
<p>The parameter 'resultFormat' must be one of the following: <ul>
<li>RS_XML</li>
<li>RS_TEXT</li>
<li>RS_RDF/N3</li>
<li>RS_JSON</li>
<li>RS_RDF</li>
</ul>
</p>
--%>
</div><!-- content -->
</body></html>

View file

@ -0,0 +1,104 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@page import="edu.cornell.mannlib.vitro.webapp.utils.jena.SesameSyncUtils"%>
<%@page import="com.hp.hpl.jena.rdf.model.ModelFactory"%>
<%@page import="com.hp.hpl.jena.shared.Lock"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.JenaModelUtils"%>
<%@page import="com.hp.hpl.jena.rdf.model.Model"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao"%>
<%@page import="java.io.InputStream"%>
<%@page import="java.util.Properties"%>
<%@page import="edu.cornell.mannlib.vedit.beans.LoginFormBean"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%!
final String SESAME_PROPS_PATH = "/WEB-INF/classes/sesame.sync.properties" ;
final String SESAME_SERVER = "vitro.sesame.server" ;
final String SESAME_REPOSITORY = "vitro.sesame.repository" ;
final String SESAME_CONTEXT = "vitro.sesame.context" ;
final String USER_SPARQL_QUERY =
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" +
"PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n\n" +
"DESCRIBE ?user WHERE { \n " +
" ?user rdf:type vitro:User \n" +
"}";
%>
<%
if(session == null || !LoginFormBean.loggedIn(request, LoginFormBean.DBA)) {
%>
<c:redirect url="<%= Controllers.LOGIN %>" />
<%
}
long startTime = System.currentTimeMillis();
Properties sesameProperties = new Properties();
InputStream propStream = getServletContext().getResourceAsStream(SESAME_PROPS_PATH);
if (propStream == null) {
response.setStatus(500, "Sesame properties not found at " + SESAME_PROPS_PATH);
return;
}
sesameProperties.load(propStream);
String sesameLocation = sesameProperties.getProperty(SESAME_SERVER);
if (sesameLocation == null) {
response.setStatus(500, "Missing property " + SESAME_SERVER);
}
String sesameRepository = sesameProperties.getProperty(SESAME_REPOSITORY);
if (sesameRepository == null) {
response.setStatus(500, "Missing property " + SESAME_REPOSITORY);
}
String contextId = sesameProperties.getProperty(SESAME_CONTEXT);
Model fullModel = (Model) getServletContext().getAttribute(JenaBaseDao.JENA_ONT_MODEL_ATTRIBUTE_NAME);
// Copy the model to avoid locking the main model during sync. Assumes enough memory.
Model copyModel = ModelFactory.createDefaultModel();
fullModel.enterCriticalSection(Lock.READ);
try {
copyModel.add(fullModel);
} finally {
fullModel.leaveCriticalSection();
}
Model userDataToRetract = ModelFactory.createDefaultModel();
Query userDataQuery = QueryFactory.create(USER_SPARQL_QUERY);
QueryExecution qe = QueryExecutionFactory.create(userDataQuery, copyModel);
qe.execDescribe(userDataToRetract);
copyModel.remove(userDataToRetract);
System.out.println("Not sharing " + userDataToRetract.size() + " statements of user data");
System.out.println("Using Sesame server at " + sesameLocation);
System.out.println("Using Sesame repository at " + sesameRepository);
System.out.println("Using context " + contextId);
try {
(new SesameSyncUtils()).writeModelToSesameContext(copyModel, sesameLocation, sesameRepository, contextId);
} catch (Throwable t) {
t.printStackTrace();
throw new Error(t);
}
System.out.println((System.currentTimeMillis() - startTime) + " ms to sync");
%>
<%@page import="com.hp.hpl.jena.rdf.model.StmtIterator"%>
<%@page import="com.hp.hpl.jena.rdf.model.Statement"%>
<%@page import="com.hp.hpl.jena.query.Query"%>
<%@page import="com.hp.hpl.jena.query.QueryFactory"%>
<%@page import="com.hp.hpl.jena.query.QueryExecution"%>
<%@page import="com.hp.hpl.jena.query.QueryExecutionFactory"%><html>
<head>
<title>Sync successful</title>
</head>
</html>

View file

@ -0,0 +1,210 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="com.hp.hpl.jena.rdf.model.*" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.FakeSelfEditingIdentifierFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.auth.policy.setup.CuratorEditingPolicySetup" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<% if(session == null || !LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {
%><c:redirect url="<%= Controllers.LOGIN %>" /><%
}
if( request.getParameter("force") != null ){
VitroRequestPrep.forceToSelfEditing(request);
String netid = request.getParameter("netid");
// note that this affects the current user's session, not the whole servlet context
FakeSelfEditingIdentifierFactory.clearFakeIdInSession( session );
FakeSelfEditingIdentifierFactory.putFakeIdInSession( netid , session );
// don't want to do this because would affect the whole session
// if(LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {
// CuratorEditingPolicySetup.removeAllCuratorEditingPolicies(getServletConfig().getServletContext());
//} %>
<jsp:forward page="/edit/login.jsp"/>
<% }
String loggedOutNetId = (String)session.getAttribute(FakeSelfEditingIdentifierFactory.FAKE_SELF_EDIT_NETID);
if( request.getParameter("stopfaking") != null){
VitroRequestPrep.forceOutOfSelfEditing(request);
FakeSelfEditingIdentifierFactory.clearFakeIdInSession( session );
// don't want to do this because would affect the whole session
// if(LoginFormBean.loggedIn(request, LoginFormBean.CURATOR)) {
// CuratorEditingPolicySetup.replaceCuratorEditing(getServletConfig().getServletContext(),(Model)application.getAttribute("jenaOntModel"));
//}
%><c:redirect url="/"></c:redirect><%
}
String netid = (String)session.getAttribute(FakeSelfEditingIdentifierFactory.FAKE_SELF_EDIT_NETID);
String msg = "You have not configured a netid for testing self-editing. ";
if( netid != null )
msg = "You are testing self-editing as '" + netid + "'.";
else
netid = "";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>CUWebLogin</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="temporaryLoginFiles/main.css">
<link rel="stylesheet" type="text/css" href="temporaryLoginFiles/filter.css">
<link rel="stylesheet" type="text/css" href="temporaryLoginFiles/dialogs.css">
<script language="JavaScript">
<!--
function OpenCertDetails()
{
thewindow=window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=uscorn123-1',
'anew',config='height=400,width=450,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
}
// -->
</script>
</head><body onload="cuwl_focus_netid();">
<!-- header 1 -->
<div class="wrapper" id="header1wrap">
<div class="inner" id="header1">
<div id="logo">
<a href="http://www.cornell.edu/" title="Cornell University"><img src="temporaryLoginFiles/cu.gif" alt="Cornell University" border="0" height="23" width="211"></a>
</div>
</div>
</div>
<!-- end header 1 -->
<hr class="hidden">
<!-- header 2 -->
<div id="header2wrap">
<!-- these two divs are just for background color -->
<div id="header2left">&nbsp;</div>
<div id="header2right">&nbsp;</div>
<!-- end background divs -->
<div id="header2">
<div id="title"><a href="http://www.cit.cornell.edu/authent/new/cuwl/cuwl.html"><img src="temporaryLoginFiles/cuwl-title.png" alt="CUWebLogin" border="0" height="74" width="213"></a></div>
<div id="manage">
Cornell University Login
</div>
</div>
</div>
<!-- end header 2 -->
<!-- header 3 -->
<div class="wrapper" id="header3wrap">
<div class="inner" id="header3">
<span>
<a href="http://www.cit.cornell.edu/identity/cuweblogin.html">About
CUWebLogin</a>
</span>
</div>
</div>
<!-- end header 3 -->
<!-- ---------------------------- BEGIN main body -->
<div class="wrapper" id="main">
<div class="inner" id="content">
<hr class="hidden">
<form name="dialog" method="post" action="temporaryLogin.jsp">
<table>
<tbody><tr>
<td id="loginboxcell">
<table class="loginbox" id="webloginbox">
<tbody><tr id="toprow">
<td>
<img src="temporaryLoginFiles/logindogs.gif" alt="">
</td>
<td>
<img src="temporaryLoginFiles/KfWeb.gif" alt="Kerberos for Web"><br>
<em>
Please enter your Cornell NetID
</em>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
<table id="entrybox">
<tbody><tr>
<td>NetID:</td>
<td>
<input class="textinput" name="netid" type="text" value="" />
<input type="hidden" name="force" value="1"/>
</td>
</tr>
<tr>
<td><!-- Password: --></td>
<td>
<strong>For testing purposes only</strong>.
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td id="buttoncell">
<input class="inputsubmitHead" name="cancel" value="Cancel" onclick="cancel_submit();" type="button">
<input class="inputsubmitHead" name="ok" value="OK" type="submit">
</td>
</tr>
</tbody></table>
</td>
<td id="infocell">
<br>
<table id="reasonbox">
<tbody><tr><td>
<c:if test="${!empty param.stopfaking}">
You have successfully logged out from <%=loggedOutNetId%>.
<c:url var="profileHref" value="/entity">
<c:param name="netid" value="<%=loggedOutNetId%>" />
</c:url>
Return to that <a href="${profileHref}" title="view your public profile">public profile</a>.
</c:if>
</td></tr>
</tbody></table>
<br>
<!-- The Web site you are visiting requires you to authenticate with your NetID and Password -->
<br>
<!-- <a href="javascript:OpenCertDetails()">
<IMG SRC="/images/thawte-seal.gif" BORDER=0 ALT='Click here for SSL Cert Details'>
</a> -->
<!-- GeoTrust True Site [tm] Smart Icon tag. Do not edit. -->
<!-- <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="//smarticon.geotrust.com/si.js"></SCRIPT> -->
<!-- <img src="temporaryLoginFiles/quickssl_anim.gif" border="0"> -->
<!-- end GeoTrust Smart Icon tag -->
<br>
</td>
</tr>
</tbody></table>
</form>
<hr class="hidden">
</div>
</div>
<!-- ---------------------------- END main body -->
<!-- footer include in -->
<div class="wrapper" id="footer">
<div class="inner">
<em>Mann Library Notice:</em> <strong>This IS NOT an official CUWebLogin
screen. It is meant for testing purposes only</strong>.
</div>
</div>
<!-- footer include out -->
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -0,0 +1,84 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
img {
padding: 0;
margin: 0;
}
#chpassbox {
width:450px;
}
#guestloginbox {
width: 300px;
}
#webloginbox {
width: 325px;
}
td#infocell {
padding-left: 30px;
height: 100%;
vertical-align: middle;
}
td#loginboxcell {
vertical-align: middle;
}
td #loginboxtitle {
font-size: x-large;
line-height: 1.1em;
}
.loginbox {
border-collapse: collapse;
border: 1px solid #bbb;
}
.loginbox td {
background: #dfdfdf;
}
#toprow img {
margin-bottom: 5px;
}
#toprow td {
padding-top: 6px;
vertical-align: top;
text-align: center;
line-height: 1.3em;
}
#entrybox {
margin: 6px;
padding: 2px;
}
#entrybox td {
width: 100%;
text-align: right;
}
#entrybox input {
width: 240px;
}
#entrybox2 {
margin: 6px;
padding: 2px;
}
#entrybox2 td {
width: 100%;
text-align: right;
}
#entrybox2 input {
width: 45px;
height: 1.7em;
}
#buttoncell {
padding: 0 6px 6px 0;
width: 100%;
text-align: right;
}
#buttoncell input {
width: 5.5em;
}
#reasonbox{
background: #dfdfdf;
border-collapse: collapse;
border: 1px solid #bbb;
color: #AB1A2A;
}

View file

@ -0,0 +1,44 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
body {background: #fff;}
h2
{
margin: 0;
font-size: 14pt;
line-height: 20px;
padding: 12px 0 22px 0px;
font-weight: normal;
}
.confirm
{
margin: 0;
font-size: 14pt;
line-height: 20px;
padding: 12px 0 12px 0px;
font-weight: normal;
color: #AB1A2A;
}
td
{
font-family: verdana, arial, helvetica, geneva, sans-serif;
font-size: 11px;
line-height: 20px;
}
.rowBkgrd { background: #F4F4F4; } /* was #eee; */
.tableHeading
{
font-weight: bold;
white-space: nowrap;
}
.label
{
font-weight: bold;
text-align: right;
white-space: nowrap;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,437 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
/***********************
* General formatting
***********************/
.hidden { display: none;}
body {
margin: 0;
padding: 0;
font-family: verdana, arial, helvetica, geneva, sans-serif;
font-size: 11px;
color: #484848; /*666;*/
background: #fff;
}
.wrapper {
width: 100%;
text-align: center;
}
.inner {
width: 720px;
margin: 0 auto;
text-align: left;
}
/****************************************************************/
//#hm a, #hm a:link, #hm a:visited {
// color: #85A3C2;
// text-decoration: none;
// font-weight: bold;
//}
//#hm a:hover {
// color: #596C80;
// text-decoration: underline;
// font-weight: bold;
//}
//#hm a:active {
// color: #85A3C2;
//}
h2 {
margin: 0;
font-size: 14pt;
line-height: 20px;
padding: 20px 0px 20px 0px;
font-weight: normal;
}
#confirm {
margin: 0;
font-size: 14pt;
line-height: 20px;
padding: 12px 0px 12px 0px;
font-weight: normal;
color: black;
}
#confirmdata {
color: black;
font-size: 111%;
margin-left: 4em;
line-height: 1em;
padding: 0em;
}
#confirmdata td {
padding-left: 1em;
// font-size: 90%;
line-height: 120%;
}
#error {
margin: 0;
font-size: 111%;
line-height: 1.2em;
padding-bottom: 0.5em;
font-weight: normal;
color: #AB1A2A;
}
#errordata {
margin: 0em;
// font-size: 90%;
line-height: 1em;
padding-bottom: 2em;
font-weight: normal;
color: #AB1A2A;
}
td
{
font-family: verdana, arial, helvetica, geneva, sans-serif;
font-size: 11px;
line-height: 20px;
}
.rowBkgrd { background: #F4F4F4; } /* was #eee; */
.tableHeading {
font-weight: bold;
white-space: nowrap;
}
.label {
font-weight: bold;
text-align: right;
white-space: nowrap;
}
/****************************************************************/
/***********************
* Header layout
***********************/
/* HEADER 1 */
#header1wrap {
border-bottom: 4px solid #bbb; /*#DCE2E5;*/
height: 23px;
background: #AB1A2A;
}
#logo {
float: left;
width: 211px;
border-left: 1px solid #ddd;
border-right: 1px solid #ddd;
/* ie5 box model hack */
width: 213px;
voice-family: "\"}\"";
voice-family:inherit;
/* unhack */
width: 211px;
}
/* be nice to Opera */
html>#logo {
width: 211px;
}
#status {
float: left;
padding-left: 10px;
width: 497px;
height: 23px;
color: #ddd;
font-size: .9em;
line-height: 23px;
}
/* HEADER 2 */
#header2wrap {
position: relative;
}
#header2left {
position: absolute;
top: 0;
left: 0;
width: 50%;
background: #fff;
}
#header2right {
position: absolute;
top: 0;
left: 50%;
width: 50%;
margin-top: 36px;
padding: 10px 0;
height: 17px;
line-height: 17px;
background: #dfdfdf; /*#f4f4f4;*/
border-top: 1px solid #bbb; /*#ddd;*/
}
#header2 {
position: absolute;
top: 0;
left: 50%;
margin-left: -360px;
margin-right: 0;
width: 720px;
/* SSK IE 6 Hack */
* html{
width:700px;
}
background: #fff;
}
/*SSK be nice to Opera */
html>#manage { width: 487px; }
#title {
float: left;
width: 211px;
height: 74px;
border-left: 1px solid #ddd;
border-right: 1px solid #ddd;
}
#manage {
float: left;
margin-top: 36px;
border-top: 1px solid #bbb; /*#ddd;*/
padding: 10px;
width: 485px;
height: 17px;
background: #dfdfdf; /*#f4f4f4;*/
line-height: 17px;
/* ie5 box model hack */
width: 507px;
voice-family: "\"}\"";
voice-family:inherit;
/* unhack */
width: 485px;
}
/* be nice to Opera */
html>#manage { width: 487px; }
#manage a, #manage a:link, #manage a:visited {
color: #85A3C2;
text-decoration: none;
font-weight: bold;
}
#manage a:hover {
color: #596C80;
text-decoration: underline;
font-weight: bold;
}
#manage a:active {color: #85A3C2;}
/* HEADER 3 */
#header3wrap {
margin-top: 74px;
background: #dfdfdf; /*#f4f4f4;*/
border-top: 1px solid #bbb; /*#ddd;*/
border-bottom: 1px solid #bbb /*#ddd;*/
}
#header3 {
padding: 8px 0 8px 10px;
width: 750px;
/* ie5 box model hack */
width: 760px;
voice-family: "\"}\"";
voice-family:inherit;
/* unhack */
width: 750px;
}
/* be nice to Opera */
html>#header3 {
width: 750px;
}
/***********************
* Contents
***********************/
#content {
margin-top: 20px;
padding-left: 10px;
width: 750px;
/* ie5 box model hack */
width: 760px;
voice-family: "\"}\"";
voice-family:inherit;
/* unhack */
width: 760px;
}
/* be nice to Opera */
html>#content {
width: 750px;
}
#footer {
margin: 20px 0;
padding: 15px 0;
border-top: 1px solid #ddd;
}
#footer .inner {
padding-left: 10px;
width: 750px;
/* ie5 box model hack */
width: 760px;
voice-family: "\"}\"";
voice-family:inherit;
/* unhack */
width: 750px;
}
/* be nice to Opera */
html>#footer .inner {
width: 750px;
}
/***********************
* Text
***********************/
h1 {
margin-top: 12px;
margin-left: 10px;
margin-bottom: 0;
padding: 0;
font-size: 24px;
font-weight: normal;
color: #a0a0a0;
}
ul {
margin-top: 0px;
}
.sep {
font-size: 10px;
font-weight: bold;
line-height: 12px;
color: #ccc;
padding: 0 2px;
}
.headerlabel {
padding-right: 2px;
}
/* LINKS */
a, a:link, a:visited {
text-decoration: none;
font-weight: normal;
color: #85A3C2;
}
a:hover {
color: #596C80;
text-decoration: underline;
}
a:active {
color: #85A3C2;
}
/***********************
* Forms
***********************/
form {
margin: 0;
padding: 0;
}
form#existingguest {
display: inline;
}
.selectnull {
font-style: italic;
color: grey;
}
.textinput, .dropdown {
border: 1px solid #999;
color: #333;
background: #fff;
font-size: 11px;
}
#guestid {
width: 150px;
}
#guesttask {
margin: 0 5px;
width: 150px;
}
.inputsubmit
{
color: #666;
font-size: 12px;
background: #fc0;
font-weight: bold;
}
/* HEADER FORM */
#existingguest .textinput, #existingguest .dropdown {
background: #DFE7EB;
border: 1px solid #85A3C2;
height: 15px;
}
#existingguest a, #existingguest a:link, #existingguest a:visited {
color: #85A3C2;
text-decoration: none;
font-weight: bold;
}
#existingguest a:active {color: #85A3C2;}
#existingguest a:hover {
color: #596C80;
text-decoration: underline;
font-weight: bold;
}
.inputsubmitHead {
padding: 0 5px;
color: #666;
font-size: 11px;
background: #DFE7EB;
border: 1px solid #85A3C2;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -0,0 +1,84 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="com.hp.hpl.jena.rdf.model.*" %>
<%@ page import="com.hp.hpl.jena.ontology.OntModel" %>
<%@ page import="com.hp.hpl.jena.shared.Lock" %>
<%@ page import="com.thoughtworks.xstream.XStream" %>
<%@ page import="com.thoughtworks.xstream.io.xml.DomDriver" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.EditLiteral" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="java.io.StringReader" %>
<%@ page import="java.util.*" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.NetIdIdentifierFactory.NetId"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.NetIdIdentifierFactory"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingUriFactory.SelfEditing"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingUriFactory"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%>
<%@page import="java.io.IOException"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<http>
Testing getIndividualURIFromNetId()
<%
String[] netids = {"bdc34", "jc55", "bjl24" , "mhd6" , "tpb2" };
for( String netid : netids){
%><h2>Checking <%=netid %></h2><%
checkNetId( netid, out, request, (WebappDaoFactory)application.getAttribute("webappDaoFactory"));
}
%>
</http>
<%!
final String CUWEBAUTH_REMOTE_USER_HEADER = "REMOTE_USER";
private void checkNetId( String inNetId, JspWriter out, HttpServletRequest request, WebappDaoFactory wdf ) throws IOException{
if( inNetId != null
&& inNetId.length() > 0
&& inNetId.length() < 100 ){
NetIdIdentifierFactory.NetId netid = new NetId(inNetId);
SelfEditingUriFactory.SelfEditing selfE = null;
IdentifierBundle idb = new ArrayIdentifierBundle();
idb.add(netid);
//out.println("added NetId object to IdentifierBundle from CUWEBAUTH header");
//VitroRequest vreq = new VitroRequest((HttpServletRequest)request);
String uri = wdf.getIndividualDao().getIndividualURIFromNetId(inNetId);
if( uri != null){
Individual ind = wdf.getIndividualDao().getIndividualByURI(uri);
if( ind != null ){
selfE = new SelfEditing( ind, null );
idb.add( selfE );
out.println("found a URI and an Individual for " + inNetId + " URI: " + ind.getURI());
}else{
out.println("found a URI for the netid " + inNetId + " but could not build Individual");
}
}else{
out.println("could not find a Individual with the neditd of " + inNetId );
}
//putNetIdInSession(session, selfE, netid);
}else{
out.println("no remote user value found or value was longer than 100 chars.");
}
}
%>