You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/02/19 18:04:22 UTC
[19/51] [abbrv] libraries/ compiling
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.jsp
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.jsp b/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.jsp
new file mode 100644
index 0000000..433f503
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.jsp
@@ -0,0 +1,106 @@
+<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
+
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ --%>
+<%@ page import="org.apache.solr.core.SolrInfoMBean,
+ java.net.URL,
+ java.util.Date,
+ java.util.Map"%>
+<?xml-stylesheet type="text/xsl" href="registry.xsl"?>
+
+<%@include file="_info.jsp" %>
+
+<solr>
+ <core><%= core.getName()%></core>
+ <schema><%= collectionName %></schema>
+ <host><%= hostname %></host>
+ <now><%= new Date().toString() %></now>
+ <start><%= new Date(core.getStartTime()) %></start>
+ <solr-spec-version><%= solrSpecVersion %></solr-spec-version>
+ <solr-impl-version><%= solrImplVersion %></solr-impl-version>
+ <lucene-spec-version><%= luceneSpecVersion %></lucene-spec-version>
+ <lucene-impl-version><%= luceneImplVersion %></lucene-impl-version>
+ <solr-info>
+<%
+for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
+%>
+ <<%= cat.toString() %>>
+<%
+ Map<String, SolrInfoMBean> reg = core.getInfoRegistry();
+ synchronized(reg) {
+ for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
+ String key = entry.getKey();
+ SolrInfoMBean m = entry.getValue();
+
+ if (m.getCategory() != cat) continue;
+
+ String na = "None Provided";
+ String name = (m.getName()!=null ? m.getName() : na);
+ String vers = (m.getVersion()!=null ? m.getVersion() : na);
+ String desc = (m.getDescription()!=null ? m.getDescription() : na);
+ String srcId = (m.getSourceId()!=null ? m.getSourceId() : na);
+ String src = (m.getSource()!=null ? m.getSource() : na);
+ // print
+%>
+ <entry>
+ <name>
+ <%= key %>
+ </name>
+ <class>
+ <%= name %>
+ </class>
+ <version>
+ <%= vers %>
+ </version>
+ <description>
+ <%= desc %>
+ </description>
+ <sourceid>
+ <%= srcId %>
+ </sourceid>
+ <source>
+ <%= src %>
+ </source>
+
+<%
+ URL[] urls = m.getDocs();
+ if ((urls != null) && (urls.length != 0)) {
+%>
+ <urls>
+<%
+ for (URL u : urls) {
+%>
+ <url>
+ <%= u.toString() %>
+ </url>
+<%
+ }
+%>
+ </urls>
+<%
+ }
+%>
+ </entry>
+<%
+ }
+ }
+%>
+ </<%= cat.toString() %>>
+<%
+}
+%>
+ </solr-info>
+</solr>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.xsl
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.xsl b/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.xsl
new file mode 100644
index 0000000..c33fcac
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/registry.xsl
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ -->
+
+<!-- $Id: registry.xsl 1075192 2011-02-28 00:50:09Z uschindler $ -->
+<!-- $URL: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_3_1/solr/src/webapp/web/admin/registry.xsl $ -->
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+
+ <xsl:output
+ method="html"
+ encoding="utf-8"
+ media-type="text/html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
+
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>
+ <link rel="icon" href="favicon.ico" type="image/ico"></link>
+ <link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
+ <title>Solr Info</title>
+ </head>
+ <body>
+ <a href=".">
+ <img border="0" align="right" height="78" width="142" src="solr_small.png" alt="Apache Solr">
+ </img>
+ </a>
+ <h1>Solr Info (<xsl:value-of select="solr/schema" />)</h1>
+ <xsl:value-of select="solr/host" />
+ <br clear="all" />
+ <xsl:apply-templates/>
+ <br /><br />
+ <a href=".">Return to Admin Page</a>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="solr">
+ <table>
+ <tr>
+ <td>
+ <H3>Category</H3>
+ </td>
+ <td>
+ [<a href="#core">Core</a>]
+ [<a href="#cache">Cache</a>]
+ [<a href="#query">Query</a>]
+ [<a href="#update">Update</a>]
+ [<a href="#highlighting">Highlighting</a>]
+ [<a href="#other">Other</a>]
+ </td>
+ </tr>
+ <tr><td></td>
+ <td>Solr Specification Version:
+ <xsl:value-of select="solr-spec-version" />
+ </td>
+ </tr>
+ <tr><td></td>
+ <td>Solr Implementation Version:
+ <xsl:value-of select="solr-impl-version" />
+ </td>
+ </tr>
+ <tr><td></td>
+ <td>Lucene Specification Version:
+ <xsl:value-of select="lucene-spec-version" />
+ </td>
+ </tr>
+ <tr><td></td>
+ <td>Lucene Implementation Version:
+ <xsl:value-of select="lucene-impl-version" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ Current Time: <xsl:value-of select="now" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ Server Start Time:<xsl:value-of select="start" />
+ </td>
+ </tr>
+ </table>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="solr/*" priority="-1" />
+
+ <xsl:template match="solr/solr-info">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/CORE">
+ <br />
+ <a name="core"><h2>Core</h2></a>
+ <table>
+ <tr>
+ <td align="right">
+  
+ </td>
+ <td>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/CORE/entry">
+ <xsl:for-each select="*">
+ <tr>
+ <td align="right">
+ <strong><xsl:value-of select="name()"/>: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="."/> </tt>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <tr>
+ <td align="right">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/CACHE">
+ <br />
+ <a name="cache"><h2>Cache</h2></a>
+ <table>
+ <tr>
+ <td align="right">
+  
+ </td>
+ <td>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/CACHE/entry">
+ <xsl:for-each select="*">
+ <tr>
+ <td align="right">
+ <strong><xsl:value-of select="name()"/>: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="."/> </tt>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <tr>
+ <td align="right">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/QUERYHANDLER">
+ <br />
+ <a name="query"><h2>Query Handlers</h2></a>
+ <table>
+ <tr>
+ <td align="right">
+  
+ </td>
+ <td>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/QUERYHANDLER/entry">
+ <xsl:for-each select="*">
+ <tr>
+ <td align="right">
+ <strong><xsl:value-of select="name()"/>: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="."/> </tt>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <tr>
+ <td align="right">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/UPDATEHANDLER">
+ <br />
+ <a name="update"><h2>Update Handlers</h2></a>
+ <table>
+ <tr>
+ <td align="right">
+  
+ </td>
+ <td>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/UPDATEHANDLER/entry">
+ <xsl:for-each select="*">
+ <tr>
+ <td align="right">
+ <strong><xsl:value-of select="name()"/>: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="."/> </tt>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <tr>
+ <td align="right">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </xsl:template>
+ <xsl:template match="solr/solr-info/HIGHLIGHTING">
+ <br />
+ <a name="highlighting"><h2>Highlighting</h2></a>
+ <table>
+ <tr>
+ <td align="right">
+  
+ </td>
+ <td>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+ <xsl:template match="solr/solr-info/HIGHLIGHTING/entry">
+ <xsl:for-each select="*">
+ <tr>
+ <td align="right">
+ <strong><xsl:value-of select="name()"/>: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="."/> </tt>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <tr>
+ <td align="right">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="solr/solr-info/OTHER">
+ <br />
+ <a name="other"><h2>Other</h2></a>
+ <table>
+ <tr>
+ <td align="right">
+  
+ </td>
+ <td>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/OTHER/entry">
+ <xsl:for-each select="*">
+ <tr>
+ <td align="right">
+ <strong><xsl:value-of select="name()"/>: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="."/> </tt>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <tr>
+ <td align="right">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/header.jsp
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/header.jsp b/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/header.jsp
new file mode 100644
index 0000000..ad12fc9
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/header.jsp
@@ -0,0 +1,89 @@
+<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
+
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ --%>
+<!-- $Id: header.jsp 1031778 2010-11-05 20:29:20Z ryan $ -->
+<%@ page import="org.apache.solr.common.util.NamedList,
+ org.apache.solr.common.util.SimpleOrderedMap,
+ org.apache.solr.handler.ReplicationHandler,
+ org.apache.solr.request.LocalSolrQueryRequest,
+ org.apache.solr.request.SolrQueryResponse,
+ org.apache.solr.request.SolrRequestHandler"%>
+<%@ page import="java.util.Map" %>
+<%
+request.setCharacterEncoding("UTF-8");
+%>
+
+<html>
+<head>
+
+<%@include file="../_info.jsp" %>
+
+<script>
+var host_name="<%= hostname %>"
+</script>
+
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" type="text/css" href="../solr-admin.css">
+<link rel="icon" href="../favicon.ico" type="image/ico" />
+<link rel="shortcut icon" href="../favicon.ico" type="image/ico" />
+<title>Solr replication admin page</title>
+<script type="text/javascript" src="../jquery-1.4.3.min.js"></script>
+
+<%!
+public NamedList executeCommand(String command, SolrCore core, SolrRequestHandler rh){
+ NamedList namedlist = new SimpleOrderedMap();
+ namedlist.add("command", command);
+ LocalSolrQueryRequest solrqreq = new LocalSolrQueryRequest(core, namedlist);
+ SolrQueryResponse rsp = new SolrQueryResponse();
+ core.execute(rh, solrqreq, rsp);
+ namedlist = rsp.getValues();
+ return namedlist;
+}
+%>
+
+<%
+final Map<String,SolrRequestHandler> all = core.getRequestHandlers(ReplicationHandler.class);
+ if(all.isEmpty()){
+ response.sendError( 404, "No ReplicationHandler registered" );
+ return;
+ }
+
+// :HACK: we should be more deterministic if multiple instances
+final SolrRequestHandler rh = all.values().iterator().next();
+
+NamedList namedlist = executeCommand("details",core,rh);
+NamedList detailsMap = (NamedList)namedlist.get("details");
+%>
+</head>
+
+<body>
+<a href=".."><img border="0" align="right" height="78" width="142" src="../solr_small.png" alt="Solr"></a>
+<h1>Solr replication (<%= collectionName %>)
+
+<%
+if(detailsMap != null){
+ if( "true".equals(detailsMap.get("isMaster")) && "true".equals(detailsMap.get("isSlave")))
+ out.println(" Master & Slave");
+ else if("true".equals(detailsMap.get("isMaster")))
+ out.println(" Master");
+ else if("true".equals(detailsMap.get("isSlave")))
+ out.println(" Slave");
+}
+%></h1>
+
+<%= hostname %>:<%= port %><br/>
+cwd=<%= cwd %> SolrHome=<%= solrHome %>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/index.jsp
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/index.jsp b/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/index.jsp
new file mode 100644
index 0000000..5f1888f
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/replication/index.jsp
@@ -0,0 +1,379 @@
+<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8" %>
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ --%>
+
+<%@ page import="java.util.Collection" %>
+<%@ page import="java.util.Date" %>
+
+
+<%-- do a verbatim include so we can use the local vars --%>
+<%@include file="header.jsp"%>
+
+<br clear="all" />
+(<a href="http://wiki.apache.org/solr/SolrReplication">What Is This Page?</a>)
+<br clear="all" />
+<table>
+
+<%
+
+ final SolrCore solrcore = core;
+
+%>
+<%
+NamedList slave = null, master = null;
+if (detailsMap != null)
+ if ("true".equals(detailsMap.get("isSlave")))
+ if(detailsMap.get("slave") != null){
+ slave = (NamedList)detailsMap.get("slave");%>
+<tr>
+ <td>
+ <strong>Master</strong>
+ </td>
+ <td>
+ <%=slave.get("masterUrl")%>
+ <%
+ NamedList nl = (NamedList) slave.get("masterDetails");
+ if(nl == null)
+ out.print(" - <b>Unreachable</b>");
+ %>
+ </td>
+</tr>
+<%
+ if (nl != null) {
+ nl = (NamedList) nl.get("master");
+ if(nl != null){
+ %>
+<tr>
+ <td>
+ </td>
+ <td>Latest Index Version:<%=nl.get("indexVersion")%>, Generation: <%=nl.get("generation")%>
+ </td>
+</tr>
+<tr>
+ <td></td>
+ <td>Replicatable Index Version:<%=nl.get("replicatableIndexVersion")%>, Generation: <%=nl.get("replicatableGeneration")%>
+ </td>
+</tr>
+<%
+}
+}%>
+
+<tr>
+ <td>
+ <strong>Poll Interval</strong>
+ </td>
+ <td>
+ <%=slave.get("pollInterval")%>
+ </td>
+</tr>
+<%}%>
+
+<tr>
+ <td>
+ <strong>Local Index</strong>
+ </td>
+ <td>
+ <%
+ if (detailsMap != null)
+ out.println("Index Version: " + detailsMap.get("indexVersion") + ", Generation: " + detailsMap.get("generation"));
+ %>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ </td>
+ <td>
+ <% if (null != core.getIndexDir()) {
+ File dir = new File(core.getIndexDir());
+ out.println("Location: " + dir.getCanonicalPath());
+ }%>
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td><% if (detailsMap != null)
+ out.println("Size: " + detailsMap.get("indexSize"));
+ %>
+ </td>
+</tr>
+
+<%
+ if (detailsMap != null)
+ if ("true".equals(detailsMap.get("isMaster")))
+ if(detailsMap.get("master") != null){
+ master = (NamedList) detailsMap.get("master");
+%>
+
+<tr>
+ <td></td>
+ <td>
+ <%out.println("Config Files To Replicate: " + master.get("confFiles"));%>
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td>
+ <%out.println("Trigger Replication On: " + master.get("replicateAfter")); %>
+ </td>
+</tr>
+<%}%>
+
+<%
+ if ("true".equals(detailsMap.get("isSlave")))
+ if (slave != null) {%>
+<tr>
+ <td>
+ </td>
+ <td>
+ <%
+ out.println("Times Replicated Since Startup: " + slave.get("timesIndexReplicated"));
+ %>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ </td>
+ <td>
+ <%
+ out.println("Previous Replication Done At: " + slave.get("indexReplicatedAt"));
+ %>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ </td>
+ <td>
+ <%
+ out.println("Config Files Replicated At: " + slave.get("confFilesReplicatedAt"));
+ %>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ </td>
+ <td>
+ <%
+ out.println("Config Files Replicated: " + slave.get("confFilesReplicated"));
+ %>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ </td>
+ <td>
+ <%
+ out.println("Times Config Files Replicated Since Startup: " + slave.get("timesConfigReplicated"));
+ %>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ </td>
+ <td>
+ <%
+ if (slave.get("nextExecutionAt") != null)
+ if (slave.get("nextExecutionAt") != "")
+ out.println("Next Replication Cycle At: " + slave.get("nextExecutionAt"));
+ else if ("true".equals(slave.get("isPollingDisabled")))
+ out.println("Next Replication Cycle At: Polling disabled.");
+ else {
+ NamedList nl1 = (NamedList) slave.get("masterDetails");
+ if(nl1 != null){
+ NamedList nl2 = (NamedList) nl1.get("master");
+ if(nl2 != null)
+ out.println("Next Replication Cycle At: After " + nl2.get("replicateAfter") + " on master.");
+ }
+ }
+ %>
+ </td>
+</tr>
+
+<%
+ if ("true".equals(slave.get("isReplicating"))) {
+%>
+<tr>
+ <td><strong>Current Replication Status</strong>
+
+ <td>
+ <%out.println("Start Time: " + slave.get("replicationStartTime"));%>
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td>
+ <%
+ out.println("Files Downloaded: " + slave.get("numFilesDownloaded") + " / " + slave.get("numFilesToDownload"));%>
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td>
+ <%
+ out.println("Downloaded: " + slave.get("bytesDownloaded") + " / " + slave.get("bytesToDownload") + " [" + slave.get("totalPercent") + "%]");%>
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td>
+ <%
+ out.println("Downloading File: " + slave.get("currentFile") + ", Downloaded: " + slave.get("currentFileSizeDownloaded") + " / " + slave.get("currentFileSize") + " [" + slave.get("currentFileSizePercent") + "%]");%>
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td>
+ <%
+ out.println("Time Elapsed: " + slave.get("timeElapsed") + ", Estimated Time Remaining: " + slave.get("timeRemaining") + ", Speed: " + slave.get("downloadSpeed") + "/s");%>
+ </td>
+</tr>
+<%}%>
+
+<tr>
+ <td><strong>Controls</strong>
+ </td>
+ <td><%
+ String pollVal = request.getParameter("poll");
+ if (pollVal != null)
+ if (pollVal.equals("disable"))
+ executeCommand("disablepoll", core, rh);
+ else if (pollVal.equals("enable"))
+ executeCommand("enablepoll", core, rh);
+ if(slave != null)
+ if ("false".equals(slave.get("isPollingDisabled"))) {
+ %>
+
+ <form name=polling method="POST" action="./index.jsp" accept-charset="UTF-8">
+ <input name="poll" type="hidden" value="disable">
+ <input class="stdbutton" type="submit" value="Disable Poll">
+ </form>
+
+ <%}%>
+ <%
+ if(slave != null)
+ if ("true".equals(slave.get("isPollingDisabled"))) {
+ %>
+
+ <form name=polling method="POST" action="./index.jsp" accept-charset="UTF-8">
+ <input name="poll" type="hidden" value="enable">
+ <input class="stdbutton" type="submit" value="Enable Poll">
+ </form>
+ <%
+ }
+ %>
+
+ </td>
+</tr>
+
+<tr>
+ <td></td>
+ <td>
+ <form name=replicate method="POST" action="./index.jsp" accept-charset="UTF-8">
+ <input name="replicate" type="hidden" value="now">
+ <input name="replicateButton" class="stdbutton" type="submit" value="Replicate Now">
+ </form>
+ <%
+ if(slave != null)
+ if ("true".equals(slave.get("isReplicating"))) {
+ %>
+ <script type="text/javascript">
+ document["replicate"].replicateButton.disabled = true;
+ document["replicate"].replicateButton.className = 'stdbuttondis';
+ </script>
+ <form name=abort method="POST" action="./index.jsp" accept-charset="UTF-8">
+ <input name="abort" type="hidden" value="stop">
+ <input name="abortButton" class="stdbutton" type="submit" value="Abort">
+ </form>
+
+ <%} else {%>
+ <script type="text/javascript">
+ document["replicate"].replicateButton.disabled = false;
+ document["replicate"].replicateButton.className = 'stdbutton';
+ </script>
+ <%
+ }
+ String replicateParam = request.getParameter("replicate");
+ String abortParam = request.getParameter("abort");
+ if (replicateParam != null)
+ if (replicateParam.equals("now")) {
+ executeCommand("fetchindex", solrcore, rh);
+ }
+ if (abortParam != null)
+ if (abortParam.equals("stop")) {
+ executeCommand("abortfetch", solrcore, rh);
+ }
+ %>
+ </td>
+
+</tr>
+
+<%}%>
+
+<%-- List the cores (that arent this one) so we can switch --%>
+<% org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer) request.getAttribute("org.apache.solr.CoreContainer");
+ if (cores != null) {
+ Collection<String> names = cores.getCoreNames();
+ if (names.size() > 1) {%>
+<tr>
+ <td><strong>Cores:</strong><br></td>
+ <td><%
+ for (String name : names) {
+ %>[<a href="../../../<%=name%>/admin/index.jsp"><%=name%>
+ </a>]<%
+ }%></td>
+</tr>
+<%
+ }
+ }%>
+
+
+</table>
+<P>
+
+<p>
+
+<table>
+ <tr>
+ <td>
+ </td>
+ <td>
+ Current Time: <%= new Date() %>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ Server Start At: <%= new Date(core.getStartTime()) %>
+ </td>
+ </tr>
+</table>
+
+<br>
+<a href="..">Return to Admin Page</a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/schema.jsp
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/schema.jsp b/launchers/marmotta-webapp/src/main/webapp/solr/admin/schema.jsp
new file mode 100644
index 0000000..d0c7e08
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/schema.jsp
@@ -0,0 +1,674 @@
+<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ --%>
+
+<%-- $Id: index.jsp 608150 2008-01-02 17:15:30Z ryan $ --%>
+<%-- $Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v $ --%>
+<%-- $Name: $ --%>
+
+<script src="jquery-1.4.3.min.js"></script>
+<script>
+
+(function($, libName) {
+ var solr = {
+
+ //The default location of the luke handler relative to this page
+ // Can be overridden in the init(url) method
+ pathToLukeHandler: 'luke',
+
+ // Base properties to hold schema information
+ schemaInfo: {},
+ schemaFields: {},
+ schemaDynamicFields: {},
+ schemaTypes: {},
+ schemaFlags: {},
+
+ //The basic function to call to make the initail JSON calls
+ // takes one option parameter, the path to the luke handler
+ // if undefined, it will use the default, 'luke', which means
+ // this is being called from the same relative URL path
+ init: function(pathToLukeHandler) {
+ if (pathToLukeHandler != undefined) {
+ solr.pathToLukeHandler = pathToLukeHandler;
+ }
+ solr.loadSchema(function() {
+ solr.loadFromLukeHandler(function () {
+ solr.createMenu('menu');
+ solr.displaySchemaInfo();
+ });
+ });
+
+ },
+
+ //load the Schema from the LukeRequestHandler
+ // this loads every field, and in each field the copy source/dests and flags
+ // we also load the list of field types, and the list of flags
+ loadSchema: function(func) {
+ $.getJSON(solr.pathToLukeHandler +'?show=schema&wt=json', function(data) {
+ //populate all non field/type/flag data in the info block
+ $.each(data.index, function(i, item) {
+ solr.schemaInfo[i] = item;
+ });
+
+ //LukeRequestHandler places these two attributes outside of the "index" node, but
+ // we want it here so we can more easily display it in the "HOME" block
+ solr.schemaInfo['uniqueKeyField'] = data.schema.uniqueKeyField;
+ solr.schemaInfo['defaultSearchField'] = data.schema.defaultSearchField;
+ //a one-off hack, because the directory string is so long and unbroken
+ // that it can break CSS layouts
+ solr.schemaInfo['directory'] = solr.schemaInfo['directory'].substring(0, solr.schemaInfo['directory'].indexOf('@')+1) + ' ' + solr.schemaInfo['directory'].substring(solr.schemaInfo['directory'].indexOf('@') +1);
+
+ // populate the list of fields
+ $.each(data.schema.fields, function(i,item){
+ solr.schemaFields[i]=item;
+ });
+ // populate the list of field types
+ $.each(data.schema.types, function(type, ft) {
+ solr.schemaTypes[type] = ft;
+ });
+ //populate the list of dynamic fields
+ $.each(data.schema.dynamicFields, function(i, dynField) {
+ solr.schemaDynamicFields[i] = dynField;
+ });
+ //populate the list of flags, so we can convert flags to text in display
+ $.each(data.info.key, function(i, flag) {
+ solr.schemaFlags[i] = flag;
+ });
+
+ //LukeRequestHandler returns copyFields src/dest as the entire toString of the field
+ // we only need the field name, so here we loop through the fields, and replace the full
+ // field definitions with the name in the copySources/copyDests properties
+ $.each(solr.schemaFields, function(i, field) {
+ $.each(['copySources', 'copyDests'], function(i, copyProp) {
+ var newFields = new Array();
+ $.each(field[copyProp], function(i, fullName) {
+ newFields.push(fullName.substring(fullName.lastIndexOf(':')+1, fullName.indexOf('{')));
+ });
+ field[copyProp] = newFields;
+ });
+
+ });
+ //An additional optional callback
+ // used in init to trigger the 2nd call to LukeRequestHandler only
+ // after the first one is finished
+ if ($.isFunction(func)) {
+ func(solr);
+ }
+ });
+ },
+
+ //further populates the loaded schema with information gathered
+ // from the no argument LukeRequestHandler
+ loadFromLukeHandler: function(func) {
+ $.getJSON(solr.pathToLukeHandler+'?wt=json', function(data) {
+ $.each(data.fields, function(i, item) {
+ var field = solr.schemaFields[i];
+
+ //If undefined, then we have a dynamicField which does not show up
+ // in the LukeRequestHandler show=schema variant
+ if (field == undefined) {
+ field = item;
+ //Attach this field to its dynamicField
+ var base = field.dynamicBase;
+ var dynField = solr.schemaDynamicFields[base];
+
+ //Some fields in a multicore setting have no dynamic base, either
+ // the name of the core is a field that has no type or flags
+ if (dynField != undefined) {
+ var synFields = dynField['fields'];
+ if (synFields== undefined) {
+ synFields= new Array();
+ }
+ synFields.push(i);
+ dynField['fields'] = synFields;
+ }
+ solr.schemaFields[i] = item;
+ }
+ //Populate other data in this field that would not have been loaded in
+ // the show=schema variant
+ $.each(item, function(k, v) {
+ if (k == 'topTerms' || k == 'histogram') {
+ solr.schemaFields[i][k] = solr.lukeArrayToHash(v);
+ } else {
+ solr.schemaFields[i][k] = v;
+ }
+ });
+ });
+ //another optional callback; used in the init case to lay out the page
+ // after the data is loaded
+ if ($.isFunction(func)) {
+ func();
+ }
+ });
+ },
+ //some elements in the JSON response are arrays, where odd/even elements
+ // are the name/value, and convert it to a standard map/associative array
+ // incoming: ['foo', 'bar', 'bat', 'baz']
+ // output: {'foo':'bar', 'bat':baz'}
+ lukeArrayToHash: function(termsArr) {
+ var hash = new Object();
+ var temp;
+ //topTerms comes in as an array, with odd indexes the field name
+ // and even indexes the number
+ $.each(termsArr, function(i, item) {
+ if (i%2 ==0) {
+ temp = item;
+ } else {
+ hash[temp] = item;
+ }
+ });
+ return hash;
+ },
+
+ //gets the top Terms via an Ajax call the LukeRequestHandler for that field
+ // The callback is used here to redraw the table after the ajax call returns
+ getTopTerms: function(fieldName, numTerms, func) {
+ if (numTerms == undefined) {
+ var numTerms = 10;
+ }
+ if (isNaN(numTerms) || numTerms <=0 || numTerms.indexOf('.') != -1) {
+ return;
+ }
+ $.getJSON(solr.pathToLukeHandler+'?fl='+fieldName+'&wt=json&numTerms='+numTerms, function(data) {
+ solr.schemaFields[fieldName]['topTerms'] = solr.lukeArrayToHash(data.fields[fieldName].topTerms);
+ if ($.isFunction(func)) {
+ func(solr.schemaFields[fieldName]['topTerms'], fieldName);
+ }
+ });
+ },
+
+ // Displays the SchemaInfo in the main content panel
+ // dispayed on data load, and also when 'Home' is clicked
+ displaySchemaInfo: function() {
+ $('#mainInfo').html('');
+ $('#topTerms').html('');
+ $('#histogram').html('');
+ $('#mainInfo').append(solr.createSimpleText('Schema Information'));
+ //Make sure the uniqueKeyField and defaultSearchFields come first
+ $.each({'Unique Key':'uniqueKeyField', 'Default Search Field':'defaultSearchField'}, function(text, prop) {
+ if (solr.schemaInfo[prop] != undefined) {
+ $('#mainInfo').append(solr.createNameValueText(text, function(p) {
+ p.appendChild(solr.createLink(solr.schemaInfo[prop], solr.schemaInfo[prop]));
+ return p;
+ }));
+ }
+ });
+ $.each(solr.schemaInfo, function(i, item) {
+ if (i == 'uniqueKeyField' || i == 'defaultSearchField') {
+ //noop; we took care of this above
+ } else {
+ $('#mainInfo').append(solr.createNameValueText(i, item));
+ }
+ });
+ //Close all menus when we display schema home
+ solr.toggleMenus(undefined, ['fields', 'types', 'dynFields']);
+ },
+
+ // display a dynamic field in the main content panel
+ displayDynamicField: function(dynamicPattern) {
+ var df = solr.schemaDynamicFields[dynamicPattern];
+ $('#mainInfo').html('');
+ $('#topTerms').html('');
+ $('#histogram').html('');
+ $('#mainInfo').append(solr.createSimpleText('Dynamic Field: ' + dynamicPattern));
+ $('#mainInfo').append(solr.createNameValueText('Fields', function(p) {
+ if (df.fields != undefined) {
+ $.each(df.fields, function(i, item) {
+ p.appendChild(solr.createLink(item, item));
+ });
+ } else {
+ p.appendChild(document.createTextNode(' None currently in index'));
+ }
+ return p;
+ }));
+ var ft = solr.schemaTypes[df.type];
+ $('#mainInfo').append(solr.createNameValueText('Field Type', function(p) {
+ p.appendChild(solr.createLink(df.type, df.type, solr.displayFieldType));
+ return p;
+ }));
+ if (df.flags != undefined) {
+ $('#mainInfo').append(solr.createNameValueText('Properties', solr.createTextFromFlags(df.flags, df.type)));
+ }
+ solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer', true);
+ solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer', true);
+
+ solr.toggleMenus('dynFields', ['fields', 'types'], dynamicPattern);
+ },
+
+ // display a field type in the main area
+ displayFieldType: function(typeName) {
+ var ft = solr.schemaTypes[typeName];
+ $('#mainInfo').html('');
+ $('#topTerms').html('');
+ $('#histogram').html('');
+ $('#mainInfo').append(solr.createSimpleText('Field Type: ' + typeName));
+ $('#mainInfo').append(solr.createNameValueText('Fields', function(p) {
+ if (ft.fields != undefined) {
+ $.each(ft.fields, function(i, item) {
+ if (solr.schemaFields[item] != undefined) {
+ p.appendChild(solr.createLink(item, item));
+ } else {
+ p.appendChild(solr.createLink(item, item, solr.displayDynamicField));
+ }
+ p.appendChild(document.createTextNode(' '));
+ });
+ } else {
+ p.appendChild(document.createTextNode('No fields in index'));
+ }
+ return p;
+ }));
+ $('#mainInfo').append(solr.createNameValueText('Tokenized', ft.tokenized));
+ $('#mainInfo').append(solr.createNameValueText('Class Name', ft.className));
+
+ solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer');
+ solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer');
+ solr.toggleMenus('types', ['fields', 'dynFields'], typeName);
+ },
+
+ //Displays information about an Analyzer in the main content area
+ displayAnalyzer: function(analyzer, type, shouldCollapse) {
+ var tid = type.replace(' ', '');
+ var collapse = shouldCollapse && (analyzer.charFilters != undefined || analyzer.tokenizer != undefined || analyzer.filters != undefined);
+ $('#mainInfo').append(solr.createNameValueText(type, function(p) {
+ p.appendChild(document.createTextNode(analyzer.className + ' '));
+ if (collapse) {
+ p.appendChild(solr.createLink(type, 'Details', function() {
+ $('#'+tid).toggle("slow");
+ }));
+ }
+ return p;
+ }));
+ var adiv = document.createElement('div');
+ adiv.id=tid;
+ adiv.className='analyzer';
+ if (collapse) {
+ adiv.style.display='none';
+ }
+ if (analyzer.charFilters != undefined) {
+ adiv.appendChild(solr.createNameValueText('Char Filters', ''));
+ var f = document.createElement('ol');
+ $.each(analyzer.charFilters, function(i, item) {
+ var fil = document.createElement('li');
+ var filterText = item.className;
+ if (item.args != undefined) {
+ filterText += ' args:{'
+ $.each(item.args, function(fi, fitem) {
+ filterText += fi + ': ' + fitem + ' ';
+ });
+ filterText +='}';
+ fil.innerHTML = filterText;
+ f.appendChild(fil);
+ }
+ });
+ adiv.appendChild(f);
+ }
+ if (analyzer.tokenizer != undefined) {
+ adiv.appendChild(solr.createNameValueText("Tokenizer Class", analyzer.tokenizer.className));
+ }
+ if (analyzer.filters != undefined) {
+ adiv.appendChild(solr.createNameValueText('Filters', ''));
+ var f = document.createElement('ol');
+ $.each(analyzer.filters, function(i, item) {
+ var fil = document.createElement('li');
+ var filterText = item.className;
+ if (item.args != undefined) {
+ filterText += ' args:{'
+ $.each(item.args, function(fi, fitem) {
+ filterText += fi + ': ' + fitem + ' ';
+ });
+ filterText +='}';
+ fil.innerHTML = filterText;
+ f.appendChild(fil);
+ }
+ });
+ adiv.appendChild(f);
+ }
+ $('#mainInfo').append(adiv);
+ },
+
+ // display information about a Field in the main content area
+ // and its TopTerms and Histogram in related divs
+ displayField: function(fieldName) {
+ var field = solr.schemaFields[fieldName];
+ var isDynamic = field.dynamicBase != undefined ? true : false;
+ var ft;
+ var ftName;
+ $('#mainInfo').html('');
+ $('#topTerms').html('');
+ $('#histogram').html('');
+ $('#mainInfo').append(solr.createSimpleText('Field: ' + fieldName));
+
+ //For regular fields, we take their properties; for dynamicFields,
+ // we take them from their dynamicField definitions
+ if (isDynamic) {
+ ftName = solr.schemaDynamicFields[field.dynamicBase].type
+ $('#mainInfo').append(solr.createNameValueText('Dynamically Created From Pattern', function(p) {
+ p.appendChild(solr.createLink(field.dynamicBase, field.dynamicBase, solr.displayDynamicField));
+ return p;
+ }));
+ } else {
+ ftName = field.type;
+ }
+ ft = solr.schemaTypes[field.type];
+ $('#mainInfo').append(solr.createNameValueText('Field Type', function(p) {
+ p.appendChild(solr.createLink(ftName, ftName, solr.displayFieldType));
+ return p;
+ }));
+ if (solr.schemaFlags != '') {
+ $.each({'flags':'Properties', 'schema':'Schema', 'index':'Index'}, function(prop, text) {
+ if (field[prop] != undefined) {
+ $('#mainInfo').append(solr.createNameValueText(text, solr.createTextFromFlags(field[prop], ft)));
+ }
+ });
+ }
+ $.each({'copySources':'Copied From', 'copyDests':'Copied Into'}, function(prop, text) {
+ if (field[prop] != undefined && field[prop] != '') {
+ $('#mainInfo').append(solr.createNameValueText(text, function(p) {
+ $.each(field[prop], function(i, item) {
+ p.appendChild(solr.createLink(item, item));
+ p.appendChild(document.createTextNode(' '));
+ });
+ return p;
+ }));
+ }
+ });
+ if (field.positionIncrementGap != undefined) {
+ $('#mainInfo').append(solr.createNameValueText('Position Increment Gap', field.positionIncrementGap));
+ }
+ solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer', true);
+ solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer', true);
+ if (field.docs != undefined) {
+ $('#mainInfo').append(solr.createNameValueText('Docs', field.docs));
+ }
+ if (field.distinct != undefined) {
+ $('#mainInfo').append(solr.createNameValueText('Distinct', field.distinct));
+ }
+
+ if (field.topTerms != undefined) {
+ solr.displayTopTerms(field.topTerms, fieldName);
+ }
+
+ if (field.histogram != undefined) {
+ solr.drawHistogram(field.histogram);
+ }
+ solr.toggleMenus('fields', ['types', 'dynFields'], fieldName);
+ },
+
+ //utility method to create a single sentence list of properties from a flag set
+ // or pass it on, if the flags are (unstored field)
+ createTextFromFlags: function(fieldFlags, fieldType) {
+ var value;
+ if (fieldFlags != '(unstored field)') {
+ var value = '';
+ for (var i=0;i<fieldFlags.length;i++) {
+ if (fieldFlags.charAt(i) != '-') {
+ value += solr.schemaFlags[fieldFlags.charAt(i)];
+ value += ', ';
+ }
+ }
+ value = value.substring(0, value.length-2);
+ } else {
+ value = fieldFlags;
+ }
+ return value;
+ },
+
+ //Store the currently highlighted menu item, as otherwise we
+ // must traverse all li menu items, which is very slow on schemas with
+ // large number of fields
+ // for example $('#menu ul li').siblings().removeClass('selected');
+ currentlyHighlightedMenuId: undefined,
+
+ //add a highlight to the currently selected menu item, and remove
+ // the highlights from all other menu items
+ highlightMenuItem: function(idToSelect) {
+ if (solr.currentlyHighlightedMenuId != undefined) {
+ $('#'+solr.currentlyHighlightedMenuId).removeClass('selected');
+ }
+ $('#'+idToSelect).addClass('selected');
+ solr.currentlyHighlightedMenuId = idToSelect;
+ },
+
+ //Opens one menu group, close the others, and optionally highlight one
+ // item, which should be in the opened menu
+ toggleMenus: function(idToShow, idsToHide, idToSelect) {
+ if (idToSelect != undefined) {
+ solr.highlightMenuItem(idToShow + idToSelect);
+ }
+ $('#'+idToShow).show("slow");
+ $.each(idsToHide, function(i, idToHide) {
+ $('#'+idToHide).hide("slow");
+ });
+ },
+
+ //A utility method to create a paragraph, which takes two arguments;
+ // an opening text, and either text or a callback function to follow
+ // any callback function must return the node passed into it
+ createNameValueText: function(openingText, func) {
+ var p = document.createElement('p');
+ p.appendChild(solr.createSimpleText(openingText + ': ', 'b'));
+ return solr.applyFuncToNode(p, func);
+ },
+
+ //utility method to create an HTML text element node
+ // with the literal text to place, and an optional function to apply
+ // any callback function must return the node passed into it
+ createSimpleText: function(text, n, func) {
+ if (n == undefined) {
+ n = 'h2';
+ }
+ var no= document.createElement(n);
+ no.appendChild(document.createTextNode(text));
+ return solr.applyFuncToNode(no, func);
+ },
+
+ //Utility method that applies a function or a string to append
+ // an additional child to a node
+ applyFuncToNode: function(no, func) {
+ if ($.isFunction(func)) {
+ no = func(no);
+ } else {
+ // if it is not a function, append it as a string
+ if (func != undefined) {
+ no.appendChild(document.createTextNode(' ' + func));
+ }
+ }
+ return no;
+ },
+
+ //show a table of top terms for a given field
+ displayTopTerms: function(topTerms, fieldName) {
+ $('#topTerms').html('');
+ var tbl = document.createElement('table');
+ tbl.className='topTerms';
+ var thead= document.createElement('thead');
+ var headerRow = document.createElement('tr');
+ $.each(['term', 'frequency'], function() {
+ var cell = document.createElement('th');
+ cell.innerHTML= this;
+ headerRow.appendChild(cell);
+ });
+ thead.appendChild(headerRow);
+ tbl.appendChild(thead);
+ var tbody = document.createElement('tbody');
+
+ var numTerms = 0;
+ $.each(topTerms, function(term, count) {
+ var c1 = $('<td>').text(term);
+ var c2 = $('<td>').text(count);
+ var row = $('<tr>').append(c1).append(c2);
+ tbody.appendChild(row.get(0));
+ numTerms++;
+ });
+ tbl.appendChild(tbody);
+
+ //create a header along with an input widget so the user
+ // can request a different number of Top Terms
+ var h2 = document.createElement('h2');
+ h2.appendChild(document.createTextNode('Top '));
+ var termsGetter = document.createElement('input');
+ termsGetter.type='text';
+ termsGetter.size=5;
+ termsGetter.value=numTerms;
+
+ termsGetter.onchange=function() {
+ solr.getTopTerms(fieldName, this.value, solr.displayTopTerms);
+ }
+ h2.appendChild(termsGetter);
+ h2.appendChild(document.createTextNode(' Terms'));
+ $('#topTerms').append(h2);
+
+ document.getElementById('topTerms').appendChild(tbl);
+ $('#topTerms').append(tbl);
+ },
+
+ //draws a histogram, taking a map of values and an optional total height and width for the table
+ drawHistogram: function(histogram, totalHeightArg, totalWidthArg) {
+ $('#histogram').html('');
+ $('#histogram').append(solr.createSimpleText('Histogram'));
+ var max = 0;
+ var bars =0;
+ //find the # of columns and max value in the histogram
+ // so we can create an appropriately scaled chart
+ $.each(histogram, function(i, item) {
+ if (item > max) max = item;
+ bars += 1;
+ });
+ if (max ==0) {
+ $('#histogram').append(solr.createNameValueText('No histogram available'));
+ } else {
+ var totalHeight = totalHeightArg == undefined ? 208 : totalHeightArg;
+ var totalWidth = totalWidthArg == undefined ? 160 : totalWidthArg;
+ var tbl = document.createElement('table');
+ tbl.style.width=totalWidth+'px';
+ tbl.className = 'histogram';
+ var h = document.createElement('tbody');
+ var r = document.createElement('tr');
+ var r2 = document.createElement('tr');
+ $.each(histogram, function(i, item) {
+ var c = document.createElement('td');
+ c.innerHTML=item+'<div style="width:'+totalWidth/bars+'px;height:'+(item*totalHeight/max)+'px;background:blue"> </div>';
+ r.appendChild(c);
+ var c2 = document.createElement('td');
+ c2.innerHTML='' + i;
+ r2.appendChild(c2);
+ });
+ h.appendChild(r);
+ h.appendChild(r2);
+ tbl.appendChild(h);
+ $('#histogram').append(tbl);
+ }
+ },
+
+ //dynamically creates a link to be appended
+ createLink: function(idToDisplay, linkText, linkFunction) {
+ var link = document.createElement('a');
+ if (!$.isFunction(linkFunction)) {
+ linkFunction = solr.displayField
+ }
+ link.onclick=function() {
+ linkFunction(idToDisplay);
+ return false;
+ };
+ link.href='#';
+ link.innerHTML=linkText;
+ return link;
+ },
+
+ //Creates a menu header that can expand or collapse its children
+ createMenuHeader: function(text, idToShow, idsToHide) {
+ var head = document.createElement('h3');
+ var a = document.createElement('a');
+ a.onclick=function() {
+ solr.toggleMenus(idToShow, idsToHide);
+ return false;
+ };
+ a.href='#';
+ a.innerHTML=text;
+ head.appendChild(a);
+ return head;
+ },
+
+ //Creates an element in a menu (e.g. each field in a list of fields)
+ createMenuItem: function(tagName, text, link, type, func) {
+ var fieldEle = document.createElement('li');
+ fieldEle.id=type+text;
+ var funct = func == undefined ? undefined : func;
+ fieldEle.appendChild(solr.createLink(text, link, funct));
+ return fieldEle;
+ },
+
+ //populates the menu div
+ createMenu: function(menuId) {
+ var m = $('#'+menuId);
+ var home = document.createElement('h2');
+ home.appendChild(solr.createLink('Home', 'Home', solr.displaySchemaInfo));
+ m.append(home);
+ m.append(solr.createMenuHeader('Fields', 'fields', ['types', 'dynFields']));
+ var fields= document.createElement('ul');
+ fields.style.display='none';
+ fields.id = 'fields';
+ $.each(solr.schemaFields, function(i, item) {
+ fields.appendChild(solr.createMenuItem('li', i, i, fields.id));
+ });
+ m.append(fields);
+ m.append(solr.createMenuHeader('Dynamic Fields', 'dynFields', ['fields', 'types']));
+ var dyns = document.createElement('ul');
+ dyns.style.display = 'none';
+ dyns.id = 'dynFields';
+ $.each(solr.schemaDynamicFields, function(i, item) {
+ dyns.appendChild(solr.createMenuItem('li', i,i, dyns.id, solr.displayDynamicField));
+ });
+ m.append(dyns);
+ m.append(solr.createMenuHeader('Field Types', 'types', ['fields', 'dynFields']));
+ var types = document.createElement('ul');
+ types.style.display='none';
+ types.id='types';
+ $.each(this.schemaTypes, function(i, item) {
+ types.appendChild(solr.createMenuItem('li', i, i,types.id, solr.displayFieldType));
+ });
+ m.append(types);
+ }
+ };
+
+ window[libName] = solr;
+})(jQuery, 'solr');
+$(document).ready(function() {
+ solr.init();
+});
+
+$(window).unload( function() {
+ solr = null;
+ $('#mainInfo').html('');
+ $('#menu').html('');
+ $('#topTerms').html('');
+ $('#histogram').html('');
+});
+
+</script>
+<%-- do a verbatim include so we can use the local vars --%>
+<%@include file="header.jsp" %>
+<div id="schemaTop">
+<h2>Schema Browser | See <a href="file/?file=schema.xml">Raw Schema.xml</a></h2>
+</div>
+<div id="menu"></div>
+<div id="content">
+<div id="mainInfo"><h2>Please wait...loading and parsing Schema Information from LukeRequestHandler</h2><p>If it does not load or your browser is not javascript or ajax-capable, you may wish to examine your schema using the <a href="luke?wt=xslt&tr=luke.xsl">Server side transformed LukeRequestHandler</a> or the raw <a href="file/?file=schema.xml">schema.xml</a> instead.</div>
+<div id="topTerms"></div>
+<div id="histogram"></div>
+</div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr-admin.css
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr-admin.css b/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr-admin.css
new file mode 100644
index 0000000..63a7fdf
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr-admin.css
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2012 Salzburg Research.
+ *
+ * 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.
+ */
+
+h1, h2, h3, h4, h5 {
+ display: block;
+ font-family: ITC Officina Sans Book, Terminator Two, Helvetica, Arial, sans-serif;
+ font-style: bold;
+ margin: 0;
+}
+
+strong {
+ font-family: ITC Officina Sans Book, Terminator Two, Helvetica, Arial, sans-serif;
+ font-style: bold;
+ margin: 0;
+}
+
+input.std, textarea.std {
+ color: black;
+ border: 2px inset #ff9933;
+ background-color: #ffffff;
+ width:450px;
+ max-width:450px;
+}
+
+input.stdbutton {
+ font-family: ITC Officina Sans Book, Helvetica, Arial, sans-serif;
+ font-style: bold;
+ font-size: 11;
+ text-transform: capitalize;
+ color: black;
+ background-color: #dddddd;
+ border: groove #ff9933;
+}
+
+input.stdbutton:hover {
+ color: #0000ff;
+ border: groove #0000ff;
+}
+
+input.stdbuttondis{
+ font-family: ITC Officina Sans Book, Helvetica, Arial, sans-serif;
+ font-style: bold;
+ font-size: 11;
+ text-transform: capitalize;
+ color: #8B8B83;
+ background-color: #dddddd;
+ border: groove #8B8B83;
+}
+
+body {
+ background-color: #bbbbbb;
+}
+
+table {
+ display: table;
+ background-color: #FAF7E4;
+ width: 100%;
+ border-top: 4px solid #666666;
+ border-left: 2px solid #666666;
+ text-align: left;
+ vertical-align: top;
+ cellpadding-right: 8px;
+}
+
+table.responseHeader, table.analysis {
+ width: auto;
+}
+
+table {
+ border-collapse: collapse
+}
+
+tr > td:first-child {
+ width: 30%;
+}
+
+td.debugdata, td.highlight, td.responseHeader {
+ width: auto;
+}
+
+td.highlight {
+ background: #ccccff;
+}
+
+td.responseHeader {
+ width: auto;
+ text-align: right;
+}
+
+td.responseHeader + td {
+ text-align: left;
+ font-family: Courier;
+}
+
+
+th, td {
+ text-align: left;
+ vertical-align: top;
+ border-bottom: 1px solid #ff9933;
+}
+
+a {
+ text-decoration: none;
+ font-weight: bold;
+ font-size: 11px;
+ background: #FAF7E4;
+ text-transform: uppercase;
+}
+
+a:link {
+ color: #0000aa;
+}
+
+a:visited {
+ color: #0000ff;
+}
+
+a:active {
+ color: #4444ff;
+}
+
+a:hover {
+ color: #0000ff;
+ background: #ccccff;
+}
+
+a:offsite {
+ color: #0000aa;
+}
+
+table.analysis th, table.analysis td {
+border-right:1px solid black;
+}
+
+/**
+ * styles for the schema browser
+ */
+
+table.topTerms {
+ width: 450px;
+}
+
+table.histogram {
+ vertical-align: bottom;
+}
+
+table.histogram td, table.histogram th {
+ text-align: center;
+ vertical-align: bottom;
+ border-bottom: 1px solid #ff9933;
+ width: auto;
+}
+
+#menu {
+ background-color: #FAF7E4;
+ height:100%;
+ min-height:100%;
+ width:140px;
+ float:left;
+ margin-right:20px
+}
+#menu h3 {
+ padding-left:10px;
+}
+#menu ul {
+ list-style: none;
+ text-align: right;
+ margin: 0;
+ padding: 0
+}
+#menu li.header {
+ text-align: left;
+}
+#menu li {
+ border: 1px solid #ff9933;
+ margin: 0
+}
+#menu li a {
+ display:block;
+}
+#menu li.selected a {
+ background-color: #ccccff
+}
+#menu a:hover {
+ background: #ccccff
+}
+
+#schemaTop {
+ border-bottom:1px black solid;
+}
+
+#content {
+ margin-left: 160px;
+}
+#topTerms {
+ float:left;
+ margin-right:40px;
+}
+div.analyzer {
+ margin-left:20px;
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr_small.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr_small.png b/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr_small.png
new file mode 100644
index 0000000..326e3cd
Binary files /dev/null and b/launchers/marmotta-webapp/src/main/webapp/solr/admin/solr_small.png differ
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.jsp
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.jsp b/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.jsp
new file mode 100644
index 0000000..6a45aa4
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.jsp
@@ -0,0 +1,91 @@
+<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
+
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ --%>
+<%@ page import="org.apache.solr.common.util.NamedList,
+ org.apache.solr.core.SolrInfoMBean,
+ java.util.Date,
+ java.util.Map"%>
+<?xml-stylesheet type="text/xsl" href="stats.xsl"?>
+<%@include file="_info.jsp" %>
+
+
+<solr>
+ <%
+ if (core.getName() != null) { %>
+ <core><% XML.escapeCharData(core.getName(), out); %></core>
+ <% } %>
+ <schema><% XML.escapeCharData(collectionName, out); %></schema>
+ <host><% XML.escapeCharData(hostname, out); %></host>
+ <now><% XML.escapeCharData(new Date().toString(), out); %></now>
+ <start><% XML.escapeCharData(new Date(core.getStartTime()).toString(), out); %></start>
+ <solr-info>
+<%
+for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
+%>
+ <<%= cat.toString() %>>
+<%
+ Map<String,SolrInfoMBean> reg = core.getInfoRegistry();
+ for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
+ String key = entry.getKey();
+ SolrInfoMBean m = entry.getValue();
+
+ if (m.getCategory() != cat) continue;
+
+ NamedList nl = m.getStatistics();
+ if ((nl != null) && (nl.size() != 0)) {
+ String na = "None Provided";
+ String name = (m.getName()!=null ? m.getName() : na);
+ String vers = (m.getVersion()!=null ? m.getVersion() : na);
+ String desc = (m.getDescription()!=null ? m.getDescription() : na);
+%>
+ <entry>
+ <name>
+ <% XML.escapeCharData(key, out); %>
+ </name>
+ <class>
+ <% XML.escapeCharData(name, out); %>
+ </class>
+ <version>
+ <% XML.escapeCharData(vers, out); %>
+ </version>
+ <description>
+ <% XML.escapeCharData(desc, out); %>
+ </description>
+ <stats>
+<%
+ for (int i = 0; i < nl.size() ; i++) {
+%>
+ <stat name="<% XML.escapeAttributeValue(nl.getName(i), out); %>" >
+ <% XML.escapeCharData(nl.getVal(i).toString(), out); %>
+ </stat>
+<%
+ }
+%>
+ </stats>
+ </entry>
+<%
+ }
+%>
+<%
+ }
+%>
+ </<%= cat.toString() %>>
+<%
+}
+%>
+ </solr-info>
+</solr>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.xsl
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.xsl b/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.xsl
new file mode 100644
index 0000000..c9cee70
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/stats.xsl
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ -->
+
+<!-- $Id: stats.xsl 1075192 2011-02-28 00:50:09Z uschindler $ -->
+<!-- $URL: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_3_1/solr/src/webapp/web/admin/stats.xsl $ -->
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+
+ <xsl:output
+ method="html"
+ encoding="utf-8"
+ media-type="text/html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
+
+
+ <xsl:template match="/">
+ <xsl:variable name="title">
+ <!-- no whitespace before the colon -->
+ Solr Statistics<xsl:if test="solr/core">:
+ <xsl:value-of select="solr/core"/>
+ </xsl:if>
+(<xsl:value-of select="solr/schema" />)
+ </xsl:variable>
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>
+ <link rel="icon" href="favicon.ico" type="image/ico"></link>
+ <link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
+ <title><xsl:value-of select="$title"/></title>
+ </head>
+ <body>
+ <a href=".">
+ <img border="0" align="right" height="78" width="142" src="solr_small.png" alt="Apache Solr">
+ </img>
+ </a>
+ <h1><xsl:value-of select="$title"/></h1>
+ <xsl:value-of select="solr/host" />
+ <br clear="all" />
+ <xsl:apply-templates/>
+ <br /><br />
+ <a href=".">Return to Admin Page</a>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="solr">
+ <table>
+ <tr>
+ <td>
+ <H3>Category</H3>
+ </td>
+ <td>
+ [<a href="#core">Core</a>]
+ [<a href="#cache">Cache</a>]
+ [<a href="#query">Query</a>]
+ [<a href="#update">Update</a>]
+ [<a href="#highlight">Highlighting</a>]
+ [<a href="#other">Other</a>]
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ Current Time: <xsl:value-of select="now" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ Server Start Time: <xsl:value-of select="start" />
+ </td>
+ </tr>
+ <xsl:apply-templates select="*" mode="header" />
+ </table>
+ <xsl:apply-templates select="solr-info" mode="main" />
+ </xsl:template>
+
+ <!-- catch all in case new header info gets added to XML -->
+ <xsl:template match="solr/*" mode="header" priority="-10">
+ <tr>
+ <td>
+ </td>
+ <td>
+ <xsl:value-of select="local-name()" />: <xsl:value-of select="text()" />
+ </td>
+ </tr>
+ </xsl:template>
+
+ <!-- things we've already explicitly taken care of -->
+ <xsl:template match="solr/schema" mode="header" />
+ <xsl:template match="solr/core" mode="header" />
+ <xsl:template match="solr/host" mode="header" />
+ <xsl:template match="solr/now" mode="header" />
+ <xsl:template match="solr/start" mode="header" />
+ <xsl:template match="solr/solr-info" mode="header" />
+
+ <xsl:template match="solr/solr-info" mode="main">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/*">
+ <br />
+ <xsl:apply-templates select="." mode="sub-header" />
+ <table>
+ <tr>
+ <td align="right">
+  
+ </td>
+ <td>
+ </td>
+ </tr>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/CORE" mode="sub-header">
+ <a name="core"><h2>Core</h2></a>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/CACHE" mode="sub-header">
+ <a name="cache"><h2>Cache</h2></a>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/QUERYHANDLER" mode="sub-header">
+ <a name="query"><h2>Query Handlers</h2></a>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/UPDATEHANDLER" mode="sub-header">
+ <a name="update"><h2>Update Handlers</h2></a>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/HIGHLIGHTING" mode="sub-header">
+ <a name="highlight"><h2>Highlighting</h2></a>
+ </xsl:template>
+
+ <!-- catch all for new types of plugins -->
+ <xsl:template match="solr/solr-info/*" mode="sub-header" priority="-10">
+ <h2><xsl:value-of select="local-name()"/></h2>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/OTHER" mode="sub-header">
+ <a name="other"><h2>Other</h2></a>
+ </xsl:template>
+
+ <xsl:template match="solr/solr-info/*/entry">
+ <tr>
+ <td align="right">
+ <strong>name: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="name"/> </tt>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <strong>class: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="class"/> </tt>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <strong>version: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="version"/> </tt>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <strong>description: </strong>
+ </td>
+ <td>
+ <tt><xsl:value-of select="description"/> </tt>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <strong>stats: </strong>
+ </td>
+ <td>
+ <xsl:for-each select="stats/stat[@name]">
+ <xsl:value-of select="@name"/>
+ <xsl:text> : </xsl:text>
+ <xsl:variable name="name" select="@name" />
+ <xsl:value-of select="." /><br />
+ </xsl:for-each>
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </xsl:template>
+
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/tabular.xsl
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/tabular.xsl b/launchers/marmotta-webapp/src/main/webapp/solr/admin/tabular.xsl
new file mode 100644
index 0000000..55fbaf6
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/tabular.xsl
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ -->
+
+<!-- $Id: tabular.xsl 1075192 2011-02-28 00:50:09Z uschindler $ -->
+<!-- $URL: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_3_1/solr/src/webapp/web/admin/tabular.xsl $ -->
+
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+
+ <xsl:output
+ method="html"
+ encoding="utf-8"
+ media-type="text/html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
+
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>
+ <link rel="icon" href="favicon.ico" type="image/ico"></link>
+ <link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
+ <title>Solr Search Results</title>
+ </head>
+ <body>
+ <a href=".">
+ <img border="0" align="right" height="78" width="142" src="solr_small.png" alt="Apache Solr">
+ </img>
+ </a>
+ <h1>Solr Search Results</h1>
+ <br clear="all" />
+ <xsl:apply-templates/>
+ <br /><br />
+ <a href=".">Return to Admin Page</a>
+ </body>
+ </html>
+ </xsl:template>
+
+
+ <xsl:template match="responseHeader">
+ <table name="responseHeader">
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="status">
+ <tr>
+ <td name="responseHeader"><strong>Status: </strong></td>
+ <td><xsl:value-of select="."></xsl:value-of></td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="numFields">
+ <tr>
+ <td name="responseHeader"><strong>Number of Fields: </strong></td>
+ <td><xsl:value-of select="."></xsl:value-of></td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="numRecords">
+ <tr>
+ <td name="responseHeader"><strong>Records Returned: </strong></td>
+ <td><xsl:value-of select="."></xsl:value-of></td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="numFound">
+ <tr>
+ <td name="responseHeader"><strong>Records Found: </strong></td>
+ <td><xsl:value-of select="."></xsl:value-of></td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="QTime">
+ <tr>
+ <td name="responseHeader"><strong>Query time: </strong></td>
+ <td><xsl:value-of select="."></xsl:value-of>(ms)</td>
+ </tr>
+ </xsl:template>
+
+ <!-- YCS.. match everything. How to match only what is not
+ matched above???
+ -->
+ <xsl:template match="responseHeader/*">
+ <tr>
+ <td name="responseHeader"><strong><xsl:value-of select="name(.)"></xsl:value-of>: </strong></td>
+ <td><xsl:value-of select="."></xsl:value-of></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="responseBody">
+ <br></br><br></br>
+ <table border="2">
+
+ <!-- table headers -->
+ <tr>
+ <xsl:for-each select="record[1]/field">
+ <th><xsl:value-of select="name"></xsl:value-of></th>
+ </xsl:for-each>
+ </tr>
+
+ <!-- table rows -->
+ <xsl:for-each select="record">
+ <tr>
+ <xsl:for-each select="field">
+ <td><xsl:value-of select="value"></xsl:value-of> </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+
+ </table>
+
+
+ </xsl:template>
+
+
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.jsp
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.jsp b/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.jsp
new file mode 100644
index 0000000..4f7dacf
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.jsp
@@ -0,0 +1,108 @@
+<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
+
+<%--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ --%>
+<%@ page import="java.io.IOException,
+ java.lang.management.ManagementFactory,
+ java.lang.management.ThreadInfo,
+ java.lang.management.ThreadMXBean"%>
+<%@include file="_info.jsp" %>
+
+
+<?xml-stylesheet type="text/xsl" href="threaddump.xsl"?>
+<%!
+ static ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
+%>
+<solr>
+ <core><%= collectionName %></core>
+ <system>
+ <jvm>
+ <version><%=System.getProperty("java.vm.version")%></version>
+ <name><%=System.getProperty("java.vm.name")%></name>
+ </jvm>
+ <threadCount>
+ <current><%=tmbean.getThreadCount()%></current>
+ <peak><%=tmbean.getPeakThreadCount()%></peak>
+ <daemon><%=tmbean.getDaemonThreadCount()%></daemon>
+ </threadCount>
+<%
+ long[] tids;
+ ThreadInfo[] tinfos;
+ tids = tmbean.findMonitorDeadlockedThreads();
+ if (tids != null) {
+ out.println(" <deadlocks>");
+ tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
+ for (ThreadInfo ti : tinfos) {
+ printThreadInfo(ti, out);
+ }
+ out.println(" </deadlocks>");
+ }
+%>
+<%
+ tids = tmbean.getAllThreadIds();
+ tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
+ out.println(" <threadDump>");
+ for (ThreadInfo ti : tinfos) {
+ printThreadInfo(ti, out);
+ }
+ out.println(" </threadDump>");
+%>
+ </system>
+</solr>
+
+<%!
+ static void printThreadInfo(ThreadInfo ti, JspWriter out) throws IOException {
+ long tid = ti.getThreadId();
+ out.println(" <thread>");
+ out.println(" <id>" + tid + "</id>");
+ out.print(" <name>");
+ XML.escapeCharData(ti.getThreadName(), out);
+ out.println("</name>");
+ out.println(" <state>" + ti.getThreadState() + "</state>");
+ if (ti.getLockName() != null) {
+ out.println(" <lock>" + ti.getLockName() + "</lock>");
+ }
+ if (ti.isSuspended()) {
+ out.println(" <suspended/>");
+ }
+ if (ti.isInNative()) {
+ out.println(" <inNative/>");
+ }
+ if (tmbean.isThreadCpuTimeSupported()) {
+ out.println(" <cpuTime>" + formatNanos(tmbean.getThreadCpuTime(tid)) + "</cpuTime>");
+ out.println(" <userTime>" + formatNanos(tmbean.getThreadUserTime(tid)) + "</userTime>");
+ }
+
+ if (ti.getLockOwnerName() != null) {
+ out.println(" <owner>");
+ out.println(" <name>" + ti.getLockOwnerName() + "</name>");
+ out.println(" <id>" + ti.getLockOwnerId() + "</id>");
+ out.println(" </owner>");
+ }
+ out.println(" <stackTrace>");
+ for (StackTraceElement ste : ti.getStackTrace()) {
+ out.print(" <line>");
+ XML.escapeCharData("at " + ste.toString(), out);
+ out.println(" </line>");
+ }
+ out.println(" </stackTrace>");
+ out.println(" </thread>");
+ }
+
+ static String formatNanos(long ns) {
+ return String.format("%.4fms", ns / (double) 1000000);
+ }
+%>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.xsl
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.xsl b/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.xsl
new file mode 100644
index 0000000..58557cd
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/admin/threaddump.xsl
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ -->
+
+<!-- $Id$ -->
+<!-- $URL$ -->
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+ <xsl:output
+ method="html"
+ indent="yes"
+ encoding="utf-8"
+ media-type="text/html"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>
+ <link rel="icon" href="favicon.ico" type="image/ico"></link>
+ <link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
+ <title>Solr Info</title>
+ </head>
+ <body>
+ <a href=".">
+ <img border="0" align="right" height="78" width="142" src="solr_small.png" alt="Apache Solr"/>
+ </a>
+ <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>
+ <h2>Thread Dump</h2>
+ <div style="margin-top: 1em;">
+ <table>
+ <xsl:apply-templates/>
+ </table>
+ <a href=".">Return to Admin Page</a>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:include href="meta.xsl"/>
+
+ <xsl:template match="solr/system/jvm">
+ <tr>
+ <td><xsl:value-of select="name"/> <xsl:value-of select="version"/></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="solr/system/threadCount">
+ <tr>
+ <td>
+ Thread Count:
+ current=<xsl:value-of select="current"/>,
+ peak=<xsl:value-of select="peak"/>,
+ daemon=<xsl:value-of select="daemon"/></td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="solr/system/threadDump">
+ <div>Full Thread Dump:</div>
+ <xsl:for-each select="thread">
+ <!-- OG: TODO: add suspended/native conditionals -->
+ <tr>
+ <td style="margin-left: 1em; font-weight: bold;">
+ '<xsl:value-of select="name"/>'
+ Id=<xsl:value-of select="id"/>,
+ <xsl:value-of select="state"/>
+ on lock=<xsl:value-of select="lock"/>,
+ total cpu time=<xsl:value-of select="cpuTime"/>
+ user time=<xsl:value-of select="userTime"/>
+ </td>
+ </tr>
+ <xsl:apply-templates select="stackTrace"/>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="stackTrace">
+ <tr>
+ <td style="margin-left: 1em;">
+ <xsl:for-each select="line">
+ <xsl:value-of select="."/><br/>
+ </xsl:for-each>
+ </td>
+ </tr>
+ </xsl:template>
+
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/favicon.ico
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/favicon.ico b/launchers/marmotta-webapp/src/main/webapp/solr/favicon.ico
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/main/webapp/solr/solr_admin.jsp
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/solr/solr_admin.jsp b/launchers/marmotta-webapp/src/main/webapp/solr/solr_admin.jsp
new file mode 100644
index 0000000..e83a055
--- /dev/null
+++ b/launchers/marmotta-webapp/src/main/webapp/solr/solr_admin.jsp
@@ -0,0 +1,43 @@
+<%--
+
+ Copyright (C) 2013 Salzburg Research.
+
+ 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.
+
+--%>
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="solr-admin.css">
+<link rel="icon" href="favicon.ico" type="image/ico"></link>
+<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
+<title>Welcome to Solr</title>
+</head>
+
+<body>
+<h1>Welcome to Solr!</h1>
+<a href="."><img border="0" align="right" height="78" width="142" src="admin/solr_small.png" alt="Solr"/></a>
+
+<%
+ org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
+ if( cores != null
+ && cores.getCores().size() > 0 // HACK! check that we have valid names...
+ && cores.getCores().iterator().next().getName().length() != 0 ) {
+ for( org.apache.solr.core.SolrCore core : cores.getCores() ) {%>
+<a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %></a><br/>
+<% }} else { %>
+<a href="admin">Solr Admin</a>
+<% } %>
+<!--<a href="admin/shortcuts/search.gsp">SOLR shortcuts</a>--><br/>
+
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/test/resources/META-INF/beans.xml b/launchers/marmotta-webapp/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..4e44c49
--- /dev/null
+++ b/launchers/marmotta-webapp/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ -->
+
+<beans
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-webapp/src/test/resources/META-INF/test-persistence.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/test/resources/META-INF/test-persistence.xml b/launchers/marmotta-webapp/src/test/resources/META-INF/test-persistence.xml
new file mode 100644
index 0000000..a5e7216
--- /dev/null
+++ b/launchers/marmotta-webapp/src/test/resources/META-INF/test-persistence.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ 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.
+ -->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+
+ <!--
+
+ resources/META-INF/persistence.xml.tmpl should be the only place you change anything
+ any of persistence.*.xml. After changing it, "ant configure"
+ copies it to all places it is needed.
+
+ -->
+
+ <persistence-unit name="KiWi" transaction-type="RESOURCE_LOCAL">
+
+ <class>kiwi.core.model.rdf.KiWiNode</class>
+ <class>kiwi.core.model.rdf.KiWiResource</class>
+ <class>kiwi.core.model.rdf.KiWiUriResource</class>
+ <class>kiwi.core.model.rdf.KiWiAnonResource</class>
+ <class>kiwi.core.model.rdf.KiWiLiteral</class>
+ <class>kiwi.core.model.rdf.KiWiStringLiteral</class>
+ <class>kiwi.core.model.rdf.KiWiIntLiteral</class>
+ <class>kiwi.core.model.rdf.KiWiDoubleLiteral</class>
+ <class>kiwi.core.model.rdf.KiWiTextContentLiteral</class>
+ <class>kiwi.core.model.rdf.KiWiMediaContentLiteral</class>
+
+ <class>kiwi.core.model.rdf.KiWiNamespace</class>
+ <class>kiwi.core.model.rdf.KiWiTriple</class>
+
+ <class>at.newmedialab.lmf.user.model.UserAccount</class>
+ <!--<class>kiwi.core.model.user.KiWiUser</class>-->
+ <!--<class>kiwi.core.model.user.KiWiGroup</class>-->
+ <!--<class>kiwi.core.model.user.Role</class>-->
+
+ <class>at.newmedialab.lmf.versioning.model.Version</class>
+
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
+ <property name="javax.persistence.jdbc.user" value="sa"/>
+ <property name="javax.persistence.jdbc.password" value="sa"/>
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:/tmp/kiwi-test/db/kiwi2;MVCC=true;DB_CLOSE_ON_EXIT=FALSE"/>
+
+
+ <!-- valid values are validate, update, create, create-drop -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="false"/>
+ <property name="hibernate.format_sql" value="true"/>
+ <property name="hibernate.jdbc.fetch_size" value="30"/>
+ <property name="hibernate.jdbc.batch_size" value="30"/>
+ <property name="hibernate.default_batch_fetch_size" value="16" />
+ <property name="hibernate.max_fetch_depth" value="3" />
+
+ <!-- Without this statement seem Hibernate to come to "Cannot open connection" state at peak times (e.g. test) -->
+ <property name="hibernate.connection.release_mode" value="after_statement" />
+
+ <!-- caching -->
+ <property name="hibernate.cache.region.factory_class"
+ value="net.sf.ehcache.hibernate.EhCacheRegionFactory"/>
+ <property name="hibernate.cache.use_query_cache" value="true" />
+ <property name="hibernate.cache.use_second_level_cache" value="true"/>
+ <property name="hibernate.cache.region_prefix" value=""/>
+ </properties>
+ </persistence-unit>
+</persistence>