You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2006/02/22 06:53:26 UTC

svn commit: r379696 - in /incubator/solr/trunk/src: java/org/apache/solr/core/ webapp/resources/admin/

Author: yonik
Date: Tue Feb 21 21:53:23 2006
New Revision: 379696

URL: http://svn.apache.org/viewcvs?rev=379696&view=rev
Log:
chaos => slightly less than chaos.  pulled out some common stuff into header.jsp, made healthcheck configurable, changed server start time to SolrCore creation time, removed some more CNET links

Added:
    incubator/solr/trunk/src/webapp/resources/admin/_info.jsp
    incubator/solr/trunk/src/webapp/resources/admin/header.jsp
Modified:
    incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
    incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp
    incubator/solr/trunk/src/webapp/resources/admin/form.jsp
    incubator/solr/trunk/src/webapp/resources/admin/get-file.jsp
    incubator/solr/trunk/src/webapp/resources/admin/index.jsp
    incubator/solr/trunk/src/webapp/resources/admin/registry.jsp
    incubator/solr/trunk/src/webapp/resources/admin/solar-status.jsp
    incubator/solr/trunk/src/webapp/resources/admin/stats.jsp
    incubator/solr/trunk/src/webapp/resources/admin/threaddump.jsp

Modified: incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java (original)
+++ incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java Tue Feb 21 21:53:23 2006
@@ -67,6 +67,9 @@
   private final String dataDir;
   private final String index_path;
   private final UpdateHandler updateHandler;
+  private static final long startTime = System.currentTimeMillis();
+
+  public long getStartTime() { return startTime; }
 
   public static SolrIndexConfig mainIndexConfig = new SolrIndexConfig("mainIndex");
 

Added: incubator/solr/trunk/src/webapp/resources/admin/_info.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/_info.jsp?rev=379696&view=auto
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/_info.jsp (added)
+++ incubator/solr/trunk/src/webapp/resources/admin/_info.jsp Tue Feb 21 21:53:23 2006
@@ -0,0 +1,28 @@
+<%@ page import="org.apache.solr.core.SolrConfig,
+                 org.apache.solr.core.SolrCore,
+                 org.apache.solr.schema.IndexSchema,
+                 java.io.File"%>
+<%@ page import="java.net.InetAddress"%>
+
+<%
+  SolrCore core = SolrCore.getSolrCore();
+  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.config.get("admin/healthcheck/text()",null);
+  boolean isEnabled = false;
+  if (enabledFile!=null) {
+    isEnabled = new File(enabledFile).exists();
+  }
+
+  String collectionName = schema!=null ? schema.getName():"unknown";
+  InetAddress addr = InetAddress.getLocalHost();
+  String hostname = addr.getCanonicalHostName();
+
+  String defaultSearch = SolrConfig.config.get("admin/defaultQuery/text()",null);
+  String cwd=System.getProperty("user.dir");
+%>

Modified: incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/analysis.jsp Tue Feb 21 21:53:23 2006
@@ -4,75 +4,20 @@
                  org.apache.solr.analysis.TokenFilterFactory,
                  org.apache.solr.analysis.TokenizerChain,
                  org.apache.solr.analysis.TokenizerFactory,
-                 org.apache.solr.core.SolrConfig,
-                 org.apache.solr.core.SolrCore,
                  org.apache.solr.schema.FieldType,
-                 org.apache.solr.schema.IndexSchema,org.apache.solr.schema.SchemaField
+                 org.apache.solr.schema.SchemaField,
+                 org.apache.solr.util.XML,
+                 javax.servlet.jsp.JspWriter,java.io.IOException
                 "%>
-<%@ page import="org.apache.solr.util.XML"%>
-<%@ page import="javax.servlet.jsp.JspWriter"%>
-<%@ page import="java.io.File"%>
-<%@ page import="java.io.IOException"%>
 <%@ page import="java.io.Reader"%>
 <%@ page import="java.io.StringReader"%>
-<%@ page import="java.net.InetAddress"%>
-<%@ page import="java.net.UnknownHostException"%>
 <%@ page import="java.util.*"%>
