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:23 UTC
[9/51] [abbrv] reorganized repository
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html
new file mode 100644
index 0000000..28ef3f0
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/skosjs-extension/test.html
@@ -0,0 +1,33 @@
+<!--
+
+ 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.
+
+-->
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title></title>
+ <script type="text/javascript">
+ var x = location.href.substring(0,location.href.indexOf("LMF/")); alert(x);
+ </script>
+</head>
+<body>
+
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp
new file mode 100644
index 0000000..f446b13
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/_info.jsp
@@ -0,0 +1,121 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%--
+ ~ 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.lucene.LucenePackage,
+ org.apache.solr.common.util.XML,
+ org.apache.solr.core.SolrConfig,
+ org.apache.solr.core.SolrCore"%>
+<%@ page import="org.apache.solr.schema.IndexSchema"%>
+<%@ page import="java.io.File"%>
+<%@ page import="java.io.StringWriter"%>
+<%@ page import="java.net.InetAddress"%>
+<%@ page import="java.net.UnknownHostException"%>
+
+<%!
+ // only try to figure out the hostname once in a static block so
+ // we don't have a potentially slow DNS lookup on every admin request
+ static InetAddress addr = null;
+ static String hostname = "unknown";
+ static {
+ try {
+ addr = InetAddress.getLocalHost();
+ hostname = addr.getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ //default to unknown
+ }
+ }
+%>
+
+<%
+ //
+ SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore");
+ if (core == null) {
+ response.sendError( 404, "missing core name in path" );
+ return;
+ }
+
+ SolrConfig solrConfig = core.getSolrConfig();
+ int port = request.getServerPort();
+ IndexSchema schema = core.getSchema();
+
+ // enabled/disabled is purely from the point of a load-balancer
+ // and has no effect on local server function. If there is no healthcheck
+ // configured, don't put any status on the admin pages.
+ String enabledStatus = null;
+ String enabledFile = solrConfig.get("admin/healthcheck/text()",null);
+ boolean isEnabled = false;
+ if (enabledFile!=null) {
+ isEnabled = new File(enabledFile).exists();
+ }
+
+ String collectionName = schema!=null ? schema.getName():"unknown";
+
+ String defaultSearch = "";
+ {
+ StringWriter tmp = new StringWriter();
+ XML.escapeCharData
+ (solrConfig.get("admin/defaultQuery/text()", ""), tmp);
+ defaultSearch = tmp.toString();
+ }
+
+ String solrImplVersion = "";
+ String solrSpecVersion = "";
+ String luceneImplVersion = "";
+ String luceneSpecVersion = "";
+
+ {
+ Package p;
+ StringWriter tmp;
+
+ p = SolrCore.class.getPackage();
+
+ tmp = new StringWriter();
+ solrImplVersion = p.getImplementationVersion();
+ if (null != solrImplVersion) {
+ XML.escapeCharData(solrImplVersion, tmp);
+ solrImplVersion = tmp.toString();
+ }
+ tmp = new StringWriter();
+ solrSpecVersion = p.getSpecificationVersion() ;
+ if (null != solrSpecVersion) {
+ XML.escapeCharData(solrSpecVersion, tmp);
+ solrSpecVersion = tmp.toString();
+ }
+
+ p = LucenePackage.class.getPackage();
+
+ tmp = new StringWriter();
+ luceneImplVersion = p.getImplementationVersion();
+ if (null != luceneImplVersion) {
+ XML.escapeCharData(luceneImplVersion, tmp);
+ luceneImplVersion = tmp.toString();
+ }
+ tmp = new StringWriter();
+ luceneSpecVersion = p.getSpecificationVersion() ;
+ if (null != luceneSpecVersion) {
+ XML.escapeCharData(luceneSpecVersion, tmp);
+ luceneSpecVersion = tmp.toString();
+ }
+ }
+
+ String cwd=System.getProperty("user.dir");
+ String solrHome= solrConfig.getInstanceDir();
+
+ boolean cachingEnabled = !solrConfig.getHttpCachingConfig().isNever304();
+%>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp
new file mode 100644
index 0000000..d6b12b5
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/action.jsp
@@ -0,0 +1,90 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ 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.
+ --%>
+<%@include file="header.jsp" %>
+<%
+
+ String action = request.getParameter("action");
+ String enableActionStatus = "";
+ boolean isValid = false;
+
+ if (action != null) {
+ // Validate fname
+ if ("Enable".compareTo(action) == 0) isValid = true;
+ if ("Disable".compareTo(action) == 0) isValid = true;
+ }
+ if (isValid) {
+ if ("Enable".compareTo(action) == 0) {
+ try {
+ File enableFile = new File(enabledFile);
+ if (enableFile.createNewFile()) {
+ enableActionStatus += "Enable Succeeded (enable file ";
+ enableActionStatus += enabledFile;
+ enableActionStatus += " created)";
+ } else {
+ enableActionStatus += "Already Enabled";
+ }
+ } catch(Exception e) {
+ enableActionStatus += "Enable Failed: " + e.toString();
+ }
+ }
+ if ("Disable".compareTo(action) == 0) {
+ try {
+ File enableFile = new File(enabledFile);
+ if (enableFile.delete()) {
+ enableActionStatus = "Disable Succeeded (enable file ";
+ enableActionStatus += enabledFile;
+ enableActionStatus += " removed)";
+ } else {
+ enableActionStatus = "Already Disabled";
+ }
+ } catch(Exception e) {
+ enableActionStatus += "Disable Failed: " + e.toString();
+ }
+ }
+ } else {
+ enableActionStatus = "Illegal Action";
+ }
+ // :TODO: might want to rework this so any logging change happens *after*
+ SolrCore.log.info(enableActionStatus);
+%>
+<br clear="all">
+<table>
+ <tr>
+ <td>
+ <H3>Action:</H3>
+ </td>
+ <td>
+ <% XML.escapeCharData(action, out); %><br>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <H4>Result:</H4>
+ </td>
+ <td>
+ <% XML.escapeCharData(enableActionStatus, out); %><br>
+ </td>
+ </tr>
+</table>
+<br><br>
+ <a href=".">Return to Admin Page</a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp
new file mode 100644
index 0000000..214082a
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.jsp
@@ -0,0 +1,505 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ 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="org.apache.lucene.analysis.Analyzer,org.apache.lucene.analysis.CharReader,org.apache.lucene.analysis.CharStream,org.apache.lucene.analysis.TokenStream,org.apache.lucene.analysis.tokenattributes.CharTermAttribute,org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute,org.apache.lucene.index.Payload,org.apache.lucene.util.Attribute,org.apache.lucene.util.AttributeReflector,org.apache.lucene.util.AttributeSource,org.apache.solr.analysis.CharFilterFactory,org.apache.solr.analysis.TokenFilterFactory,org.apache.solr.analysis.TokenizerChain,org.apache.solr.analysis.TokenizerFactory,org.apache.solr.schema.FieldType,org.apache.solr.schema.SchemaField,javax.servlet.jsp.JspWriter,java.io.IOException"%>
+<%@ page import="java.io.Reader,java.io.StringReader" %>
+<%@ page import="java.math.BigInteger"%>
+<%@ page import="java.util.*"%>
+
+<%-- ${symbol_dollar}Id: analysis.jsp 1061035 2011-01-19 22:33:28Z uschindler ${symbol_dollar} --%>
+<%-- ${symbol_dollar}Source: /cvs/main/searching/org.apache.solrolarServer/resources/admin/analysis.jsp,v ${symbol_dollar} --%>
+<%-- ${symbol_dollar}Name: ${symbol_dollar} --%>
+
+<%@include file="header.jsp"%>
+
+<%
+ // is name a field name or a type name?
+ String nt = request.getParameter("nt");
+ if (nt == null || nt.length() == 0)
+ nt = "name"; // assume field name
+ nt = nt.toLowerCase(Locale.ENGLISH).trim();
+ String name = request.getParameter("name");
+ if (name == null || name.length() == 0)
+ name = "";
+ String val = request.getParameter("val");
+ if (val == null || val.length() == 0)
+ val = "";
+ String qval = request.getParameter("qval");
+ if (qval == null || qval.length() == 0)
+ qval = "";
+ String verboseS = request.getParameter("verbose");
+ boolean verbose = verboseS != null
+ && verboseS.equalsIgnoreCase("on");
+ String qverboseS = request.getParameter("qverbose");
+ boolean qverbose = qverboseS != null
+ && qverboseS.equalsIgnoreCase("on");
+ String highlightS = request.getParameter("highlight");
+ boolean highlight = highlightS != null
+ && highlightS.equalsIgnoreCase("on");
+%>
+
+<br clear="all">
+
+<h2>Field Analysis</h2>
+
+<form method="POST" action="analysis.jsp" accept-charset="UTF-8">
+<table>
+ <tr>
+ <td><strong>Field <select name="nt">
+ <option <%=nt.equals("name") ? "selected=${symbol_escape}"selected${symbol_escape}"" : ""%>>name</option>
+ <option <%=nt.equals("type") ? "selected=${symbol_escape}"selected${symbol_escape}"" : ""%>>type</option>
+ </select></strong></td>
+ <td><input class="std" name="name" type="text"
+ value="<%XML.escapeCharData(name, out);%>"></td>
+ </tr>
+ <tr>
+ <td><strong>Field value (Index)</strong> <br />
+ verbose output <input name="verbose" type="checkbox"
+ <%=verbose ? "checked=${symbol_escape}"true${symbol_escape}"" : ""%>> <br />
+ highlight matches <input name="highlight" type="checkbox"
+ <%=highlight ? "checked=${symbol_escape}"true${symbol_escape}"" : ""%>></td>
+ <td><textarea class="std" rows="8" cols="70" name="val">
+ <%
+ XML.escapeCharData(val, out);
+ %>
+ </textarea></td>
+ </tr>
+ <tr>
+ <td><strong>Field value (Query)</strong> <br />
+ verbose output <input name="qverbose" type="checkbox"
+ <%=qverbose ? "checked=${symbol_escape}"true${symbol_escape}"" : ""%>></td>
+ <td><textarea class="std" rows="1" cols="70" name="qval">
+ <%
+ XML.escapeCharData(qval, out);
+ %>
+ </textarea></td>
+ </tr>
+ <tr>
+
+ <td></td>
+
+ <td><input class="stdbutton" type="submit" value="analyze">
+ </td>
+
+ </tr>
+</table>
+</form>
+
+
+<%
+ SchemaField field = null;
+
+ if (name != "") {
+ if (nt.equals("name")) {
+ try {
+ field = schema.getField(name);
+ } catch (Exception e) {
+ out.print("<strong>Unknown Field: ");
+ XML.escapeCharData(name, out);
+ out.println("</strong>");
+ }
+ } else {
+ FieldType t = schema.getFieldTypes().get(name);
+ if (null == t) {
+ out.print("<strong>Unknown Field Type: ");
+ XML.escapeCharData(name, out);
+ out.println("</strong>");
+ } else {
+ field = new SchemaField("fakefieldoftype:" + name, t);
+ }
+ }
+ }
+
+ if (field != null) {
+ HashSet<String> matches = null;
+ if (qval != "" && highlight) {
+ Reader reader = new StringReader(qval);
+ Analyzer analyzer = field.getType().getQueryAnalyzer();
+ TokenStream tstream = analyzer.reusableTokenStream(
+ field.getName(), reader);
+ CharTermAttribute termAtt = tstream
+ .addAttribute(CharTermAttribute.class);
+ tstream.reset();
+ matches = new HashSet<String>();
+ while (tstream.incrementToken()) {
+ matches.add(termAtt.toString());
+ }
+ }
+
+ if (val != "") {
+ out.println("<h3>Index Analyzer</h3>");
+ doAnalyzer(out, field, val, false, verbose, matches);
+ }
+ if (qval != "") {
+ out.println("<h3>Query Analyzer</h3>");
+ doAnalyzer(out, field, qval, true, qverbose, null);
+ }
+ }
+%>
+
+
+</body>
+</html>
+
+
+<%!private static void doAnalyzer(JspWriter out, SchemaField field,
+ String val, boolean queryAnalyser, boolean verbose,
+ Set<String> match) throws Exception {
+
+ FieldType ft = field.getType();
+ Analyzer analyzer = queryAnalyser ? ft.getQueryAnalyzer() : ft
+ .getAnalyzer();
+ if (analyzer instanceof TokenizerChain) {
+ TokenizerChain tchain = (TokenizerChain) analyzer;
+ CharFilterFactory[] cfiltfacs = tchain.getCharFilterFactories();
+ TokenizerFactory tfac = tchain.getTokenizerFactory();
+ TokenFilterFactory[] filtfacs = tchain.getTokenFilterFactories();
+
+ if (cfiltfacs != null) {
+ String source = val;
+ for (CharFilterFactory cfiltfac : cfiltfacs) {
+ CharStream reader = CharReader
+ .get(new StringReader(source));
+ reader = cfiltfac.create(reader);
+ if (verbose) {
+ writeHeader(out, cfiltfac.getClass(),
+ cfiltfac.getArgs());
+ source = writeCharStream(out, reader);
+ }
+ }
+ }
+
+ TokenStream tstream = tfac.create(tchain
+ .charStream(new StringReader(val)));
+ List<AttributeSource> tokens = getTokens(tstream);
+ if (verbose) {
+ writeHeader(out, tfac.getClass(), tfac.getArgs());
+ }
+
+ writeTokens(out, tokens, ft, verbose, match);
+
+ for (TokenFilterFactory filtfac : filtfacs) {
+ if (verbose) {
+ writeHeader(out, filtfac.getClass(), filtfac.getArgs());
+ }
+
+ final Iterator<AttributeSource> iter = tokens.iterator();
+ tstream = filtfac.create(new TokenStream(tstream
+ .getAttributeFactory()) {
+
+ public boolean incrementToken() throws IOException {
+ if (iter.hasNext()) {
+ AttributeSource token = iter.next();
+ Iterator<Class<? extends Attribute>> atts = token
+ .getAttributeClassesIterator();
+ while (atts.hasNext())
+ // make sure all att impls in the token exist here
+ addAttribute(atts.next());
+ token.copyTo(this);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ });
+ tokens = getTokens(tstream);
+
+ writeTokens(out, tokens, ft, verbose, match);
+ }
+
+ } else {
+ TokenStream tstream = analyzer.reusableTokenStream(field.getName(),
+ new StringReader(val));
+ tstream.reset();
+ List<AttributeSource> tokens = getTokens(tstream);
+ if (verbose) {
+ writeHeader(out, analyzer.getClass(), Collections.EMPTY_MAP);
+ }
+ writeTokens(out, tokens, ft, verbose, match);
+ }
+ }
+
+ static List<AttributeSource> getTokens(TokenStream tstream)
+ throws IOException {
+ List<AttributeSource> tokens = new ArrayList<AttributeSource>();
+ tstream.reset();
+ while (tstream.incrementToken()) {
+ tokens.add(tstream.cloneAttributes());
+ }
+ return tokens;
+ }
+
+ private static class ReflectItem {
+ final Class<? extends Attribute> attClass;
+ final String key;
+ final Object value;
+
+ ReflectItem(Class<? extends Attribute> attClass, String key,
+ Object value) {
+ this.attClass = attClass;
+ this.key = key;
+ this.value = value;
+ }
+ }
+
+ private static class Tok {
+ final String term;
+ final int pos;
+ final List<ReflectItem> reflected = new ArrayList<ReflectItem>();
+
+ Tok(AttributeSource token, int pos) {
+ this.term = token.addAttribute(CharTermAttribute.class).toString();
+ this.pos = pos;
+ token.reflectWith(new AttributeReflector() {
+ public void reflect(Class<? extends Attribute> attClass,
+ String key, Object value) {
+ // leave out position and term
+ if (CharTermAttribute.class.isAssignableFrom(attClass))
+ return;
+ if (PositionIncrementAttribute.class
+ .isAssignableFrom(attClass))
+ return;
+ reflected.add(new ReflectItem(attClass, key, value));
+ }
+ });
+ }
+ }
+
+ private static interface TokToStr {
+ public String toStr(Tok o);
+ }
+
+ private static void printRow(JspWriter out, String header,
+ String headerTitle, List<Tok>[] arrLst, TokToStr converter,
+ boolean multival, boolean verbose, Set<String> match)
+ throws IOException {
+ // find the maximum number of terms for any position
+ int maxSz = 1;
+ if (multival) {
+ for (List lst : arrLst) {
+ maxSz = Math.max(lst.size(), maxSz);
+ }
+ }
+
+ for (int idx = 0; idx < maxSz; idx++) {
+ out.println("<tr>");
+ if (idx == 0 && verbose) {
+ if (header != null) {
+ out.print("<th NOWRAP rowspan=${symbol_escape}"" + maxSz + "${symbol_escape}"");
+ if (headerTitle != null) {
+ out.print(" title=${symbol_escape}"");
+ XML.escapeCharData(headerTitle, out);
+ out.print("${symbol_escape}"");
+ }
+ out.print(">");
+ XML.escapeCharData(header, out);
+ out.println("</th>");
+ }
+ }
+
+ for (int posIndex = 0; posIndex < arrLst.length; posIndex++) {
+ List<Tok> lst = arrLst[posIndex];
+ if (lst.size() <= idx)
+ continue;
+ if (match != null && match.contains(lst.get(idx).term)) {
+ out.print("<td class=${symbol_escape}"highlight${symbol_escape}"");
+ } else {
+ out.print("<td class=${symbol_escape}"debugdata${symbol_escape}"");
+ }
+
+ // if the last value in the column, use up
+ // the rest of the space via rowspan.
+ if (lst.size() == idx + 1 && lst.size() < maxSz) {
+ out.print("rowspan=${symbol_escape}"" + (maxSz - lst.size() + 1) + '"');
+ }
+
+ out.print('>');
+
+ XML.escapeCharData(converter.toStr(lst.get(idx)), out);
+ out.print("</td>");
+ }
+
+ out.println("</tr>");
+ }
+
+ }
+
+ /* this method is totally broken, as no charset involved: new String(byte[]) is crap!
+ static String isPayloadString( Payload p ) {
+ String sp = new String(p.getData());
+ for( int i=0; i < sp.length(); i++ ) {
+ if( !Character.isDefined( sp.charAt(i) ) || Character.isISOControl( sp.charAt(i) ) )
+ return "";
+ }
+ return "(" + sp + ")";
+ }
+ */
+
+ static void writeHeader(JspWriter out, Class clazz, Map<String, String> args)
+ throws IOException {
+ out.print("<h4>");
+ out.print(clazz.getName());
+ XML.escapeCharData(" " + args, out);
+ out.println("</h4>");
+ }
+
+ // readable, raw, pos, type, start/end
+ static void writeTokens(JspWriter out, List<AttributeSource> tokens,
+ final FieldType ft, boolean verbose, Set<String> match)
+ throws IOException {
+
+ // Use a map to tell what tokens are in what positions
+ // because some tokenizers/filters may do funky stuff with
+ // very large increments, or negative increments.
+ HashMap<Integer, List<Tok>> map = new HashMap<Integer, List<Tok>>();
+ boolean needRaw = false;
+ int pos = 0, reflectionCount = -1;
+ for (AttributeSource t : tokens) {
+ String text = t.addAttribute(CharTermAttribute.class).toString();
+ if (!text.equals(ft.indexedToReadable(text))) {
+ needRaw = true;
+ }
+
+ pos += t.addAttribute(PositionIncrementAttribute.class)
+ .getPositionIncrement();
+ List lst = map.get(pos);
+ if (lst == null) {
+ lst = new ArrayList(1);
+ map.put(pos, lst);
+ }
+ Tok tok = new Tok(t, pos);
+ // sanity check
+ if (reflectionCount < 0) {
+ reflectionCount = tok.reflected.size();
+ } else {
+ if (reflectionCount != tok.reflected.size())
+ throw new RuntimeException(
+ "Should not happen: Number of reflected entries differs for position="
+ + pos);
+ }
+ lst.add(tok);
+ }
+
+ List<Tok>[] arr = (List<Tok>[]) map.values().toArray(
+ new ArrayList[map.size()]);
+
+ // Jetty 6.1.3 miscompiles a generics-enabled version..., without generics:
+ Arrays.sort(arr, new Comparator() {
+ public int compare(Object toks, Object toks1) {
+ return ((List<Tok>) toks).get(0).pos
+ - ((List<Tok>) toks1).get(0).pos;
+ }
+ });
+
+ out.println("<table width=${symbol_escape}"auto${symbol_escape}" class=${symbol_escape}"analysis${symbol_escape}" border=${symbol_escape}"1${symbol_escape}">");
+
+ if (verbose) {
+ printRow(out, "position", "calculated from "
+ + PositionIncrementAttribute.class.getName(), arr,
+ new TokToStr() {
+ public String toStr(Tok t) {
+ return Integer.toString(t.pos);
+ }
+ }, false, verbose, null);
+ }
+
+ printRow(out, "term text", CharTermAttribute.class.getName(), arr,
+ new TokToStr() {
+ public String toStr(Tok t) {
+ return ft.indexedToReadable(t.term);
+ }
+ }, true, verbose, match);
+
+ if (verbose) {
+ if (needRaw) {
+ printRow(out, "raw text", CharTermAttribute.class.getName(),
+ arr, new TokToStr() {
+ public String toStr(Tok t) {
+ // page is UTF-8, so anything goes.
+ return t.term;
+ }
+ }, true, verbose, match);
+ }
+
+ for (int att = 0; att < reflectionCount; att++) {
+ final ReflectItem item0 = arr[0].get(0).reflected.get(att);
+ final int i = att;
+ printRow(out, item0.key, item0.attClass.getName(), arr,
+ new TokToStr() {
+ public String toStr(Tok t) {
+ final ReflectItem item = t.reflected.get(i);
+ if (item0.attClass != item.attClass
+ || !item0.key.equals(item.key))
+ throw new RuntimeException(
+ "Should not happen: attribute types suddenly change at position="
+ + t.pos);
+ if (item.value instanceof Payload) {
+ Payload p = (Payload) item.value;
+ if (null != p) {
+ BigInteger bi = new BigInteger(p
+ .getData());
+ String ret = bi.toString(16);
+ if (ret.length() % 2 != 0) {
+ // Pad with 0
+ ret = "0" + ret;
+ }
+ //TODO maybe fix: ret += isPayloadString(p);
+ return ret;
+ }
+ return "";
+ } else {
+ return (item.value != null) ? item.value
+ .toString() : "";
+ }
+ }
+ }, true, verbose, null);
+ }
+ }
+
+ out.println("</table>");
+ }
+
+ static String writeCharStream(JspWriter out, CharStream input)
+ throws IOException {
+ out.println("<table width=${symbol_escape}"auto${symbol_escape}" class=${symbol_escape}"analysis${symbol_escape}" border=${symbol_escape}"1${symbol_escape}">");
+ out.println("<tr>");
+
+ out.print("<th NOWRAP>");
+ XML.escapeCharData("text", out);
+ out.println("</th>");
+
+ final int BUFFER_SIZE = 1024;
+ char[] buf = new char[BUFFER_SIZE];
+ int len = 0;
+ StringBuilder sb = new StringBuilder();
+ do {
+ len = input.read(buf, 0, BUFFER_SIZE);
+ if (len > 0)
+ sb.append(buf, 0, len);
+ } while (len == BUFFER_SIZE);
+ out.print("<td class=${symbol_escape}"debugdata${symbol_escape}">");
+ XML.escapeCharData(sb.toString(), out);
+ out.println("</td>");
+
+ out.println("</tr>");
+ out.println("</table>");
+ return sb.toString();
+ }%>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.xsl
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.xsl b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.xsl
new file mode 100644
index 0000000..da30f98
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/analysis.xsl
@@ -0,0 +1,179 @@
+<?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>
+ <div style="margin-top: 1em;">
+ <h2>Field Analysis</h2>
+ <xsl:apply-templates/>
+ <a href=".">Return to Admin Page</a>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:include href="meta.xsl"/>
+
+ <xsl:template match="solr/analysis/form">
+ <form method="POST" action="analysis.jsp">
+ <table>
+ <tr>
+ <td>
+ <strong>Field name</strong>
+ </td>
+ <td>
+ <input class="std" name="name" type="text" value="{field}"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <strong>Field value (Index)</strong>
+ <br/>
+ verbose output <input name="verbose" type="checkbox" checked="true"/>
+ <br/>
+ highlight matches <input name="highlight" type="checkbox" checked="true"/>
+ </td>
+ <td>
+ <textarea class="std" rows="8" cols="70" name="val"><xsl:value-of select="fieldIndexValue" /></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <strong>Field value (Query)</strong>
+ <br/>
+ verbose output <input name="qverbose" type="checkbox" checked="true"/>
+ </td>
+ <td>
+ <textarea class="std" rows="1" cols="70" name="qval"><xsl:value-of select="fieldQueryValue" /></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ <input class="stdbutton" type="submit" value="analyze"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+</xsl:template>
+
+<xsl:template match="solr/analysis/results/indexAnalyzer">
+ <h4>Index Analyzer</h4>
+ <xsl:for-each select="factory">
+ <h5 style="margin-left: 1em;"><xsl:apply-templates select="@class"/></h5>
+ <xsl:apply-templates/>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="solr/analysis/results/indexAnalyzer/factory/args">
+ <div style="margin-left: 2em; font-weight: bold;">{
+ <xsl:for-each select="arg">
+ <xsl:apply-templates select="@name"/>=<xsl:value-of select="."/>,
+ </xsl:for-each>
+ }</div>
+</xsl:template>
+
+<xsl:template match="solr/analysis/results/indexAnalyzer/factory/tokens">
+<div style="margin-left: 2em;">
+ <table width="auto" class="analysis" border="1">
+ <tr>
+ <th>text</th>
+ <th>type</th>
+ <th>position</th>
+ <th>start</th>
+ <th>end</th>
+ </tr>
+ <xsl:for-each select="token">
+ <tr>
+ <td><xsl:value-of select="."/></td>
+ <td><xsl:apply-templates select="@type"/></td>
+ <td><xsl:apply-templates select="@pos"/></td>
+ <td><xsl:apply-templates select="@start"/></td>
+ <td><xsl:apply-templates select="@end"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+</div>
+</xsl:template>
+
+<xsl:template match="solr/analysis/results/queryAnalyzer">
+ <h4>Query Analyzer</h4>
+ <xsl:for-each select="factory">
+ <h5 style="margin-left: 1em;"><xsl:apply-templates select="@class"/></h5>
+ <xsl:apply-templates/>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="solr/analysis/results/queryAnalyzer/factory/args">
+ <div style="margin-left: 2em; font-weight: bold;">{
+ <xsl:for-each select="arg">
+ <xsl:apply-templates select="@name"/>=<xsl:value-of select="."/>,
+ </xsl:for-each>
+ }</div>
+</xsl:template>
+
+<xsl:template match="solr/analysis/results/queryAnalyzer/factory/tokens">
+<div style="margin-left: 2em;">
+ <table width="auto" class="analysis" border="1">
+ <tr>
+ <th>text</th>
+ <th>type</th>
+ <th>position</th>
+ <th>start</th>
+ <th>end</th>
+ </tr>
+ <xsl:for-each select="token">
+ <tr>
+ <td><xsl:value-of select="."/></td>
+ <td><xsl:apply-templates select="@type"/></td>
+ <td><xsl:apply-templates select="@pos"/></td>
+ <td><xsl:apply-templates select="@start"/></td>
+ <td><xsl:apply-templates select="@end"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+</div>
+</xsl:template>
+
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/dataimport.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/dataimport.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/dataimport.jsp
new file mode 100644
index 0000000..f3a1e7e
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/dataimport.jsp
@@ -0,0 +1,56 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ page import="org.apache.solr.request.SolrRequestHandler" %>
+<%@ page import="java.util.Map" %>
+<%@ 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.
+ --%>
+
+<%-- do a verbatim include so we can use the local vars --%>
+<%@include file="_info.jsp"%>
+<html>
+<%
+ String handler = request.getParameter("handler");
+
+ if (handler == null) {
+ Map<String, SolrRequestHandler> handlers = core.getRequestHandlers();
+%>
+<head>
+ <title>DataImportHandler Interactive Development</title>
+ <link rel="stylesheet" type="text/css" href="solr-admin.css">
+</head>
+<body>
+Select handler:
+<ul>
+<%
+ for (String key : handlers.keySet()) {
+ if (handlers.get(key).getClass().getName().equals("org.apache.solr.handler.dataimport.DataImportHandler")) { %>
+ <li><a href="dataimport.jsp?handler=<%=key%>"><%=key%></a></li>
+<%
+ }
+ }
+%>
+</ul>
+</body>
+<% } else { %>
+
+<frameset cols = "50%, 50%">
+ <frame src ="debug.jsp?handler=<%=handler%>" />
+ <frame src ="../select?qt=<%=handler%>&command=status" name="result"/>
+</frameset>
+<% } %>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/debug.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/debug.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/debug.jsp
new file mode 100644
index 0000000..8ff152f
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/debug.jsp
@@ -0,0 +1,109 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ 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.
+ --%>
+
+<%-- do a verbatim include so we can use the local vars --%>
+<%@include file="_info.jsp"%>
+<html>
+<head>
+<title>DataImportHandler Interactive Development</title>
+<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"/>
+<script src="jquery-1.4.3.min.js"></script>
+</head>
+<body>
+<h1>DataImportHandler Development Console</h1>
+<%
+ String handler = request.getParameter("handler"); // must be specified
+%>
+<form action="../select" target="result" method="get">
+<input type="hidden" name="debug" value="on"/>
+<input type="hidden" name="qt" value="<%=handler%>"/>
+<table>
+ <tr>
+ <th>Handler: </th>
+ <td><%=handler%> <a href="dataimport.jsp" target="_top">change handler</a></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table width="100%">
+ <tr>
+ <td>
+ <select name="command">
+ <option value="full-import" selected="selected">full-import</option>
+ <option value="delta-import">delta-import</option>
+ </select>
+ </td>
+ <td><strong>Verbose</strong> <input
+ name="verbose" type="checkbox"></td>
+ <td><strong>Commit</strong> <input
+ name="commit" type="checkbox"></td>
+ <td><strong>Clean</strong> <input
+ name="clean" type="checkbox"></td>
+ <td><strong>Start Row</strong> <input
+ name="start" size="4" type="text" value="0"></td>
+ <td><strong>No. of Rows</strong> <input name="rows"
+ type="text" size="4" value="10"></td>
+ </tr>
+ </table>
+ </td>
+ <tr>
+ <td><strong>data config xml</strong></td>
+ <td><input class="stdbutton" type="submit" value="debug now">
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><textarea id="txtDataConfig" rows="30" cols="80" name="dataConfig"></textarea></td>
+ <script type="text/javascript" language="javascript">
+ ${symbol_dollar}.get("../select?qt=<%=handler%>&command=show-config", function(data){
+ ${symbol_dollar}('${symbol_pound}txtDataConfig').attr('value', data);
+ });
+ </script>
+ </tr>
+</table>
+</form>
+<form action="../select" target="result" method="get">
+ <input type="hidden" name="clean" value="false">
+ <input type="hidden" name="commit" value="true">
+ <input type="hidden" name="qt" value="<%=handler%>"/>
+ <input class="stdbutton" type="submit" name="command" value="full-import">
+ <input class="stdbutton" type="submit" name="command" value="delta-import">
+ <input class="stdbutton" type="submit" name="command" value="status">
+ <input class="stdbutton" type="submit" name="command" value="reload-config">
+ <input class="stdbutton" type="submit" name="command" value="abort">
+</form>
+<form action="../select" target="result" method="get">
+ <input type="hidden" name="q" value="*:*">
+ <input type="hidden" name="start" value="0">
+ <input type="hidden" name="rows" value="0">
+ <input class="stdbutton" type="submit" value="Documents Count">
+</form>
+<form action="../select" target="result" method="get">
+ <input type="hidden" name="qt" value="<%=handler%>"/>
+ <input type="hidden" name="verbose" value="true">
+ <input type="hidden" name="clean" value="true">
+ <input type="hidden" name="commit" value="true">
+ <input type="hidden" name="command" value="full-import">
+ <input class="stdbutton" type="submit" value="Full Import with Cleaning">
+</form>
+
+<a href="index.jsp" target="_parent">Return to Admin Page</a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/distributiondump.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/distributiondump.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/distributiondump.jsp
new file mode 100644
index 0000000..fc37115
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/distributiondump.jsp
@@ -0,0 +1,156 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ 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.io.BufferedReader,
+ java.io.FileReader,
+ java.io.FilenameFilter"%>
+
+<%@include file="header.jsp" %>
+
+<%
+ File slaveinfo = new File(solrHome + "logs/snappuller.status");
+
+ StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer2 = new StringBuffer();
+ String mode = "";
+
+ if (slaveinfo.canRead()) {
+ // Slave instance
+ mode = "Slave";
+ File slavevers = new File(solrHome + "logs/snapshot.current");
+ BufferedReader inforeader = new BufferedReader(new FileReader(slaveinfo));
+ BufferedReader versreader = new BufferedReader(new FileReader(slavevers));
+ buffer.append("<tr>${symbol_escape}n" +
+ "<td>${symbol_escape}n" +
+ "Version:" +
+ "</td>${symbol_escape}n" +
+ "<td>${symbol_escape}n")
+ .append( versreader.readLine())
+ .append( "<td>${symbol_escape}n" +
+ "</td>${symbol_escape}n" +
+ "</tr>${symbol_escape}n" +
+ "<tr>${symbol_escape}n" +
+ "<td>${symbol_escape}n" +
+ "Status:" +
+ "</td>${symbol_escape}n" +
+ "<td>${symbol_escape}n")
+ .append( inforeader.readLine())
+ .append( "</td>${symbol_escape}n" +
+ "</tr>${symbol_escape}n");
+ } else {
+ // Master instance
+ mode = "Master";
+ File masterdir = new File(solrHome + "logs/clients");
+ FilenameFilter sfilter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.startsWith("snapshot.status");
+ }
+ };
+ FilenameFilter cfilter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.startsWith("snapshot.current");
+ }
+ };
+ File[] clients = masterdir.listFiles(cfilter);
+ if (clients == null) {
+ buffer.append("<tr>${symbol_escape}n" +
+ "<td>${symbol_escape}n" +
+ "</td>${symbol_escape}n" +
+ "<td>${symbol_escape}n" +
+ "No distribution info present" +
+ "</td>${symbol_escape}n" +
+ "</tr>${symbol_escape}n");
+ } else {
+ buffer.append("<h4>Client Snapshot In Use:</h4>${symbol_escape}n" +
+ "<tr>${symbol_escape}n" +
+ "<th>${symbol_escape}n" +
+ "Client" +
+ "</th>${symbol_escape}n" +
+ "<th>${symbol_escape}n" +
+ "Version" +
+ "</th>${symbol_escape}n" +
+ "</tr>${symbol_escape}n");
+ int i = 0;
+ while (i < clients.length) {
+ String fileName=clients[i].toString();
+ int p=fileName.indexOf("snapshot.current");
+ String clientName=fileName.substring(p+17);
+ BufferedReader reader = new BufferedReader(new FileReader(clients[i]));
+ buffer.append("<tr>${symbol_escape}n" +
+ "<td>${symbol_escape}n" +
+ clientName +
+ "</td>${symbol_escape}n" +
+ "<td>${symbol_escape}n")
+ .append( reader.readLine())
+ .append( "</td>${symbol_escape}n" +
+ "</tr>${symbol_escape}n" +
+ "<tr>${symbol_escape}n" +
+ "</tr>${symbol_escape}n");
+ i++;
+ }
+ clients = masterdir.listFiles(sfilter);
+ if (clients!=null) {
+ buffer.append("</table>${symbol_escape}n" +
+ "<h4>Client Snapshot Distribution Status:</h4>${symbol_escape}n" +
+ "<table>${symbol_escape}n" +
+ "<tr>${symbol_escape}n" +
+ "<th>${symbol_escape}n" +
+ "Client" +
+ "</th>${symbol_escape}n" +
+ "<th>${symbol_escape}n" +
+ "Status" +
+ "</th>${symbol_escape}n" +
+ "</tr>${symbol_escape}n");
+ i = 0;
+ while (i < clients.length) {
+ String fileName=clients[i].toString();
+ int p=fileName.indexOf("snapshot.status");
+ String clientName=fileName.substring(p+16);
+ BufferedReader reader = new BufferedReader(new FileReader(clients[i]));
+ buffer.append("<tr>${symbol_escape}n" +
+ "<td>${symbol_escape}n" +
+ clientName +
+ "</td>${symbol_escape}n" +
+ "<td>${symbol_escape}n")
+ .append( reader.readLine())
+ .append( "</td>${symbol_escape}n" +
+ "</tr>${symbol_escape}n" +
+ "<tr>${symbol_escape}n" +
+ "</tr>${symbol_escape}n");
+ i++;
+ }
+ }
+ }
+ }
+%>
+
+
+<br clear="all">
+<h2>Distribution Info: <%= mode %> Server</h2>
+<br clear="all" />
+(<a href="http://wiki.apache.org/solr/CollectionDistribution">What Is This Page?</a>)
+<br clear="all" />
+<table>
+<%= buffer %>
+</table>
+<br><br>
+ <a href=".">Return to Admin Page</a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/favicon.ico
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/favicon.ico b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/favicon.ico
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/form.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/form.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/form.jsp
new file mode 100644
index 0000000..c5fff4a
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/form.jsp
@@ -0,0 +1,140 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ 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.
+ --%>
+<%@include file="header.jsp" %>
+
+<br clear="all">
+<form name="queryForm" method="GET" action="../select" accept-charset="UTF-8">
+<!-- these are good defaults to have if people bookmark the resulting
+ URLs, but they should not show up in the form since they are very
+ output type specific.
+ -->
+<input name="indent" type="hidden" value="on">
+<input name="version" type="hidden" value="2.2">
+
+<table>
+<tr>
+ <td>
+ <strong>Solr/Lucene Statement</strong>
+ </td>
+ <td>
+ <textarea rows="5" cols="60" name="q"><%= defaultSearch %></textarea>
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Filter Query</strong>
+ </td>
+ <td>
+ <textarea rows="2" cols="60" name="fq"></textarea>
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Start Row</strong>
+ </td>
+ <td>
+ <input name="start" type="text" value="0">
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Maximum Rows Returned</strong>
+ </td>
+ <td>
+ <input name="rows" type="text" value="10">
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Fields to Return</strong>
+ </td>
+ <td>
+ <input name="fl" type="text" value="*,score">
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Query Type</strong>
+ </td>
+ <td>
+ <input name="qt" type="text" value="standard">
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Output Type</strong>
+ </td>
+ <td>
+ <input name="wt" type="text" value="standard">
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Debug: enable</strong>
+ </td>
+ <td>
+ <input name="debugQuery" type="checkbox" >
+ <em><font size="-1"> Note: you may need to "view source" in your browser to see explain() correctly indented.</font></em>
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Debug: explain others</strong>
+ </td>
+ <td>
+ <input name="explainOther" type="text" >
+ <em><font size="-1"> Apply original query scoring to matches of this query to see how they compare.</font></em>
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Enable Highlighting</strong>
+ </td>
+ <td>
+ <input name="hl" type="checkbox" >
+ </td>
+</tr>
+<tr>
+ <td>
+ <strong>Fields to Highlight</strong>
+ </td>
+ <td>
+ <input name="hl.fl" type="text" >
+ </td>
+</tr>
+<tr>
+ <td>
+ </td>
+ <td>
+ <input class="stdbutton" type="submit" value="search" onclick="if (queryForm.q.value.length==0) { alert('no empty queries, please'); return false; } else { queryForm.submit(); } ">
+ </td>
+</tr>
+</table>
+</form>
+<br clear="all">
+<em>
+This form demonstrates the most common query options available for the
+built in Query Types. Please consult the Solr Wiki for additional
+Query Parameters.
+</em>
+
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-file.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-file.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-file.jsp
new file mode 100644
index 0000000..84f9546
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-file.jsp
@@ -0,0 +1,73 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ page contentType="text/plain; 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="org.apache.solr.core.SolrCore,
+ java.io.InputStream,
+ java.io.InputStreamReader,
+ java.io.Reader,
+ java.util.StringTokenizer,
+ java.util.logging.Logger"%>
+<%!
+ static Logger log = Logger.getLogger(SolrCore.class.getName());
+%>
+<%
+ // NOTE -- this file will be removed in a future release
+ log.warning("Using deprecated JSP: " + request.getRequestURL().append("?").append(request.getQueryString()) + " -- check the ShowFileRequestHandler" );
+
+ Object ocore = request.getAttribute("org.apache.solr.SolrCore");
+ SolrCore core = ocore instanceof SolrCore? (SolrCore) ocore : SolrCore.getSolrCore();
+ String fname = request.getParameter("file");
+ String optional = request.getParameter("optional");
+ String gettableFiles = core.getSolrConfig().get("admin/gettableFiles","");
+ StringTokenizer st = new StringTokenizer(gettableFiles);
+ InputStream is;
+ boolean isValid = false;
+ boolean isOptional = false;
+ if (fname != null) {
+ // Validate fname
+ while(st.hasMoreTokens()) {
+ if (st.nextToken().compareTo(fname) == 0) isValid = true;
+ }
+ }
+ if (optional!=null && optional.equalsIgnoreCase("y")) {
+ isOptional=true;
+ }
+ if (isValid) {
+ try {
+ is= core.getSolrConfig().openResource(fname);
+ Reader input = new InputStreamReader(is);
+ char[] buf = new char[4096];
+ while (true) {
+ int len = input.read(buf);
+ if (len<=0) break;
+ out.write(buf,0,len);
+ }
+ }
+ catch (RuntimeException re) {
+ if (!isOptional) {
+ throw re;
+ }
+ }
+ } else {
+ out.println("<ERROR>");
+ out.println("Permission denied for file "+ fname);
+ out.println("</ERROR>");
+ }
+%>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-properties.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-properties.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-properties.jsp
new file mode 100644
index 0000000..61a28a8
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/get-properties.jsp
@@ -0,0 +1,27 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ page contentType="text/plain;charset=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.
+ --%>
+<%
+ java.util.Enumeration e = System.getProperties().propertyNames();
+ while(e.hasMoreElements()) {
+ String prop = (String)e.nextElement();
+ out.println(prop + " = " + System.getProperty(prop));
+ }
+%>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/header.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/header.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/header.jsp
new file mode 100644
index 0000000..cf3ce78
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/header.jsp
@@ -0,0 +1,47 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ 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.
+ --%>
+<html>
+<head>
+<%
+request.setCharacterEncoding("UTF-8");
+%>
+<%@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>
+<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
+<title>Solr admin page</title>
+</head>
+
+<body>
+<a href="."><img border="0" align="right" height="78" width="142" src="solr_small.png" alt="Solr"></a>
+<h1>Solr Admin (<%= collectionName %>)
+<%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1>
+
+<%= hostname %>:<%= port %><br/>
+cwd=<%= cwd %> SolrHome=<%= solrHome %>
+<br/>
+<%String cachingStatus = " HTTP caching is "; %>
+<%= cachingEnabled ? cachingStatus + " ON": cachingStatus + " OFF" %>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/75439f3a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/index.jsp
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/index.jsp b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/index.jsp
new file mode 100644
index 0000000..1a405e7
--- /dev/null
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/solr/admin/index.jsp
@@ -0,0 +1,162 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<%@ 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.
+ --%>
+
+<%-- ${symbol_dollar}Id: index.jsp 1064402 2011-01-28 01:12:39Z hossman ${symbol_dollar} --%>
+<%-- ${symbol_dollar}Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v ${symbol_dollar} --%>
+<%-- ${symbol_dollar}Name: ${symbol_dollar} --%>
+
+<%@ page import="org.apache.solr.handler.ReplicationHandler" %>
+<%@ page import="java.util.Collection" %>
+<%@ page import="java.util.Date" %>
+
+<%-- jsp:include page="header.jsp"/ --%>
+<%-- do a verbatim include so we can use the local vars --%>
+<%@include file="header.jsp" %>
+<%boolean replicationhandler = !core.getRequestHandlers(ReplicationHandler.class).isEmpty();%>
+<br clear="all">
+<table>
+
+<tr>
+ <td>
+ <h3>Solr</h3>
+ </td>
+ <td>
+ <% if (null != core.getSchemaResource()) { %>
+ [<a href="file/?contentType=text/xml;charset=utf-8&file=<%=core.getSchemaResource()%>">Schema</a>]
+ <% }
+ if (null != core.getConfigResource()) { %>
+ [<a href="file/?contentType=text/xml;charset=utf-8&file=<%=core.getConfigResource()%>">Config</a>]
+ <% } %>
+ [<a href="analysis.jsp?highlight=on">Analysis</a>]
+ [<a href="schema.jsp">Schema Browser</a>] <%if(replicationhandler){%>[<a href="replication/index.jsp">Replication</a>]<%}%>
+ <br>
+ [<a href="stats.jsp">Statistics</a>]
+ [<a href="registry.jsp">Info</a>]
+ [<a href="distributiondump.jsp">Distribution</a>]
+ [<a href="ping">Ping</a>]
+ [<a href="logging">Logging</a>]
+ </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><%
+ String url = request.getContextPath();
+ for (String name : names) {
+ String lname = name.length()==0 ? cores.getDefaultCoreName() : name; // use the real core name rather than the default
+ if(name.equals(core.getName())) {
+ %>[<%=lname%>]<%
+ } else {
+ %>[<a href="<%=url%>/<%=lname%>/admin/"><%=lname%></a>]<%
+ }
+ }%></td></tr><%
+}}%>
+
+<tr>
+ <td>
+ <strong>App server:</strong><br>
+ </td>
+ <td>
+ [<a href="get-properties.jsp">Java Properties</a>]
+ [<a href="threaddump.jsp">Thread Dump</a>]
+ <%
+ if (enabledFile!=null)
+ if (isEnabled) {
+ %>
+ [<a href="action.jsp?action=Disable">Disable</a>]
+ <%
+ } else {
+ %>
+ [<a href="action.jsp?action=Enable">Enable</a>]
+ <%
+ }
+ %>
+ </td>
+</tr>
+
+
+<%
+ // a quick hack to get rid of get-file.jsp -- note this still spits out invalid HTML
+ out.write( org.apache.solr.handler.admin.ShowFileRequestHandler.getFileContents( "admin-extra.html" ) );
+%>
+
+</table><P>
+
+
+<table>
+<tr>
+ <td>
+ <h3>Make a Query</h3>
+ </td>
+ <td>
+[<a href="form.jsp">Full Interface</a>]
+ </td>
+
+</tr>
+<tr>
+ <td>
+ Query String:
+ </td>
+ <td colspan=2>
+ <form name=queryForm method="GET" action="../select/" accept-charset="UTF-8">
+ <textarea class="std" rows="4" cols="40" name="q"><%= defaultSearch %></textarea>
+ <input name="version" type="hidden" value="2.2">
+ <input name="start" type="hidden" value="0">
+ <input name="rows" type="hidden" value="10">
+ <input name="indent" type="hidden" value="on">
+ <br><input class="stdbutton" type="submit" value="search"
+ onclick="if (queryForm.q.value.length==0) { alert('no empty queries, please'); return false; } else { queryForm.submit(); } ">
+ </form>
+ </td>
+</tr>
+</table><p>
+
+<table>
+<tr>
+ <td>
+ <h3>Assistance</h3>
+ </td>
+ <td>
+ [<a href="http://lucene.apache.org/solr/">Documentation</a>]
+ [<a href="http://issues.apache.org/jira/browse/SOLR">Issue Tracker</a>]
+ [<a href="mailto:solr-user@lucene.apache.org">Send Email</a>]
+ <br>
+ [<a href="http://wiki.apache.org/solr/SolrQuerySyntax">Solr Query Syntax</a>]
+ </td>
+</tr>
+<tr>
+ <td>
+ </td>
+ <td>
+ Current Time: <%= new Date() %>
+ </td>
+</tr>
+<tr>
+ <td>
+ </td>
+ <td>
+ Server Start At: <%= new Date(core.getStartTime()) %>
+ </td>
+</tr>
+</table>
+</body>
+</html>