incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1215232 - in /incubator/accumulo/branches/1.4: ./ docs/ src/core/src/main/java/org/apache/accumulo/core/conf/ src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ src/server/src/main/java/org/apache/accumulo/server/monitor/...
Date Fri, 16 Dec 2011 17:56:28 GMT
Author: billie
Date: Fri Dec 16 17:56:28 2011
New Revision: 1215232

URL: http://svn.apache.org/viewvc?rev=1215232&view=rev
Log:
ACCUMULO-224 added optional banner to monitor page configured with monitor.banner.* parameters

Modified:
    incubator/accumulo/branches/1.4/   (props changed)
    incubator/accumulo/branches/1.4/docs/config.html
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/conf/Property.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
    incubator/accumulo/branches/1.4/src/server/src/main/resources/web/screen.css

Propchange: incubator/accumulo/branches/1.4/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Dec 16 17:56:28 2011
@@ -1,7 +1,6 @@
 logs
 walogs
 target
-
 .project
-
 .settings
+.pydevproject

Modified: incubator/accumulo/branches/1.4/docs/config.html
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/docs/config.html?rev=1215232&r1=1215231&r2=1215232&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/docs/config.html (original)
+++ incubator/accumulo/branches/1.4/docs/config.html Fri Dec 16 17:56:28 2011
@@ -618,13 +618,34 @@ $HADOOP_HOME/lib/[^.].*.jar,
    <tr><td colspan='5'><i>Properties in this category affect the behavior
of the monitor web server.</i></td></tr>
    <tr><th>Property</th><th>Type</th><th>Zookeeper Mutable</th><th>Default
Value</th><th>Description</th></tr>
    <tr class='highlight'>
+    <td>monitor.banner.background</td>
+    <td><b><a href='#STRING'>string</a></b></td>
+    <td>yes</td>
+    <td><pre>white</pre></td>
+    <td>The background color of the banner text displayed on the monitor page.</td>
+   </tr>
+   <tr >
+    <td>monitor.banner.color</td>
+    <td><b><a href='#STRING'>string</a></b></td>
+    <td>yes</td>
+    <td><pre>black</pre></td>
+    <td>The color of the banner text displayed on the monitor page.</td>
+   </tr>
+   <tr class='highlight'>
+    <td>monitor.banner.text</td>
+    <td><b><a href='#STRING'>string</a></b></td>
+    <td>yes</td>
+    <td><pre>&nbsp;</pre></td>
+    <td>The banner text displayed on the monitor page.</td>
+   </tr>
+   <tr >
     <td>monitor.port.client</td>
     <td><b><a href='#PORT'>port</a></b></td>
     <td>no</td>
     <td><pre>50095</pre></td>
     <td>The listening port for the monitor's http service</td>
    </tr>