+
 <!-- $Id: analysis.jsp,v 1.2 2005/09/20 18:23:30 yonik Exp $ -->
 <!-- $Source: /cvs/main/searching/org.apache.solrolarServer/resources/admin/analysis.jsp,v $ -->
 <!-- $Name:  $ -->
 
-<%
-  SolrCore core = SolrCore.getSolrCore();
-  IndexSchema schema = core.getSchema();
-
-  String rootdir = "/var/opt/resin3/"+request.getServerPort();
-  File pidFile = new File(rootdir + "/logs/resin.pid");
-  File enableFile = new File(rootdir + "/logs/server-enabled");
-  boolean isEnabled = false;
-  String enabledStatus = "";
-  String enableActionStatus = "";
-  String makeEnabled = "";
-  String action = request.getParameter("action");
-  String startTime = "";
-
-  try {
-    startTime = (pidFile.lastModified() > 0)
-      ? new Date(pidFile.lastModified()).toString()
-      : "No Resin Pid found (logs/resin.pid)";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't open Solr pid file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-
-  try {
-    isEnabled = (enableFile.lastModified() > 0);
-    enabledStatus = (isEnabled)
-      ? "Enabled"
-      : "Disabled";
-    makeEnabled = (isEnabled)
-      ? "Disable"
-      : "Enable";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't check server-enabled file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  String collectionName = schema!=null ? schema.getName():"unknown";
-  String hostname="localhost";
-  String defaultSearch= SolrConfig.config.get("admin/defaultQuery","");
-  try {
-    InetAddress addr = InetAddress.getLocalHost();
-    // Get IP Address
-    byte[] ipAddr = addr.getAddress();
-    // Get hostname
-    // hostname = addr.getHostName();
-    hostname = addr.getCanonicalHostName();
-  } catch (UnknownHostException e) {}
-%>
+<%@include file="header.jsp" %>
 
 <%
   String name = request.getParameter("name");
@@ -89,21 +34,7 @@
   boolean highlight = highlightS!=null && highlightS.equalsIgnoreCase("on");
 %>
 
-
-<html>
-<head>
-<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 Interface</title>
-</head>
-
-<body>
-<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
-<h1>SOLR Interface (<%= collectionName %>) - <%= enabledStatus %></h1>
-<%= hostname %> : <%= request.getServerPort() %>
 <br clear="all">
-
 
 <h2>Field Analysis</h2>
 

Modified: incubator/solr/trunk/src/webapp/resources/admin/form.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/form.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/form.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/form.jsp Tue Feb 21 21:53:23 2006
@@ -1,103 +1,6 @@
-<%@ page import="org.apache.solr.core.SolrConfig,
-                 org.apache.solr.core.SolrCore,
-                 org.apache.solr.schema.IndexSchema,
-                 java.io.File
-"%>
-<%@ page import="java.net.InetAddress"%>
-<%@ page import="java.net.UnknownHostException"%>
-<%@ page import="java.util.Date"%>
-<!-- $Id: form.jsp,v 1.6 2005/09/16 21:45:54 yonik Exp $ -->
-<%
-  SolrCore core = SolrCore.getSolrCore();
-  Integer port = new Integer(request.getServerPort());
-  IndexSchema schema = core.getSchema();
+<%@include file="header.jsp" %>
 
-  String rootdir = "/var/opt/resin3/"+port.toString();
-  File pidFile = new File(rootdir + "/logs/resin.pid");
-  File enableFile = new File(rootdir + "/logs/server-enabled");
-  boolean isEnabled = false;
-  String enabledStatus = "";
-  String enableActionStatus = "";
-  String makeEnabled = "";
-  String action = request.getParameter("action");
-  String startTime = "";
-
-  try {
-    startTime = (pidFile.lastModified() > 0)
-      ? new Date(pidFile.lastModified()).toString()
-      : "No Resin Pid found (logs/resin.pid)";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't open Solr pid file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  try {
-    if (action != null) {
-      if ("Enable".compareTo(action) == 0) {
-        if (enableFile.createNewFile()) {
-          enableActionStatus += "Enable Succeeded";
-        } else {
-          enableActionStatus += "Already Enabled)";
-        }
-      }
-      if ("Disable".compareTo(action) == 0) {
-        if (enableFile.delete()) {
-          enableActionStatus = "Disable Succeeded";
-        } else {
-          enableActionStatus = "Already Disabled";
-        }
-      }
-    }
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't "+action+" server-enabled file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  try {
-    isEnabled = (enableFile.lastModified() > 0);
-    enabledStatus = (isEnabled)
-      ? "Enabled"
-      : "Disabled";
-    makeEnabled = (isEnabled)
-      ? "Disable"
-      : "Enable";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't check server-enabled file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  String collectionName = schema!=null ? schema.getName():"unknown";
-  String hostname="localhost";
-  String defaultSearch= SolrConfig.config.get("admin/defaultQuery","");
-  try {
-    InetAddress addr = InetAddress.getLocalHost();
-    // Get IP Address
-    byte[] ipAddr = addr.getAddress();
-    // Get hostname
-    // hostname = addr.getHostName();
-    hostname = addr.getCanonicalHostName();
-  } catch (UnknownHostException e) {}
-%>
-
-
-<html>
-<head>
-<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 Interface</title>
-</head>
-
-<body>
-<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
-<h1>SOLR Interface (<%= collectionName %>) - <%= enabledStatus %></h1>
-<%= hostname %> : <%= port.toString() %>
 <br clear="all">
-
-
 <h2>/select mode</h2>
 
 <form method="GET" action="../select">

Modified: incubator/solr/trunk/src/webapp/resources/admin/get-file.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/get-file.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/get-file.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/get-file.jsp Tue Feb 21 21:53:23 2006
@@ -1,6 +1,5 @@
 <%@ page import="org.apache.solr.core.Config,
                  org.apache.solr.core.SolrConfig,
-                 java.io.FileInputStream,
                  java.io.InputStream,
                  java.io.InputStreamReader,
                  java.io.Reader,

Added: incubator/solr/trunk/src/webapp/resources/admin/header.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/header.jsp?rev=379696&view=auto
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/header.jsp (added)
+++ incubator/solr/trunk/src/webapp/resources/admin/header.jsp Tue Feb 21 21:53:23 2006
@@ -0,0 +1,17 @@
+<%@include file="_info.jsp" %>
+
+<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>Solr admin page</title>
+</head>
+
+<body>
+<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="Solr"></a>
+<h1>Solr Admin (<%= collectionName %>)
+<%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1>
+
+<%= hostname %>:<%= port %><br/>
+<%= cwd %>
\ No newline at end of file

Modified: incubator/solr/trunk/src/webapp/resources/admin/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/index.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/index.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/index.jsp Tue Feb 21 21:53:23 2006
@@ -1,108 +1,18 @@
-<%@ page import="org.apache.solr.core.SolrConfig,
-                 org.apache.solr.core.SolrCore,
-                 org.apache.solr.schema.IndexSchema,
-                 java.io.File"%>
-<%@ page import="java.net.InetAddress"%>
-<%@ page import="java.net.UnknownHostException"%>
-<%@ page import="java.util.Date"%>
+
 <!-- $Id: index.jsp,v 1.26 2005/09/20 18:23:30 yonik Exp $ -->
 <!-- $Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v $ -->
 <!-- $Name:  $ -->
 
-<%
-  SolrCore core = SolrCore.getSolrCore();
-  Integer port = new Integer(request.getServerPort());
-  IndexSchema schema = core.getSchema();
-
-  String rootdir = "/var/opt/resin3/"+port.toString();
-  File pidFile = new File(rootdir + "/logs/resin.pid");
-  File enableFile = new File(rootdir + "/logs/server-enabled");
-  boolean isEnabled = false;
-  String enabledStatus = "";
-  String enableActionStatus = "";
-  String makeEnabled = "";
-  String action = request.getParameter("action");
-  String startTime = "";
-
-  try {
-    startTime = (pidFile.lastModified() > 0)
-      ? new Date(pidFile.lastModified()).toString()
-      : "No Resin Pid found (logs/resin.pid)";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't open Solr pid file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  try {
-    if (action != null) {
-      if ("Enable".compareTo(action) == 0) {
-        if (enableFile.createNewFile()) {
-          enableActionStatus += "Enable Succeeded";
-        } else {
-          enableActionStatus += "Already Enabled)";
-        }
-      }
-      if ("Disable".compareTo(action) == 0) {
-        if (enableFile.delete()) {
-          enableActionStatus = "Disable Succeeded";
-        } else {
-          enableActionStatus = "Already Disabled";
-        }
-      }
-    }
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't "+action+" server-enabled file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  try {
-    isEnabled = (enableFile.lastModified() > 0);
-    enabledStatus = (isEnabled)
-      ? "Enabled"
-      : "Disabled";
-    makeEnabled = (isEnabled)
-      ? "Disable"
-      : "Enable";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't check server-enabled file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  String collectionName = schema!=null ? schema.getName():"unknown";
-  String hostname="localhost";
-  String defaultSearch= SolrConfig.config.get("admin/defaultQuery","");
-  try {
-    InetAddress addr = InetAddress.getLocalHost();
-    // Get IP Address
-    byte[] ipAddr = addr.getAddress();
-    // Get hostname
-    // hostname = addr.getHostName();
-    hostname = addr.getCanonicalHostName();
-  } catch (UnknownHostException e) {}
-%>
-
-
-<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>SOLR admin page</title>
-</head>
-
-<body>
-<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
-<h1>SOLR Admin (<%= collectionName %>) - <%= enabledStatus %></h1>
-<%= hostname %> : <%= port.toString() %>
+<!-- jsp:include page="header.jsp"/ -->
+<!-- do a verbatim include so we can use the local vars -->
+<%@include file="header.jsp" %>
+
 <br clear="all">
 <table>
 
 <tr>
   <td>
-	<h3>SOLR</h3>
+	<h3>Solr</h3>
   </td>
   <td>
     [<a href="solar-status">Status</a>]
@@ -117,6 +27,7 @@
   </td>
 </tr>
 
+
 <tr>
   <td>
     <strong>App server:</strong><br>
@@ -125,6 +36,7 @@
     [<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>]
@@ -138,6 +50,7 @@
   </td>
 </tr>
 
+<!-- TODO: make it possible to add links to the admin page via solrconfig.xml
 <tr>
   <td>
 	<strong>Hardware:</strong><br>
@@ -148,6 +61,7 @@
 	[<a href="http://monitor.cnet.com/orca_mon/?mgroup=prob&hours=48&hostname=<%= hostname %>">Problems</a>]
   </td>
 </tr>
+-->
 
 </table><P>
 
@@ -203,14 +117,14 @@
   <td>
   </td>
   <td>
-  Current Time: <%= new Date().toString() %>
+  Current Time: <%= new Date() %>
   </td>
 </tr>
 <tr>
   <td>
   </td>
   <td>
-  Server Start At: <%= startTime %>
+  Server Start At: <%= new Date(core.getStartTime()) %>
   </td>
 </tr>
 </table>

Modified: incubator/solr/trunk/src/webapp/resources/admin/registry.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/registry.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/registry.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/registry.jsp Tue Feb 21 21:53:23 2006
@@ -1,59 +1,26 @@
-<%@ page import="org.apache.solr.core.SolrCore,
-                 org.apache.solr.core.SolrInfoMBean,
+<%@ page import="org.apache.solr.core.SolrInfoMBean,
                  org.apache.solr.core.SolrInfoRegistry,
-                 org.apache.solr.schema.IndexSchema,
-                 java.io.File,
-                 java.net.InetAddress,
-                 java.net.URL"%>
-<%@ page import="java.net.UnknownHostException"%>
-<%@ page import="java.util.Date"%>
-<%@ page import="java.util.Map"%>
+                 java.net.URL,
+                 java.util.Date,
+                 java.util.Map"%>
 
 <%@ page contentType="text/xml;charset=UTF-8" language="java" %>
 <?xml-stylesheet type="text/xsl" href="registry.xsl"?>
 
-<%
-  SolrCore core = SolrCore.getSolrCore();
-  IndexSchema schema = core.getSchema();
-  String collectionName = schema!=null ? schema.getName():"unknown";
-  Map<String, SolrInfoMBean> reg = SolrInfoRegistry.getRegistry();
-
-  String rootdir = "/var/opt/resin3/"+request.getServerPort();
-  File pidFile = new File(rootdir + "/logs/resin.pid");
-  String startTime = "";
-
-  try {
-    startTime = (pidFile.lastModified() > 0)
-                  ? new Date(pidFile.lastModified()).toString()
-                  : "No Resin Pid found (logs/resin.pid)";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't open Solr pid file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  String hostname="localhost";
-  try {
-    InetAddress addr = InetAddress.getLocalHost();
-    // Get IP Address
-    byte[] ipAddr = addr.getAddress();
-    // Get hostname
-    // hostname = addr.getHostName();
-    hostname = addr.getCanonicalHostName();
-  } catch (UnknownHostException e) {}
-%>
+<%@include file="_info.jsp" %>
 
 <solr>
   <schema><%= collectionName %></schema>
   <host><%= hostname %></host>
   <now><%= new Date().toString() %></now>
-  <start><%= startTime %></start>
+  <start><%= new Date(core.getStartTime()) %></start>
   <solr-info>
 <%
 for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
 %>
     <<%= cat.toString() %>>
 <%
+ Map<String, SolrInfoMBean> reg = SolrInfoRegistry.getRegistry();
  synchronized(reg) {
   for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
     String key = entry.getKey();

Modified: incubator/solr/trunk/src/webapp/resources/admin/solar-status.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/solar-status.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/solar-status.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/solar-status.jsp Tue Feb 21 21:53:23 2006
@@ -1,8 +1,3 @@
-<%@ page import="org.apache.solr.core.SolrCore,
-                 org.apache.solr.schema.IndexSchema,
-                 java.io.File,
-                 java.net.InetAddress,
-                 java.net.UnknownHostException"%>
 <%@ page import="java.util.Date"%>
 <%--
   Created by IntelliJ IDEA.
@@ -15,40 +10,13 @@
 
 <?xml-stylesheet type="text/xsl" href="status.xsl"?>
 
-<%
-  SolrCore core = SolrCore.getSolrCore();
-  IndexSchema schema = core.getSchema();
-  String collectionName = schema!=null ? schema.getName():"unknown";
+<%@include file="_info.jsp" %>
 
-  String rootdir = "/var/opt/resin3/"+request.getServerPort();
-  File pidFile = new File(rootdir + "/logs/resin.pid");
-  String startTime = "";
-
-  try {
-    startTime = (pidFile.lastModified() > 0)
-                   ? new Date(pidFile.lastModified()).toString()
-                   : "No Resin Pid found (logs/resin.pid)";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't open Solr pid file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  String hostname="localhost";
-  try {
-    InetAddress addr = InetAddress.getLocalHost();
-    // Get IP Address
-    byte[] ipAddr = addr.getAddress();
-    // Get hostname
-    // hostname = addr.getHostName();
-    hostname = addr.getCanonicalHostName();
-  } catch (UnknownHostException e) {}
-%>
 <solr>
   <schema><%= collectionName %></schema>
   <host><%= hostname %> : <%= request.getServerPort() %></host>
   <now><%= new Date().toString() %></now>
-  <start><%= startTime %></start>
+  <start><%= new Date(core.getStartTime()) %></start>
   <status>
     <cvsId><%= core.cvsId %></cvsId>
     <cvsSource><%= core.cvsSource %></cvsSource>

Modified: incubator/solr/trunk/src/webapp/resources/admin/stats.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/stats.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/stats.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/stats.jsp Tue Feb 21 21:53:23 2006
@@ -1,60 +1,26 @@
-<%@ page import="org.apache.solr.core.SolrCore,
-                 org.apache.solr.core.SolrInfoMBean,
+<%@ page import="org.apache.solr.core.SolrInfoMBean,
                  org.apache.solr.core.SolrInfoRegistry,
-                 org.apache.solr.schema.IndexSchema,
                  org.apache.solr.util.NamedList,
-                 java.io.File"%>
-<%@ page import="java.net.InetAddress"%>
-<%@ page import="java.net.UnknownHostException"%>
-<%@ page import="java.util.Date"%>
-<%@ page import="java.util.Map"%>
+                 java.util.Date,
+                 java.util.Map"%>
 
 <%@ page contentType="text/xml;charset=UTF-8" language="java" %>
 <?xml-stylesheet type="text/xsl" href="stats.xsl"?>
+<%@include file="_info.jsp" %>
 
-<%
-  SolrCore core = SolrCore.getSolrCore();
-  Integer port = new Integer(request.getServerPort());
-  IndexSchema schema = core.getSchema();
-  String collectionName = schema!=null ? schema.getName():"unknown";
-  Map<String, SolrInfoMBean> reg = SolrInfoRegistry.getRegistry();
-
-  String rootdir = "/var/opt/resin3/"+port.toString();
-  File pidFile = new File(rootdir + "/logs/resin.pid");
-  String startTime = "";
-
-  try {
-    startTime = (pidFile.lastModified() > 0)
-                  ? new Date(pidFile.lastModified()).toString()
-                  : "No Resin Pid found (logs/resin.pid)";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't open Solr pid file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  String hostname="localhost";
-  try {
-    InetAddress addr = InetAddress.getLocalHost();
-    // Get IP Address
-    byte[] ipAddr = addr.getAddress();
-    // Get hostname
-    // hostname = addr.getHostName();
-    hostname = addr.getCanonicalHostName();
-  } catch (UnknownHostException e) {}
-%>
 
 <solr>
   <schema><%= collectionName %></schema>
   <host><%= hostname %></host>
   <now><%= new Date().toString() %></now>
-  <start><%= startTime %></start>
+  <start><%= new Date(core.getStartTime()) %></start>
   <solr-info>
 <%
 for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
 %>
     <<%= cat.toString() %>>
 <%
+ Map<String,SolrInfoMBean> reg = SolrInfoRegistry.getRegistry();
  synchronized(reg) {
   for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
     String key = entry.getKey();

Modified: incubator/solr/trunk/src/webapp/resources/admin/threaddump.jsp
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/webapp/resources/admin/threaddump.jsp?rev=379696&r1=379695&r2=379696&view=diff
==============================================================================
--- incubator/solr/trunk/src/webapp/resources/admin/threaddump.jsp (original)
+++ incubator/solr/trunk/src/webapp/resources/admin/threaddump.jsp Tue Feb 21 21:53:23 2006
@@ -1,57 +1,13 @@
-<%@ page import="org.apache.solr.core.SolrCore,
-                 org.apache.solr.schema.IndexSchema,
-                 java.io.BufferedReader,
-                 java.io.File,
-                 java.io.FileReader,
-                 java.net.InetAddress,
-                 java.net.UnknownHostException,
-                 java.util.Date"%>
+<%@ page import="java.io.BufferedReader,
+                 java.io.FileReader"%>
+<%@include file="header.jsp" %>
 <%
-  SolrCore core = SolrCore.getSolrCore();
-  Integer port = new Integer(request.getServerPort());
-  IndexSchema schema = core.getSchema();
-  String collectionName = schema!=null ? schema.getName():"unknown";
-
-  String rootdir = "/var/opt/resin3/"+port.toString();
-  File pidFile = new File(rootdir + "/logs/resin.pid");
-  String startTime = "";
-
-  try {
-    startTime = (pidFile.lastModified() > 0)
-              ? new Date(pidFile.lastModified()).toString()
-                    : "No Resin Pid found (logs/resin.pid)";
-  } catch (Exception e) {
-    out.println("<ERROR>");
-    out.println("Couldn't open Solr pid file:" + e.toString());
-    out.println("</ERROR>");
-  }
-
-  String hostname="localhost";
-  try {
-    InetAddress addr = InetAddress.getLocalHost();
-    // Get IP Address
-    byte[] ipAddr = addr.getAddress();
-    // Get hostname
-    // hostname = addr.getHostName();
-    hostname = addr.getCanonicalHostName();
-  } catch (UnknownHostException e) {}
-
-  File getinfo = new File(rootdir + "/logs/jvm.log");
+  File getinfo = new File("logs/jvm.log");
 %>
-<html>
-<head>
-    <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">
-</head>
-<body>
-<a href="."><img border="0" align="right" height="88" width="215" src="solr-head.gif" alt="SOLR"></a>
-<h1>SOLR Thread Dump (<%= collectionName %>)</h1>
-<%= hostname %> : <%= port.toString() %>
 <br clear="all">
 <%
   Runtime rt = Runtime.getRuntime();
-  Process p = rt.exec(rootdir + "/getinfo");
+  Process p = rt.exec("./getinfo");
   p.waitFor();
 %>
 <table>