This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 93a4f0f  ACCUMULO-4786 Fix XML and JSON links in Monitor
93a4f0f is described below

commit 93a4f0fb5741a9c8686e0e74155d9e39ddb297dd
Author: Mike Miller <mmil...@apache.org>
AuthorDate: Thu Jan 18 13:22:53 2018 -0500

    ACCUMULO-4786 Fix XML and JSON links in Monitor
---
 ...XMLInformation.java => SummaryInformation.java} | 12 +++++------
 .../apache/accumulo/monitor/rest/XMLResource.java  | 25 ++++++++++++++++------
 .../apache/accumulo/monitor/templates/navbar.ftl   |  4 ++--
 3 files changed, 27 insertions(+), 14 deletions(-)

diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/XMLInformation.java
 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/SummaryInformation.java
similarity index 91%
rename from 
server/monitor/src/main/java/org/apache/accumulo/monitor/rest/XMLInformation.java
rename to 
server/monitor/src/main/java/org/apache/accumulo/monitor/rest/SummaryInformation.java
index 0eeb388..cfffbb4 100644
--- 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/XMLInformation.java
+++ 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/SummaryInformation.java
@@ -31,13 +31,13 @@ import 
org.apache.accumulo.monitor.rest.tservers.TabletServer;
 
 /**
  *
- * Generate XML summary of Monitor
+ * Generate summary of Monitor
  *
  * @since 2.0.0
  *
  */
 @XmlRootElement(name = "stats")
-public class XMLInformation {
+public class SummaryInformation {
 
   // Variable names become JSON keys
   public List<TabletServer> servers = new ArrayList<>();
@@ -55,10 +55,10 @@ public class XMLInformation {
 
   public Totals totals;
 
-  public XMLInformation() {}
+  public SummaryInformation() {}
 
   /**
-   * Stores Monitor information as XML
+   * Stores Monitor information as XML or JSON
    *
    * @param size
    *          Number of tservers
@@ -67,7 +67,7 @@ public class XMLInformation {
    * @param tablesList
    *          Table list
    */
-  public XMLInformation(int size, MasterInformation info, TableInformationList 
tablesList) {
+  public SummaryInformation(int size, MasterInformation info, 
TableInformationList tablesList) {
     this.servers = new ArrayList<>(size);
 
     this.masterGoalState = info.masterGoalState;
@@ -85,7 +85,7 @@ public class XMLInformation {
   }
 
   /**
-   * Adds a new tablet to the XML
+   * Adds a new tablet
    *
    * @param tablet
    *          Tablet to add
diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/XMLResource.java
 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/XMLResource.java
index 67c6363..72d9ff9 100644
--- 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/XMLResource.java
+++ 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/XMLResource.java
@@ -32,7 +32,7 @@ import org.apache.accumulo.monitor.rest.tservers.TabletServer;
 
 /**
  *
- * Responsible for generating an XML summary of the Monitor
+ * Responsible for generating a JSON and XML summary of the Monitor
  *
  * @since 2.0.0
  *
@@ -42,12 +42,11 @@ import 
org.apache.accumulo.monitor.rest.tservers.TabletServer;
 public class XMLResource {
 
   /**
-   * Generates an XML summary of the Monitor
+   * Generates summary of the Monitor
    *
-   * @return XML summary
+   * @return SummaryInformation object
    */
-  @GET
-  public XMLInformation getXMLInformation() {
+  public SummaryInformation getInformation() {
 
     MasterMonitorInfo mmi = Monitor.getMmi();
     if (null == mmi) {
@@ -55,7 +54,7 @@ public class XMLResource {
     }
 
     // Add Monitor information
-    XMLInformation xml = new XMLInformation(mmi.tServerInfo.size(), 
MasterResource.getTables(), TablesResource.getTables());
+    SummaryInformation xml = new SummaryInformation(mmi.tServerInfo.size(), 
MasterResource.getTables(), TablesResource.getTables());
 
     // Add tserver information
     for (TabletServerStatus status : mmi.tServerInfo) {
@@ -64,4 +63,18 @@ public class XMLResource {
 
     return xml;
   }
+
+  @GET
+  @Path("xml")
+  @Produces(MediaType.APPLICATION_XML)
+  public SummaryInformation getXMLInformation() {
+    return getInformation();
+  }
+
+  @GET
+  @Path("json")
+  @Produces(MediaType.APPLICATION_JSON)
+  public SummaryInformation getJSONInformation() {
+    return getInformation();
+  }
 }
diff --git 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl
 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl
index 1710152..2fa6ed7 100644
--- 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl
+++ 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/navbar.ftl
@@ -64,8 +64,8 @@
                 API <span class="caret"></span>
               </a>
               <ul class="dropdown-menu">
-                <li><a href="/rest">XML</a></li>
-                <li><a href="/rest/tservers">JSON</a></li>
+                <li><a href="/rest/xml">XML</a></li>
+                <li><a href="/rest/json">JSON</a></li>
               </ul>
             </li>
             <li class="dropdown">

-- 
To stop receiving notification emails like this one, please contact
['"commits@accumulo.apache.org" <commits@accumulo.apache.org>'].

Reply via email to