-   <tr >
+   <tr class='highlight'>
     <td>monitor.port.log4j</td>
     <td><b><a href='#PORT'>port</a></b></td>
     <td>no</td>

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/conf/Property.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/conf/Property.java?rev=1215232&r1=1215231&r2=1215232&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/conf/Property.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/conf/Property.java
Fri Dec 16 17:56:28 2011
@@ -181,6 +181,9 @@ public enum Property {
   MONITOR_PREFIX("monitor.", null, PropertyType.PREFIX, "Properties in this category affect
the behavior of the monitor web server."),
   MONITOR_PORT("monitor.port.client", "50095", PropertyType.PORT, "The listening port for
the monitor's http service"),
   MONITOR_LOG4J_PORT("monitor.port.log4j", "4560", PropertyType.PORT, "The listening port
for the monitor's log4j logging collection."),
+  MONITOR_BANNER_TEXT("monitor.banner.text", "", PropertyType.STRING, "The banner text displayed
on the monitor page."),
+  MONITOR_BANNER_COLOR("monitor.banner.color", "black", PropertyType.STRING, "The color of
the banner text displayed on the monitor page."),
+  MONITOR_BANNER_BACKGROUND("monitor.banner.background", "white", PropertyType.STRING, "The
background color of the banner text displayed on the monitor page."),
   
   TRACE_PREFIX("trace.", null, PropertyType.PREFIX, "Properties in this category affect the
behavior of distributed tracing."),
   TRACE_PORT("trace.port.client", "12234", PropertyType.PORT, "The listening port for the
trace server"),
@@ -348,7 +351,8 @@ public enum Property {
   public static boolean isValidZooPropertyKey(String key) {
     // white list prefixes
     return key.startsWith(Property.TABLE_PREFIX.getKey()) || key.startsWith(Property.TSERV_PREFIX.getKey())
|| key.startsWith(Property.LOGGER_PREFIX.getKey())
-        || key.startsWith(Property.MASTER_PREFIX.getKey()) || key.startsWith(Property.GC_PREFIX.getKey());
+        || key.startsWith(Property.MASTER_PREFIX.getKey()) || key.startsWith(Property.GC_PREFIX.getKey())
+        || key.startsWith(Property.MONITOR_PREFIX.getKey() + "banner.");
   }
   
   public static Property getPropertyByKey(String key) {

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java?rev=1215232&r1=1215231&r2=1215232&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConfigCommand.java
Fri Dec 16 17:56:28 2011
@@ -33,8 +33,8 @@ import org.apache.accumulo.core.conf.Pro
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.util.BadArgumentException;
 import org.apache.accumulo.core.util.shell.Shell;
-import org.apache.accumulo.core.util.shell.Token;
 import org.apache.accumulo.core.util.shell.Shell.Command;
+import org.apache.accumulo.core.util.shell.Token;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionGroup;
@@ -104,7 +104,7 @@ public class ConfigCommand extends Comma
         Shell.log.debug("Successfully set table configuration option.");
       } else {
         if (!Property.isValidZooPropertyKey(property))
-          throw new BadArgumentException("Property cannot be modified in zookeepr", fullCommand,
fullCommand.indexOf(property));
+          throw new BadArgumentException("Property cannot be modified in zookeeper", fullCommand,
fullCommand.indexOf(property));
         
         shellState.getConnector().instanceOperations().setProperty(property, value);
         Shell.log.debug("Successfully set system configuration option");

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java?rev=1215232&r1=1215231&r2=1215232&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
Fri Dec 16 17:56:28 2011
@@ -32,7 +32,9 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.monitor.LogService;
 import org.apache.accumulo.server.monitor.Monitor;
 import org.apache.accumulo.server.util.time.SimpleTimer;
@@ -43,6 +45,9 @@ abstract public class BasicServlet exten
   private static final long serialVersionUID = 1L;
   protected static final Logger log = Logger.getLogger(BasicServlet.class);
   static String cachedInstanceName = null;
+  private String bannerText;
+  private String bannerColor;
+  private String bannerBackground;
   
   abstract protected String getTitle(HttpServletRequest req);
   
@@ -50,6 +55,9 @@ abstract public class BasicServlet exten
     StringBuilder sb = new StringBuilder();
     try {
       Monitor.fetchData();
+      bannerText = sanitize(ServerConfiguration.getSystemConfiguration().get(Property.MONITOR_BANNER_TEXT));
+      bannerColor = ServerConfiguration.getSystemConfiguration().get(Property.MONITOR_BANNER_COLOR).replace("'",
"&#39;");
+      bannerBackground = ServerConfiguration.getSystemConfiguration().get(Property.MONITOR_BANNER_BACKGROUND).replace("'",
"&#39;");
       pageStart(req, resp, sb);
       pageBody(req, resp, sb);
       pageEnd(req, resp, sb);
@@ -132,11 +140,19 @@ abstract public class BasicServlet exten
     sb.append("\n<body>\n");
     sb.append("<div id='content-wrapper'>\n");
     sb.append("<div id='content'>\n");
-    sb.append("<div id='header'><h1>").append(getTitle(req)).append("</h1></div>\n");
+    sb.append("<div id='header'>");
+    if (!bannerText.isEmpty()) {
+      sb.append("<div id='banner' style='color:").append(bannerColor).append(";background:").append(bannerBackground).append("'>").append(bannerText)
+          .append("</div>\n");
+    }
+    sb.append("<div id='headertitle'>");
+    sb.append("<h1>").append(getTitle(req)).append("</h1></div>\n");
     sb.append("<div id='subheader'>Instance&nbsp;Name:&nbsp;").append(cachedInstanceName).append("&nbsp;&nbsp;&nbsp;Version:&nbsp;").append(Constants.VERSION)
         .append("\n");
     sb.append("<br><span class='smalltext'>Instance&nbsp;ID:&nbsp;").append(HdfsZooInstance.getInstance().getInstanceID()).append("</span>\n");
-    sb.append("<br><span class='smalltext'>").append(new Date().toString().replace("
", "&nbsp;")).append("</span></div>\n");
+    sb.append("<br><span class='smalltext'>").append(new Date().toString().replace("
", "&nbsp;")).append("</span>");
+    sb.append("</div>\n"); // end <div id='subheader'>
+    sb.append("</div>\n"); // end <div id='header'>
     
     // BEGIN LEFT SIDE
     sb.append("<div id='nav'>\n");
@@ -162,7 +178,10 @@ abstract public class BasicServlet exten
     sb.append(refresh < 1 ? "en" : "dis").append("able&nbsp;auto-refresh</a>]</div>\n");
     sb.append("</div>\n"); // end <div id='nav'>
     
-    sb.append("<div id='main'>\n");
+    sb.append("<div id='main'");
+    if (bannerText.isEmpty())
+      sb.append(" style='bottom:0'");
+    sb.append(">\n");
     sb.append("<!-- BEGIN MAIN BODY CONTENT -->\n\n");
   }
   
@@ -177,6 +196,10 @@ abstract public class BasicServlet exten
     // BEGIN FOOTER
     sb.append("</div>\n"); // end <div id='content'>
     sb.append("</div>\n"); // end <div id='content-wrapper'>
+    if (!bannerText.isEmpty()) {
+      sb.append("<div id='footer' style='color:").append(bannerColor).append(";background:").append(bannerBackground).append("'>").append(bannerText)
+          .append("</div>\n");
+    }
     sb.append("</body>\n");
     sb.append("</html>\n");
   }

Modified: incubator/accumulo/branches/1.4/src/server/src/main/resources/web/screen.css
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/resources/web/screen.css?rev=1215232&r1=1215231&r2=1215232&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/resources/web/screen.css (original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/resources/web/screen.css Fri Dec 16
17:56:28 2011
@@ -52,17 +52,37 @@ html,body {
 	height: 8.0em;
 	color: #c4c4c4;
 	background-color: #304065;
+	text-align: center;
+}
+
+#banner {
+	height: 1.5em;
+	font-size: 1.0em;
+}
+
+#headertitle {
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
 }
 
 #subheader {
 	position: absolute;
-	top: 4.5em;
+	bottom: 0;
 	left: 0;
 	right: 0;
-	color: #c4c4c4;
 	font-size: .92em;
-	text-align: center;
+}
+
+#footer {
+	position: absolute;
+	bottom: 0;
+	left: 0;
 	right: 0;
+	padding: 0;
+	height: 1.5em;
+	font-size: 1.0em;
 }
 
 #main {
@@ -70,7 +90,7 @@ html,body {
 	top: 8.0em;
 	left: 11em;
 	right: 0;
-	bottom: 0;
+	bottom: 1.5em;
 	padding: 0.6em;
 	overflow: scroll;
 }



Mime
View raw message