geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [05/10] incubator-geode git commit: GEODE-907: Converted core functionality to use jackson
Date Tue, 23 Feb 2016 22:06:10 GMT
GEODE-907: Converted core functionality to use jackson


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/6d3f5560
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/6d3f5560
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/6d3f5560

Branch: refs/heads/develop
Commit: 6d3f55605bd97a3e1172bf05906a9f612c18f1e2
Parents: 0f272db
Author: Jens Deppe <jdeppe@pivotal.io>
Authored: Thu Feb 18 16:31:15 2016 -0800
Committer: Jens Deppe <jdeppe@pivotal.io>
Committed: Tue Feb 23 14:04:50 2016 -0800

----------------------------------------------------------------------
 geode-pulse/build.gradle                        |   7 +-
 .../internal/controllers/PulseController.java   | 196 +++++++-----------
 .../tools/pulse/internal/data/Cluster.java      |  29 +--
 .../tools/pulse/internal/data/DataBrowser.java  | 100 ++++-----
 .../pulse/internal/data/IClusterUpdater.java    |   5 +-
 .../pulse/internal/data/JMXDataUpdater.java     |  15 +-
 .../internal/service/ClusterDetailsService.java |  78 ++++---
 .../service/ClusterDiskThroughputService.java   |  45 ++---
 .../service/ClusterGCPausesService.java         |  39 ++--
 .../service/ClusterKeyStatisticsService.java    |  47 ++---
 .../internal/service/ClusterMemberService.java  | 135 +++++++------
 .../service/ClusterMembersRGraphService.java    |  95 ++++-----
 .../service/ClusterMemoryUsageService.java      |  38 ++--
 .../internal/service/ClusterRegionService.java  | 115 +++++------
 .../internal/service/ClusterRegionsService.java | 121 +++++------
 .../service/ClusterSelectedRegionService.java   | 159 ++++++---------
 .../ClusterSelectedRegionsMemberService.java    | 116 ++++++-----
 .../internal/service/ClusterWANInfoService.java |  52 +++--
 .../service/MemberAsynchEventQueuesService.java | 107 +++++-----
 .../internal/service/MemberClientsService.java  | 121 +++++------
 .../internal/service/MemberDetailsService.java  | 120 ++++++-----
 .../service/MemberDiskThroughputService.java    |  67 +++----
 .../internal/service/MemberGCPausesService.java |  55 ++---
 .../service/MemberGatewayHubService.java        | 201 +++++++++----------
 .../service/MemberHeapUsageService.java         |  55 ++---
 .../service/MemberKeyStatisticsService.java     |  76 +++----
 .../internal/service/MemberRegionsService.java  | 146 +++++++-------
 .../internal/service/MembersListService.java    |  43 ++--
 .../pulse/internal/service/PulseService.java    |  10 +-
 .../internal/service/PulseVersionService.java   |  40 ++--
 .../service/QueryStatisticsService.java         | 149 ++++++--------
 .../internal/service/SystemAlertsService.java   |  80 ++++----
 .../controllers/PulseControllerJUnitTest.java   | 128 +++++++++---
 .../pulse/testbed/PropMockDataUpdater.java      |  34 ++--
 .../pulse/tests/junit/BaseServiceTest.java      |  87 ++++----
 35 files changed, 1310 insertions(+), 1601 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/build.gradle
----------------------------------------------------------------------
diff --git a/geode-pulse/build.gradle b/geode-pulse/build.gradle
index cd3a744..cf07751 100755
--- a/geode-pulse/build.gradle
+++ b/geode-pulse/build.gradle
@@ -67,6 +67,12 @@ sourceSets {
   main {
     output.dir(generatedResources, builtBy: 'copyGemFireVersionFile')
   }
+
+  test {
+    resources {
+      srcDir 'src/main/webapp/WEB-INF'
+    }
+  }
 }
 
 task copyGemFireVersionFile(type: Copy) {
@@ -89,7 +95,6 @@ idea.module.iml {
   }
 }
 
-
 artifacts {
   archives war
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/controllers/PulseController.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/controllers/PulseController.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/controllers/PulseController.java
index 6abb2de..e70d3f1 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/controllers/PulseController.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/controllers/PulseController.java
@@ -19,35 +19,32 @@
 
 package com.vmware.gemfire.tools.pulse.internal.controllers;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.commons.lang.StringEscapeUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseVersion;
 import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter;
 import com.vmware.gemfire.tools.pulse.internal.service.PulseService;
 import com.vmware.gemfire.tools.pulse.internal.service.PulseServiceFactory;
 import com.vmware.gemfire.tools.pulse.internal.service.SystemAlertsService;
 import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * Class PulseController
@@ -61,6 +58,8 @@ import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
 @Controller
 public class PulseController {
 
+  private static final PulseLogWriter LOGGER = PulseLogWriter.getLogger();
+
   // CONSTANTS
   private final String DEFAULT_EXPORT_FILENAME = "DataBrowserQueryResult.json";
   private final String QUERYSTRING_PARAM_ACTION = "action";
@@ -74,29 +73,31 @@ public class PulseController {
   private String ERROR_REPSONSE_QUERYNOTFOUND = "No queries found";
   private String ERROR_REPSONSE_QUERYIDMISSING = "Query id is missing";
 
-  private final JSONObject NoDataJSON = new JSONObject();
+  private static final String EMPTY_JSON = "{}";
 
   // Shared object to hold pulse version details
   public static PulseVersion pulseVersion = new PulseVersion();
+
   //default is gemfire
   private static String pulseProductSupport = PulseConstants.PRODUCT_NAME_GEMFIRE;
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   @Autowired
   PulseServiceFactory pulseServiceFactory;
 
   @RequestMapping(value = "/pulseUpdate", method = RequestMethod.POST)
   public void getPulseUpdate(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
     String pulseData = request.getParameter("pulseData");
 
-    JSONObject responseMap = new JSONObject();
+    ObjectNode responseMap = mapper.createObjectNode();
 
-    JSONObject requestMap = null;
+    JsonNode requestMap = null;
 
     try {
-      requestMap = new JSONObject(pulseData);
-      Iterator<?> keys = requestMap.keys();
+      requestMap = mapper.readTree(pulseData);
+      Iterator<?> keys = requestMap.fieldNames();
 
       // Execute Services
       while (keys.hasNext()) {
@@ -104,17 +105,12 @@ public class PulseController {
         try {
           PulseService pulseService = pulseServiceFactory
               .getPulseServiceInstance(serviceName);
-          responseMap.put(serviceName, pulseService.execute(request));
+          responseMap.put(serviceName, pulseService.tempExecute(request));
         } catch (Exception serviceException) {
           LOGGER.warning("serviceException [for service "+serviceName+"] = " + serviceException.getMessage());
-          responseMap.put(serviceName, NoDataJSON);
+          responseMap.put(serviceName, EMPTY_JSON);
         }
       }
-
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(new JSONException(eJSON),
-          new String[] { "requestMap:"
-              + ((requestMap == null) ? "" : requestMap) });
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occurred : " + e.getMessage());
@@ -128,16 +124,13 @@ public class PulseController {
   @RequestMapping(value = "/authenticateUser", method = RequestMethod.GET)
   public void authenticateUser(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
 
     try {
       responseJSON.put("isUserLoggedIn", this.isUserLoggedIn(request));
       // Send json response
       response.getOutputStream().write(responseJSON.toString().getBytes());
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(eJSON, null);
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occurred : " + e.getMessage());
@@ -152,7 +145,6 @@ public class PulseController {
    * @return boolean
    */
   protected boolean isUserLoggedIn(HttpServletRequest request) {
-
     return null != request.getUserPrincipal();
   }
 
@@ -171,9 +163,9 @@ public class PulseController {
   @RequestMapping(value = "/pulseVersion", method = RequestMethod.GET)
   public void pulseVersion(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
+
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
 
     try {
       // Reference to repository
@@ -186,23 +178,13 @@ public class PulseController {
       repository.setPulseWebAppUrl(pulseWebAppUrl);
 
       // Response
-      responseJSON.put("pulseVersion",
-          PulseController.pulseVersion.getPulseVersion());
-      responseJSON.put("buildId",
-          PulseController.pulseVersion.getPulseBuildId());
-      responseJSON.put("buildDate",
-          PulseController.pulseVersion.getPulseBuildDate());
-      responseJSON.put("sourceDate",
-          PulseController.pulseVersion.getPulseSourceDate());
-      responseJSON.put("sourceRevision",
-          PulseController.pulseVersion.getPulseSourceRevision());
-      responseJSON.put("sourceRepository",
-          PulseController.pulseVersion.getPulseSourceRepository());
-
-    } catch (JSONException eJSON) {
-      LOGGER
-          .logJSONError(eJSON, new String[] { "pulseVersionData :"
-              + PulseController.pulseVersion });
+      responseJSON.put("pulseVersion", PulseController.pulseVersion.getPulseVersion());
+      responseJSON.put("buildId", PulseController.pulseVersion.getPulseBuildId());
+      responseJSON.put("buildDate", PulseController.pulseVersion.getPulseBuildDate());
+      responseJSON.put("sourceDate", PulseController.pulseVersion.getPulseSourceDate());
+      responseJSON.put("sourceRevision", PulseController.pulseVersion.getPulseSourceRevision());
+      responseJSON.put("sourceRepository", PulseController.pulseVersion.getPulseSourceRepository());
+
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occured : " + e.getMessage());
@@ -214,11 +196,10 @@ public class PulseController {
   }
 
   @RequestMapping(value = "/clearAlerts", method = RequestMethod.GET)
-  public void clearAlerts(HttpServletRequest request,
-      HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
+  public void clearAlerts(HttpServletRequest request, HttpServletResponse response) throws IOException {
     int alertType;
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
+
     try {
       alertType = Integer.valueOf(request.getParameter("alertType"));
     } catch (NumberFormatException e) {
@@ -248,9 +229,6 @@ public class PulseController {
         responseJSON.put("connectedFlag", isGFConnected);
         responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg());
       }
-
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(eJSON, null);
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occurred : " + e.getMessage());
@@ -264,9 +242,8 @@ public class PulseController {
   @RequestMapping(value = "/acknowledgeAlert", method = RequestMethod.GET)
   public void acknowledgeAlert(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
     int alertId;
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
 
     try {
       alertId = Integer.valueOf(request.getParameter("alertId"));
@@ -286,8 +263,6 @@ public class PulseController {
       // set alert is acknowledged
       cluster.acknowledgeAlert(alertId);
       responseJSON.put("status", "deleted");
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(eJSON, null);
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occured : " + e.getMessage());
@@ -301,13 +276,12 @@ public class PulseController {
   @RequestMapping(value = "/dataBrowserRegions", method = RequestMethod.GET)
   public void dataBrowserRegions(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-    List<JSONObject> regionsData = Collections.emptyList();
+    ObjectNode responseJSON = mapper.createObjectNode();
+    ArrayNode regionsData = mapper.createArrayNode();
 
     try {
       // getting cluster's Regions
@@ -316,14 +290,6 @@ public class PulseController {
       responseJSON.put("clusterRegions", regionsData);
       responseJSON.put("connectedFlag", cluster.isConnectedFlag());
       responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg());
-
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(
-          eJSON,
-          new String[] { "clusterName:" + cluster.getServerName(),
-              "clusterRegions:" + regionsData,
-              "connectedFlag:" + cluster.isConnectedFlag(),
-              "connectedErrorMsg:" + cluster.getConnectionErrorMsg() });
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occured : " + e.getMessage());
@@ -338,38 +304,39 @@ public class PulseController {
    * This method creates json for list of cluster regions
    * 
    * @param cluster
-   * @return JSONObject Array List
+   * @return ArrayNode JSON array
    */
-  private List<JSONObject> getRegionsJson(Cluster cluster) throws JSONException {
+  private ArrayNode getRegionsJson(Cluster cluster) {
 
-    Collection<Cluster.Region> clusterRegions = cluster.getClusterRegions()
-        .values();
-    List<JSONObject> regionsListJson = new ArrayList<JSONObject>();
+    Collection<Cluster.Region> clusterRegions = cluster.getClusterRegions().values();
+    ArrayNode regionsListJson = mapper.createArrayNode();
 
     if (!clusterRegions.isEmpty()) {
       for (Cluster.Region region : clusterRegions) {
-        JSONObject regionJSON = new JSONObject();
-
+        ObjectNode regionJSON = mapper.createObjectNode();
         regionJSON.put("name", region.getName());
         regionJSON.put("fullPath", region.getFullPath());
         regionJSON.put("regionType", region.getRegionType());
-        if(region.getRegionType().contains("PARTITION")){
+
+        if (region.getRegionType().contains("PARTITION")) {
           regionJSON.put("isPartition", true);
-        }else{
+        } else {
           regionJSON.put("isPartition", false);
         }
+
         regionJSON.put("memberCount", region.getMemberCount());
         List<String> regionsMembers = region.getMemberName();
-        JSONArray jsonRegionMembers = new JSONArray();
+        ArrayNode jsonRegionMembers = mapper.createArrayNode();
+
         for (int i = 0; i < regionsMembers.size(); i++) {
           Cluster.Member member = cluster.getMembersHMap().get(
               regionsMembers.get(i));
-          JSONObject jsonMember = new JSONObject();
+          ObjectNode jsonMember = mapper.createObjectNode();
           jsonMember.put("key", regionsMembers.get(i));
           jsonMember.put("id", member.getId());
           jsonMember.put("name", member.getName());
 
-          jsonRegionMembers.put(jsonMember);
+          jsonRegionMembers.add(jsonMember);
         }
 
         regionJSON.put("members", jsonRegionMembers);
@@ -382,7 +349,6 @@ public class PulseController {
   @RequestMapping(value = "/dataBrowserQuery", method = RequestMethod.GET)
   public void dataBrowserQuery(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
     // get query string
     String query = request.getParameter("query");
     String members = request.getParameter("members");
@@ -397,7 +363,7 @@ public class PulseController {
       }
     }
 
-    JSONObject queryResult = new JSONObject();
+    ObjectNode queryResult = mapper.createObjectNode();
     try {
 
       if (StringUtils.isNotNullNotEmptyNotWhiteSpace(query)) {
@@ -415,8 +381,6 @@ public class PulseController {
           cluster.addQueryInHistory(escapedQuery, userName);
         }
       }
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(eJSON, new String[] { "queryResult:" + queryResult });
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occured : " + e.getMessage());
@@ -429,12 +393,11 @@ public class PulseController {
   @RequestMapping(value = "/dataBrowserQueryHistory", method = RequestMethod.GET)
   public void dataBrowserQueryHistory(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
-    JSONObject responseJSON = new JSONObject();
-    JSONArray queryResult = null;
+    ObjectNode responseJSON = mapper.createObjectNode();
+    ArrayNode queryResult = null;
     String action = "";
-    try {
 
+    try {
       // get cluster object
       Cluster cluster = Repository.get().getCluster();
       String userName = request.getUserPrincipal().getName();
@@ -465,10 +428,6 @@ public class PulseController {
       // Get list of past executed queries
       queryResult = cluster.getQueryHistoryByUserId(userName);
       responseJSON.put("queryHistory", queryResult);
-
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(eJSON, new String[] { "action:" + action,
-          "queryResult:" + queryResult });
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occured : " + e.getMessage());
@@ -488,11 +447,9 @@ public class PulseController {
     response.setHeader("Cache-Control", "");
     response.setHeader("Content-type", "text/plain");
     if (StringUtils.isNotNullNotEmptyNotWhiteSpace(filename)) {
-      response.setHeader("Content-Disposition", "attachment; filename="
-          + filename);
+      response.setHeader("Content-Disposition", "attachment; filename=" + filename);
     } else {
-      response.setHeader("Content-Disposition", "attachment; filename="
-          + DEFAULT_EXPORT_FILENAME);
+      response.setHeader("Content-Disposition", "attachment; filename=" + DEFAULT_EXPORT_FILENAME);
     }
 
     if (!StringUtils.isNotNullNotEmptyNotWhiteSpace(resultContent)) {
@@ -505,19 +462,16 @@ public class PulseController {
   @RequestMapping(value = "/pulseProductSupport", method = RequestMethod.GET)
   public void getConfiguredPulseProduct(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
-    JSONObject responseJSON = new JSONObject();
+      ObjectNode responseJSON = mapper.createObjectNode();
 
     try {
       responseJSON.put("product", pulseProductSupport);
 
       // Send json response
       response.getOutputStream().write(responseJSON.toString().getBytes());
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(eJSON, null);
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
-        LOGGER.fine("Exception Occured : " + e.getMessage());
+        LOGGER.fine("Exception Occurred : " + e.getMessage());
       }
     }
   }
@@ -525,8 +479,8 @@ public class PulseController {
   @RequestMapping(value = "/getQueryStatisticsGridModel", method = RequestMethod.GET)
   public void getQueryStatisticsGridModel(HttpServletRequest request,
       HttpServletResponse response) throws IOException {
-    PulseLogWriter LOGGER = PulseLogWriter.getLogger();
-    JSONObject responseJSON = new JSONObject();
+
+    ObjectNode responseJSON = mapper.createObjectNode();
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
     String userName = request.getUserPrincipal().getName();
@@ -536,21 +490,20 @@ public class PulseController {
       String[] arrColAttribs = Cluster.Statement.getGridColumnAttributes();
       int[] arrColWidths = Cluster.Statement.getGridColumnWidths();
 
-      JSONArray colNamesList = new JSONArray();
+      ArrayNode colNamesList = mapper.createArrayNode();
       for (int i = 0; i < arrColNames.length; ++i) {
-        colNamesList.put(arrColNames[i]);
+        colNamesList.add(arrColNames[i]);
       }
 
-      JSONArray colModelList = new JSONArray();
-      JSONObject columnJSON = null;
+      ArrayNode colModelList = mapper.createArrayNode();
       for (int i = 0; i < arrColAttribs.length; ++i) {
-        columnJSON = new JSONObject();
+        ObjectNode columnJSON = mapper.createObjectNode();
         columnJSON.put("name", arrColAttribs[i]);
         columnJSON.put("index", arrColAttribs[i]);
         columnJSON.put("width", arrColWidths[i]);
         columnJSON.put("sortable", "true");
         columnJSON.put("sorttype", ((i == 0) ? "String" : "integer"));
-        colModelList.put(columnJSON);
+        colModelList.add(columnJSON);
       }
 
       responseJSON.put("columnNames", colNamesList);
@@ -560,8 +513,6 @@ public class PulseController {
 
       // Send json response
       response.getOutputStream().write(responseJSON.toString().getBytes());
-    } catch (JSONException eJSON) {
-      LOGGER.logJSONError(eJSON, null);
     } catch (Exception e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine("Exception Occured : " + e.getMessage());
@@ -583,5 +534,4 @@ public class PulseController {
   public static void setPulseProductSupport(String pulseProductSupport) {
     PulseController.pulseProductSupport = pulseProductSupport;
   }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
index 309fdf7..5c6bb40 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
@@ -54,6 +54,11 @@ import java.util.TimeZone;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.commons.collections.buffer.CircularFifoBuffer;
+
 /**
  * Class Cluster This class is the Data Model for the data used for the Pulse
  * Web UI.
@@ -162,8 +167,11 @@ public class Cluster extends Thread {
   private boolean stopUpdates = false;
 
   private static final int MAX_HOSTS = 40;
+
   private final List<String> hostNames = new ArrayList<String>();
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   public Object[] getStatisticTrend(int trendId) {
 
     Object[] returnArray = null;
@@ -216,7 +224,6 @@ public class Cluster extends Thread {
         returnArray = this.garbageCollectionTrend.toArray();
       }
       break;
-
     }
 
     return returnArray;
@@ -2881,13 +2888,12 @@ public class Cluster extends Thread {
     this.dataBrowser = dataBrowser;
   }
 
-  public JSONObject executeQuery(String queryText, String members, int limit)
-      throws JSONException {
+  public ObjectNode executeQuery(String queryText, String members, int limit) {
     // Execute data browser query
     return this.updater.executeQuery(queryText, members, limit);
   }
 
-  public JSONArray getQueryHistoryByUserId(String userId) throws JSONException {
+  public ArrayNode getQueryHistoryByUserId(String userId) {
     return this.getDataBrowser().getQueryHistoryByUserId(userId);
   }
 
@@ -3513,11 +3519,10 @@ public class Cluster extends Thread {
     private int queryCounter = 0;
 
     @Override
-    public JSONObject executeQuery(String queryText, String members, int limit)
-        throws JSONException {
+    public ObjectNode executeQuery(String queryText, String members, int limit) {
 
       BufferedReader streamReader = null;
-      JSONObject jsonObject = new JSONObject();
+      ObjectNode jsonObject = mapper.createObjectNode();
       Random rand = new Random();
       int min = 1, max = 5;
       int randomNum = rand.nextInt(max - min + 1) + min;
@@ -3530,8 +3535,7 @@ public class Cluster extends Thread {
       }
 
       try {
-        ClassLoader classLoader = Thread.currentThread()
-            .getContextClassLoader();
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
 
         switch (queryCounter++) {
         case 1:
@@ -3643,14 +3647,11 @@ public class Cluster extends Thread {
           testQueryResultClusterSmallresponseStrBuilder.append(inputStr);
         }
 
-        jsonObject = new JSONObject(
-            testQueryResultClusterSmallresponseStrBuilder.toString());
+//        jsonObject = new JSONObject(
+//            testQueryResultClusterSmallresponseStrBuilder.toString());
 
         // close stream reader
         streamReader.close();
-
-      } catch (JSONException ex) {
-        LOGGER.severe(ex.getMessage());
       } catch (IOException ex) {
         LOGGER.severe(ex.getMessage());
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
index f3b4493..88d5e32 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
@@ -30,6 +30,10 @@ import java.util.Iterator;
 import java.util.ResourceBundle;
 import java.util.Scanner;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
 import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
 import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
@@ -52,6 +56,8 @@ public class DataBrowser {
   private SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
       PulseConstants.PULSE_QUERY_HISTORY_DATE_PATTERN);
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   /**
    * addQueryInHistory method adds user's query into query history file
    * 
@@ -61,35 +67,25 @@ public class DataBrowser {
    *          Query text to execute
    */
   public boolean addQueryInHistory(String queryText, String userId) {
-
     boolean operationStatus = false;
     if (StringUtils.isNotNullNotEmptyNotWhiteSpace(queryText)
         && StringUtils.isNotNullNotEmptyNotWhiteSpace(userId)) {
 
       // Fetch all queries from query log file
-      JSONObject queries = fetchAllQueriesFromFile();
+      ObjectNode queries = fetchAllQueriesFromFile();
 
       // Get user's query history list
-      JSONObject userQueries = null;
-      try {
-        userQueries = queries.getJSONObject(userId);
-      } catch (JSONException e) {
-        userQueries = new JSONObject();
+      ObjectNode userQueries = (ObjectNode) queries.get(userId);
+      if (userQueries == null) {
+        userQueries = mapper.createObjectNode();
       }
 
       // Add query in user's query history list
-      try {
-        userQueries.put(Long.toString(System.currentTimeMillis()), queryText);
-        queries.put(userId, userQueries);
-      } catch (JSONException e) {
-        if (LOGGER.fineEnabled()) {
-          LOGGER.fine("JSONException Occured while adding user's query : " + e.getMessage());
-        }
-      }
+      userQueries.put(Long.toString(System.currentTimeMillis()), queryText);
+      queries.put(userId, userQueries);
 
       // Store queries in file back
       operationStatus = storeQueriesInFile(queries);
-
     }
 
     return operationStatus;
@@ -111,29 +107,17 @@ public class DataBrowser {
         && StringUtils.isNotNullNotEmptyNotWhiteSpace(userId)) {
 
       // Fetch all queries from query log file
-      JSONObject queries = fetchAllQueriesFromFile();
+      ObjectNode queries = fetchAllQueriesFromFile();
 
       // Get user's query history list
-      JSONObject userQueries = null;
-      try {
-        userQueries = queries.getJSONObject(userId);
-      } catch (JSONException e) {
-        userQueries = new JSONObject();
-      }
+      ObjectNode userQueries = (ObjectNode) queries.get(userId);
 
       // Remove user's query
-      try {
-        userQueries.remove(queryId);
-        queries.put(userId, userQueries);
-      } catch (JSONException e) {
-        if (LOGGER.fineEnabled()) {
-          LOGGER.fine("JSONException Occured while deleting user's query : " + e.getMessage());
-        }
-      }
+      userQueries.remove(queryId);
+      queries.put(userId, userQueries);
 
       // Store queries in file back
       operationStatus = storeQueriesInFile(queries);
-
     }
     
     return operationStatus;
@@ -146,38 +130,27 @@ public class DataBrowser {
    * @param userId
    *          Logged in User's Id
    */
-  public JSONArray getQueryHistoryByUserId(String userId) {
+  public ArrayNode getQueryHistoryByUserId(String userId) {
 
-    JSONArray queryList = new JSONArray();
+    ArrayNode queryList = mapper.createArrayNode();
 
     if (StringUtils.isNotNullNotEmptyNotWhiteSpace(userId)) {
 
       // Fetch all queries from query log file
-      JSONObject queries = fetchAllQueriesFromFile();
+      ObjectNode queries = fetchAllQueriesFromFile();
       
       // Get user's query history list
-      JSONObject userQueries = null;
-      try {
-        userQueries = queries.getJSONObject(userId);
-      } catch (JSONException e) {
-        userQueries = new JSONObject();
-      }
-
-      try {
-        Iterator<?> it = userQueries.keys();
-        while (it.hasNext()) {
-          String key = (String) it.next();
-          JSONObject queryItem = new JSONObject();
-          queryItem.put("queryId", key);
-          queryItem.put("queryText", userQueries.get(key).toString());
-          queryItem.put("queryDateTime",
-              simpleDateFormat.format(Long.valueOf(key)));
-          queryList.put(queryItem);
-        }
-      } catch (JSONException e) {
-        if (LOGGER.fineEnabled()) {
-          LOGGER.fine("JSONException Occured: " + e.getMessage());
-        }
+      ObjectNode userQueries = (ObjectNode) queries.get(userId);
+
+      Iterator<String> it = userQueries.fieldNames();
+      while (it.hasNext()) {
+        String key = it.next();
+        ObjectNode queryItem = mapper.createObjectNode();
+        queryItem.put("queryId", key);
+        queryItem.put("queryText", userQueries.get(key).toString());
+        queryItem.put("queryDateTime",
+            simpleDateFormat.format(Long.valueOf(key)));
+        queryList.add(queryItem);
       }
     }
 
@@ -189,15 +162,14 @@ public class DataBrowser {
    * 
    * @return Properties A collection queries in form of key and values
    */
-  private JSONObject fetchAllQueriesFromFile() {
+  private ObjectNode fetchAllQueriesFromFile() {
     InputStream inputStream = null;
-    JSONObject queriesJSON = new JSONObject();
+    JsonNode queriesJSON = mapper.createObjectNode();
 
     try {
       inputStream = new FileInputStream(Repository.get().getPulseConfig().getQueryHistoryFileName());
-      String inputStreamString = new Scanner(inputStream, "UTF-8")
-          .useDelimiter("\\A").next();
-      queriesJSON = new JSONObject(inputStreamString);
+      String inputStreamString = new Scanner(inputStream, "UTF-8").useDelimiter("\\A").next();
+      queriesJSON = mapper.readTree(inputStreamString);
     } catch (FileNotFoundException e) {
       if (LOGGER.fineEnabled()) {
         LOGGER.fine(resourceBundle
@@ -221,7 +193,7 @@ public class DataBrowser {
       }
     }
 
-    return queriesJSON;
+    return (ObjectNode) queriesJSON;
   }
 
   /**
@@ -229,7 +201,7 @@ public class DataBrowser {
    * 
    * @return Boolean true is operation is successful, false otherwise
    */
-  private boolean storeQueriesInFile(JSONObject queries) {
+  private boolean storeQueriesInFile(ObjectNode queries) {
     boolean operationStatus = false;
     FileOutputStream fileOut = null;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/IClusterUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/IClusterUpdater.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/IClusterUpdater.java
index 2b7e1a4..27abc21 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/IClusterUpdater.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/IClusterUpdater.java
@@ -19,8 +19,7 @@
 
 package com.vmware.gemfire.tools.pulse.internal.data;
 
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 /**
  * Interface having updateData() function which is getting Override by both
@@ -33,5 +32,5 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 public interface IClusterUpdater {
   boolean updateData();
 
-  JSONObject executeQuery(String queryText, String members, int limit) throws JSONException;
+  ObjectNode executeQuery(String queryText, String members, int limit);
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
index 8e4557a..adb7532 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
@@ -19,10 +19,10 @@
 
 package com.vmware.gemfire.tools.pulse.internal.data;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
 import com.vmware.gemfire.tools.pulse.internal.data.JmxManagerFinder.JmxManagerInfo;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter;
 import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
 
@@ -101,6 +101,8 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
   private final String opSignature[] = { String.class.getName(),
       String.class.getName(), int.class.getName() };
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   /**
    * constructor used for creating JMX connection
    */
@@ -2377,15 +2379,12 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
   }
 
   @Override
-  public JSONObject executeQuery(String queryText, String members, int limit)
-      throws JSONException {
+  public ObjectNode executeQuery(String queryText, String members, int limit) {
 
-    JSONObject queryResult = new JSONObject();
+    ObjectNode queryResult = mapper.createObjectNode();
 
     if (this.mbs != null && this.systemMBeans != null) {
-
       Object opParams[] = { queryText, members, limit };
-
       for (ObjectName sysMBean : this.systemMBeans) {
         try {
           String resultString = (String) (this.mbs.invoke(sysMBean,
@@ -2393,7 +2392,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
               this.opSignature));
 
           // Convert result into JSON
-          queryResult = new JSONObject(resultString);
+          queryResult = (ObjectNode) mapper.readTree(resultString);
 
         } catch (Exception e) {
           // Send error into result

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDetailsService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDetailsService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDetailsService.java
index 2efb6aa..35f9a81 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDetailsService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDetailsService.java
@@ -19,19 +19,17 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import java.text.DecimalFormat;
-
-import javax.servlet.http.HttpServletRequest;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
-import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
-import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import javax.servlet.http.HttpServletRequest;
+import java.text.DecimalFormat;
 
 /**
  * Class ClusterDetailsService
@@ -48,7 +46,9 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 @Scope("singleton")
 public class ClusterDetailsService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     String userName = request.getUserPrincipal().getName();
 
@@ -56,7 +56,7 @@ public class ClusterDetailsService implements PulseService {
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
 
     Cluster.Alert[] alertsList = cluster.getAlertsList();
     int severeAlertCount = 0;
@@ -75,35 +75,31 @@ public class ClusterDetailsService implements PulseService {
         infoAlertCount++;
       }
     }
-    try {
-      // getting basic details of Cluster
-      responseJSON.put("clusterName", cluster.getServerName());
-      responseJSON.put("severeAlertCount", severeAlertCount);
-      responseJSON.put("errorAlertCount", errorAlertCount);
-      responseJSON.put("warningAlertCount", warningAlertCount);
-      responseJSON.put("infoAlertCount", infoAlertCount);
-
-      responseJSON.put("totalMembers", cluster.getMemberCount());
-      responseJSON.put("servers", cluster.getServerCount());
-      responseJSON.put("clients", cluster.getClientConnectionCount());
-      responseJSON.put("locators", cluster.getLocatorCount());
-      responseJSON.put("totalRegions", cluster.getTotalRegionCount());
-      Long heapSize = cluster.getTotalHeapSize();
-
-      DecimalFormat df2 = new DecimalFormat(
-          PulseConstants.DECIMAL_FORMAT_PATTERN);
-      Double heapS = heapSize.doubleValue() / 1024;
-      responseJSON.put("totalHeap", Double.valueOf(df2.format(heapS)));
-      responseJSON.put("functions", cluster.getRunningFunctionCount());
-      responseJSON.put("uniqueCQs", cluster.getRegisteredCQCount());
-      responseJSON.put("subscriptions", cluster.getSubscriptionCount());
-      responseJSON.put("txnCommitted", cluster.getTxnCommittedCount());
-      responseJSON.put("txnRollback", cluster.getTxnRollbackCount());
-      responseJSON.put("userName", userName);
-
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
+    // getting basic details of Cluster
+    responseJSON.put("clusterName", cluster.getServerName());
+    responseJSON.put("severeAlertCount", severeAlertCount);
+    responseJSON.put("errorAlertCount", errorAlertCount);
+    responseJSON.put("warningAlertCount", warningAlertCount);
+    responseJSON.put("infoAlertCount", infoAlertCount);
+
+    responseJSON.put("totalMembers", cluster.getMemberCount());
+    responseJSON.put("servers", cluster.getServerCount());
+    responseJSON.put("clients", cluster.getClientConnectionCount());
+    responseJSON.put("locators", cluster.getLocatorCount());
+    responseJSON.put("totalRegions", cluster.getTotalRegionCount());
+    Long heapSize = cluster.getTotalHeapSize();
+
+    DecimalFormat df2 = new DecimalFormat(
+        PulseConstants.DECIMAL_FORMAT_PATTERN);
+    Double heapS = heapSize.doubleValue() / 1024;
+    responseJSON.put("totalHeap", Double.valueOf(df2.format(heapS)));
+    responseJSON.put("functions", cluster.getRunningFunctionCount());
+    responseJSON.put("uniqueCQs", cluster.getRegisteredCQCount());
+    responseJSON.put("subscriptions", cluster.getSubscriptionCount());
+    responseJSON.put("txnCommitted", cluster.getTxnCommittedCount());
+    responseJSON.put("txnRollback", cluster.getTxnRollbackCount());
+    responseJSON.put("userName", userName);
+
+    return responseJSON;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDiskThroughputService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDiskThroughputService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDiskThroughputService.java
index 0c1b56a..0a45ef6 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDiskThroughputService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterDiskThroughputService.java
@@ -19,17 +19,15 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import javax.servlet.http.HttpServletRequest;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
-import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Class ClusterDiskThroughput This class contains implementations for getting
@@ -44,36 +42,31 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 @Scope("singleton")
 public class ClusterDiskThroughputService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-    // clucter's Throughout Writes trend added to json response object
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    // cluster's Throughout Writes trend added to json response object
     // CircularFifoBuffer throughoutWritesTrend =
     // cluster.getThroughoutWritesTrend();
     Float currentThroughputWrites = cluster.getDiskWritesRate();
     Float currentThroughputReads = cluster.getDiskReadsRate();
 
-    try {
-      responseJSON.put("currentThroughputReads", currentThroughputReads);
-      responseJSON.put(
-          "throughputReads",
-          new JSONArray(cluster
-              .getStatisticTrend(Cluster.CLUSTER_STAT_THROUGHPUT_READS)));
+    responseJSON.put("currentThroughputReads", currentThroughputReads);
+    responseJSON.put("throughputReads",
+        mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_THROUGHPUT_READS)));
 
-      responseJSON.put("currentThroughputWrites", currentThroughputWrites);
-      responseJSON.put(
-          "throughputWrites",
-          new JSONArray(cluster
-              .getStatisticTrend(Cluster.CLUSTER_STAT_THROUGHPUT_WRITES)));
+    responseJSON.put("currentThroughputWrites", currentThroughputWrites);
+    responseJSON.put("throughputWrites",
+        mapper.valueToTree( cluster.getStatisticTrend(Cluster.CLUSTER_STAT_THROUGHPUT_WRITES)));
 
-      // Send json response
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
+    // Send json response
+    return responseJSON;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterGCPausesService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterGCPausesService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterGCPausesService.java
index 7c44234..606fc12 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterGCPausesService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterGCPausesService.java
@@ -19,17 +19,16 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import javax.servlet.http.HttpServletRequest;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
-import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Class ClusterGCPausesService
@@ -46,26 +45,24 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 @Scope("singleton")
 public class ClusterGCPausesService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-    // clucter's GC Pauses trend added to json response object
+    ObjectNode responseJSON = mapper.createObjectNode();
+    // cluster's GC Pauses trend added to json response object
 
-    try {
-      responseJSON.put("currentGCPauses", cluster.getGarbageCollectionCount());
-      responseJSON.put(
-          "gCPausesTrend",
-          new JSONArray(cluster
-              .getStatisticTrend(Cluster.CLUSTER_STAT_GARBAGE_COLLECTION))); // new
-                                                                             // JSONArray(array)
-      // Send json response
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
+    ArrayNode pauses = mapper.createArrayNode();
+    for (Object obj : cluster.getStatisticTrend(Cluster.CLUSTER_STAT_GARBAGE_COLLECTION)) {
+      pauses.add(obj.toString());
     }
+    responseJSON.put("currentGCPauses", cluster.getGarbageCollectionCount());
+    responseJSON.put("gCPausesTrend", pauses);
+    // Send json response
+    return responseJSON;
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterKeyStatisticsService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterKeyStatisticsService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterKeyStatisticsService.java
index 8ca4c03..ae9e5cf 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterKeyStatisticsService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterKeyStatisticsService.java
@@ -19,17 +19,15 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import javax.servlet.http.HttpServletRequest;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
-import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Class ClusterKeyStatisticsService
@@ -46,34 +44,27 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 @Scope("singleton")
 public class ClusterKeyStatisticsService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    responseJSON.put("writePerSecTrend",
+        mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_WRITES_PER_SECOND)));
+
+    responseJSON.put("readPerSecTrend",
+        mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_READ_PER_SECOND)));
 
-    try {
-      // clucter's Read write information
-      responseJSON.put(
-          "writePerSecTrend",
-          new JSONArray(cluster
-              .getStatisticTrend(Cluster.CLUSTER_STAT_WRITES_PER_SECOND)));
-      responseJSON.put(
-          "readPerSecTrend",
-          new JSONArray(cluster
-              .getStatisticTrend(Cluster.CLUSTER_STAT_READ_PER_SECOND)));
-      responseJSON.put(
-          "queriesPerSecTrend",
-          new JSONArray(cluster
-              .getStatisticTrend(Cluster.CLUSTER_STAT_QUERIES_PER_SECOND)));
+    responseJSON.put("queriesPerSecTrend",
+        mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_QUERIES_PER_SECOND)));
 
-      // Send json response
-      return responseJSON;
+    // Send json response
+    return responseJSON;
 
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
index 80e0b2e..296a45d 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java
@@ -19,12 +19,13 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
 import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 import com.vmware.gemfire.tools.pulse.internal.util.TimeUtils;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
@@ -49,84 +50,82 @@ import java.util.List;
 @Scope("singleton")
 public class ClusterMemberService implements PulseService {
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   private final String HEAP_USAGE = "heapUsage";
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
+    ObjectNode responseJSON = mapper.createObjectNode();
 
     Cluster.Member[] clusterMembersList = cluster.getMembers();
 
     // create members json
-    List<JSONObject> memberListJson = new ArrayList<JSONObject>();
-    try {
-      for (Cluster.Member clusterMember : clusterMembersList) {
-        JSONObject memberJSON = new JSONObject();
-        // getting members detail
-        memberJSON.put("gemfireVersion", clusterMember.getGemfireVersion());
-        memberJSON.put("memberId", clusterMember.getId());
-        memberJSON.put("name", clusterMember.getName());
-        memberJSON.put("host", clusterMember.getHost());
-        memberJSON.put("hostnameForClients", clusterMember.getHostnameForClients());
-
-        List<String> serverGroups = clusterMember.getServerGroups();
-        if(serverGroups.size() == 0){
-          serverGroups = new ArrayList<String>();
-          serverGroups.add(PulseConstants.DEFAULT_SERVER_GROUP);
-        }
-        memberJSON.put("serverGroups", serverGroups);
-        
-        List<String> redundancyZones = clusterMember.getRedundancyZones();
-        if(redundancyZones.size() == 0){
-          redundancyZones = new ArrayList<String>();
-          redundancyZones.add(PulseConstants.DEFAULT_REDUNDANCY_ZONE);
-        }
-        memberJSON.put("redundancyZones", redundancyZones);
-
-        DecimalFormat df2 = new DecimalFormat(
-            PulseConstants.DECIMAL_FORMAT_PATTERN);
-
-        long usedHeapSize = cluster.getUsedHeapSize();
-        long currentHeap = clusterMember.getCurrentHeapSize();
-        if (usedHeapSize > 0) {
-          float heapUsage = ((float) currentHeap / (float) usedHeapSize) * 100;
-          memberJSON
-              .put(this.HEAP_USAGE, Double.valueOf(df2.format(heapUsage)));
-        } else {
-          memberJSON.put(this.HEAP_USAGE, 0);
-        }
-        Float currentCPUUsage = clusterMember.getCpuUsage();
-
-        memberJSON.put("cpuUsage", Float.valueOf(df2.format(currentCPUUsage)));
-        memberJSON.put("currentHeapUsage", clusterMember.getCurrentHeapSize());
-        memberJSON.put("isManager", clusterMember.isManager());
-        memberJSON.put("uptime",
-            TimeUtils.convertTimeSecondsToHMS(clusterMember.getUptime()));
-        memberJSON.put("loadAvg", clusterMember.getLoadAverage());
-        memberJSON.put("sockets", clusterMember.getTotalFileDescriptorOpen());
-        memberJSON.put("threads", clusterMember.getNumThreads());
-
-        // Number of member clients
-        if (PulseController.getPulseProductSupport().equalsIgnoreCase(
-            PulseConstants.PRODUCT_NAME_SQLFIRE)){
-          memberJSON.put("clients", clusterMember.getNumSqlfireClients());
-        }else{
-          memberJSON.put("clients", clusterMember.getMemberClientsHMap().size());
-        }
-        memberJSON.put("queues", clusterMember.getQueueBacklog());
-
-        memberListJson.add(memberJSON);
+    ArrayNode memberListJson = mapper.createArrayNode();
+    for (Cluster.Member clusterMember : clusterMembersList) {
+      ObjectNode memberJSON = mapper.createObjectNode();
+      // getting members detail
+      memberJSON.put("gemfireVersion", clusterMember.getGemfireVersion());
+      memberJSON.put("memberId", clusterMember.getId());
+      memberJSON.put("name", clusterMember.getName());
+      memberJSON.put("host", clusterMember.getHost());
+
+      List<String> serverGroups = clusterMember.getServerGroups();
+      if(serverGroups.size() == 0){
+        serverGroups = new ArrayList<>();
+        serverGroups.add(PulseConstants.DEFAULT_SERVER_GROUP);
+      }
+
+      memberJSON.put("serverGroups", mapper.valueToTree(serverGroups));
+
+      List<String> redundancyZones = clusterMember.getRedundancyZones();
+      if(redundancyZones.size() == 0){
+        redundancyZones = new ArrayList<String>();
+        redundancyZones.add(PulseConstants.DEFAULT_REDUNDANCY_ZONE);
       }
-      // clucter's Members
-      responseJSON.put("members", memberListJson);
-      // Send json response
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
+      memberJSON.put("redundancyZones", mapper.valueToTree(redundancyZones));
+
+      DecimalFormat df2 = new DecimalFormat(
+          PulseConstants.DECIMAL_FORMAT_PATTERN);
+
+      long usedHeapSize = cluster.getUsedHeapSize();
+      long currentHeap = clusterMember.getCurrentHeapSize();
+      if (usedHeapSize > 0) {
+        float heapUsage = ((float) currentHeap / (float) usedHeapSize) * 100;
+        memberJSON
+            .put(this.HEAP_USAGE, Double.valueOf(df2.format(heapUsage)));
+      } else {
+        memberJSON.put(this.HEAP_USAGE, 0);
+      }
+      Float currentCPUUsage = clusterMember.getCpuUsage();
+
+      memberJSON.put("cpuUsage", Float.valueOf(df2.format(currentCPUUsage)));
+      memberJSON.put("currentHeapUsage", clusterMember.getCurrentHeapSize());
+      memberJSON.put("isManager", clusterMember.isManager());
+      memberJSON.put("uptime",
+          TimeUtils.convertTimeSecondsToHMS(clusterMember.getUptime()));
+      memberJSON.put("loadAvg", clusterMember.getLoadAverage());
+      memberJSON.put("sockets", clusterMember.getTotalFileDescriptorOpen());
+      memberJSON.put("threads", clusterMember.getNumThreads());
+
+      // Number of member clients
+      if (PulseController.getPulseProductSupport().equalsIgnoreCase(
+          PulseConstants.PRODUCT_NAME_SQLFIRE)){
+        memberJSON.put("clients", clusterMember.getNumSqlfireClients());
+      }else{
+        memberJSON.put("clients", clusterMember.getMemberClientsHMap().size());
+      }
+      memberJSON.put("queues", clusterMember.getQueueBacklog());
+
+      memberListJson.add(memberJSON);
     }
+    // cluster's Members
+    responseJSON.put("members", memberListJson);
+    // Send json response
+    return responseJSON;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
index f9ca137..b6203e5 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMembersRGraphService.java
@@ -26,6 +26,9 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
@@ -33,9 +36,6 @@ import org.springframework.stereotype.Service;
 import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
 import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 
 /**
  * Class ClusterMembersRGraphService
@@ -48,10 +48,11 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
  */
 @Component
 @Service("ClusterMembersRGraph")
-// @Service("ClusterMembers")
 @Scope("singleton")
 public class ClusterMembersRGraphService implements PulseService {
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   // String constants used for forming a json response
   private final String CLUSTER = "clustor";
   private final String MEMBER_COUNT = "memberCount";
@@ -85,7 +86,7 @@ public class ClusterMembersRGraphService implements PulseService {
   private List<String> errorAlertsList;
   private List<String> warningAlertsList;
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // Reference to repository
     Repository repository = Repository.get();
@@ -94,20 +95,15 @@ public class ClusterMembersRGraphService implements PulseService {
     Cluster cluster = repository.getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-
-    try {
-      // clucter's Members
-      responseJSON.put(
-          this.CLUSTER,
-          getPhysicalServerJson(cluster, repository.getJmxHost(),
-              repository.getJmxPort()));
-      responseJSON.put(this.MEMBER_COUNT, cluster.getMemberCount());
-      // Send json response
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    // cluster's Members
+    responseJSON.put(this.CLUSTER,
+        getPhysicalServerJson(cluster, repository.getJmxHost(), repository.getJmxPort()));
+    responseJSON.put(this.MEMBER_COUNT, cluster.getMemberCount());
+
+    // Send json response
+    return responseJSON;
   }
 
   /**
@@ -121,24 +117,21 @@ public class ClusterMembersRGraphService implements PulseService {
    * @return Array list of JSON objects for required fields of members in
    *         cluster
    */
-  private JSONObject getPhysicalServerJson(Cluster cluster, String host,
-      String port) throws JSONException {
-    Map<String, List<Cluster.Member>> physicalToMember = cluster
-        .getPhysicalToMember();
+  private ObjectNode getPhysicalServerJson(Cluster cluster, String host, String port) {
+    Map<String, List<Cluster.Member>> physicalToMember = cluster.getPhysicalToMember();
 
-    JSONObject clusterTopologyJSON = new JSONObject();
+    ObjectNode clusterTopologyJSON = mapper.createObjectNode();
 
     clusterTopologyJSON.put(this.ID, cluster.getClusterId());
     clusterTopologyJSON.put(this.NAME, cluster.getClusterId());
-    JSONObject data1 = new JSONObject();
+    ObjectNode data1 = mapper.createObjectNode();
     clusterTopologyJSON.put(this.DATA, data1);
-    JSONArray childHostArray = new JSONArray();
+    ArrayNode childHostArray = mapper.createArrayNode();
     DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN);
 
     updateAlertLists(cluster);
 
-    for (Map.Entry<String, List<Cluster.Member>> physicalToMem : physicalToMember
-        .entrySet()) {
+    for (Map.Entry<String, List<Cluster.Member>> physicalToMem : physicalToMember.entrySet()) {
       String hostName = physicalToMem.getKey();
       Float hostCpuUsage = 0.0F;
       Long hostMemoryUsage = (long) 0;
@@ -149,20 +142,20 @@ public class ClusterMembersRGraphService implements PulseService {
       boolean hostError = false;
       boolean hostWarning = false;
       String hostStatus;
-      JSONObject childHostObject = new JSONObject();
+      ObjectNode childHostObject = mapper.createObjectNode();
       childHostObject.put(this.ID, hostName);
       childHostObject.put(this.NAME, hostName);
 
-      JSONArray membersArray = new JSONArray();
+      ArrayNode membersArray = mapper.createArrayNode();
 
       List<Cluster.Member> memberList = physicalToMem.getValue();
       for (Cluster.Member member : memberList) {
-        JSONObject memberJSONObj = new JSONObject();
+        ObjectNode memberJSONObj = mapper.createObjectNode();
 
         memberJSONObj.put(this.ID, member.getId());
         memberJSONObj.put(this.NAME, member.getName());
 
-        JSONObject memberData = new JSONObject();
+        ObjectNode memberData = mapper.createObjectNode();
 
         memberData.put("gemfireVersion", member.getGemfireVersion());
 
@@ -185,10 +178,11 @@ public class ClusterMembersRGraphService implements PulseService {
         memberData.put(this.REGIONS, member.getMemberRegions().size());
         memberData.put(this.HOST, member.getHost());
         if ((member.getMemberPort() == null)
-            || (member.getMemberPort().equals("")))
+            || (member.getMemberPort().equals(""))) {
           memberData.put(this.PORT, "-");
-        else
+        } else {
           memberData.put(this.PORT, member.getMemberPort());
+        }
         memberData.put(this.CLIENTS, member.getMemberClientsHMap().size());
         memberData.put(this.GC_PAUSES, member.getGarbageCollectionCount());
         memberData.put(this.NUM_THREADS, member.getNumThreads());
@@ -206,14 +200,12 @@ public class ClusterMembersRGraphService implements PulseService {
         String memberNodeType = "";
         // for severe alert
         if (severeAlertList.contains(member.getName())) {
-          memberNodeType = getMemberNodeType(member,
-              this.MEMBER_NODE_TYPE_SEVERE);
+          memberNodeType = getMemberNodeType(member, this.MEMBER_NODE_TYPE_SEVERE);
           if (!hostSevere) {
             hostSevere = true;
           }
-        }
-        // for error alerts
-        else if (errorAlertsList.contains(member.getName())) {
+        } else if (errorAlertsList.contains(member.getName())) {
+          // for error alerts
           memberNodeType = getMemberNodeType(member,
               this.MEMBER_NODE_TYPE_ERROR);
           if (!hostError) {
@@ -222,29 +214,27 @@ public class ClusterMembersRGraphService implements PulseService {
         }
         // for warning alerts
         else if (warningAlertsList.contains(member.getName())) {
-          memberNodeType = getMemberNodeType(member,
-              this.MEMBER_NODE_TYPE_WARNING);
-          if (!hostWarning)
+          memberNodeType = getMemberNodeType(member, this.MEMBER_NODE_TYPE_WARNING);
+          if (!hostWarning) {
             hostWarning = true;
+          }
         } else {
-          memberNodeType = getMemberNodeType(member,
-              this.MEMBER_NODE_TYPE_NORMAL);
+          memberNodeType = getMemberNodeType(member, this.MEMBER_NODE_TYPE_NORMAL);
         }
 
         memberData.put("nodeType", memberNodeType);
         memberData.put("$type", memberNodeType);
-        memberData.put(this.GATEWAY_SENDER, member.getGatewaySenderList()
-            .size());
+        memberData.put(this.GATEWAY_SENDER, member.getGatewaySenderList().size());
         if (member.getGatewayReceiver() != null) {
-          memberData.put(this.GATEWAY_RECEIVER, "1");
+          memberData.put(this.GATEWAY_RECEIVER, 1);
         } else {
-          memberData.put(this.GATEWAY_RECEIVER, "0");
+          memberData.put(this.GATEWAY_RECEIVER, 0);
         }
         memberJSONObj.put(this.DATA, memberData);
-        memberJSONObj.put(this.CHILDREN, new JSONArray());
-        membersArray.put(memberJSONObj);
+        memberJSONObj.put(this.CHILDREN, mapper.createArrayNode());
+        membersArray.add(memberJSONObj);
       }
-      JSONObject data = new JSONObject();
+      ObjectNode data = mapper.createObjectNode();
 
       data.put(this.LOAD_AVG, hostLoadAvg);
       data.put(this.SOCKETS, hostSockets);
@@ -273,7 +263,7 @@ public class ClusterMembersRGraphService implements PulseService {
       childHostObject.put(this.DATA, data);
 
       childHostObject.put(this.CHILDREN, membersArray);
-      childHostArray.put(childHostObject);
+      childHostArray.add(childHostObject);
     }
     clusterTopologyJSON.put(this.CHILDREN, childHostArray);
 
@@ -367,6 +357,5 @@ public class ClusterMembersRGraphService implements PulseService {
         }
       }
     }
-
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemoryUsageService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemoryUsageService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemoryUsageService.java
index 830a44b..2301095 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemoryUsageService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemoryUsageService.java
@@ -19,17 +19,15 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
-import javax.servlet.http.HttpServletRequest;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
-import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Class ClusterMemoryUsageService
@@ -46,25 +44,23 @@ import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
 @Scope("singleton")
 public class ClusterMemoryUsageService implements PulseService {
 
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  private final ObjectMapper mapper = new ObjectMapper();
+
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     // get cluster object
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-    // clucter's Memory Usage trend added to json response object
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    // cluster's Memory Usage trend added to json response object
+
+    responseJSON.put("currentMemoryUsage", cluster.getUsedHeapSize());
+    responseJSON.put("memoryUsageTrend",
+        mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_MEMORY_USAGE)));
 
-    try {
-      responseJSON.put("currentMemoryUsage", cluster.getUsedHeapSize());
-      responseJSON.put(
-          "memoryUsageTrend",
-          new JSONArray(cluster
-              .getStatisticTrend(Cluster.CLUSTER_STAT_MEMORY_USAGE)));
-      // Send json response
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
+    // Send json response
+    return responseJSON;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6d3f5560/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterRegionService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterRegionService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterRegionService.java
index bb8950b..d8bd3a9 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterRegionService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterRegionService.java
@@ -19,6 +19,19 @@
 
 package com.vmware.gemfire.tools.pulse.internal.service;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
+import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -26,21 +39,6 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
-
-import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController;
-import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
-import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
-import com.vmware.gemfire.tools.pulse.internal.data.Repository;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONArray;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
-import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
-import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
-
 /**
  * Class ClusterRegionService
  *
@@ -55,27 +53,26 @@ import com.vmware.gemfire.tools.pulse.internal.util.StringUtils;
 @Scope("singleton")
 public class ClusterRegionService implements PulseService {
 
+  private final ObjectMapper mapper = new ObjectMapper();
+
   // String constants used for forming a json response
   private final String ENTRY_SIZE = "entrySize";
 
   // Comparator based upon regions entry count
-  private static Comparator<Cluster.Region> regionEntryCountComparator = new Comparator<Cluster.Region>() {
-    @Override
-    public int compare(Cluster.Region r1, Cluster.Region r2) {
-      long r1Cnt = r1.getSystemRegionEntryCount();
-      long r2Cnt = r2.getSystemRegionEntryCount();
-      if (r1Cnt < r2Cnt) {
-        return -1;
-      } else if (r1Cnt > r2Cnt) {
-        return 1;
-      } else {
-        return 0;
-      }
+  private static Comparator<Cluster.Region> regionEntryCountComparator = (r1, r2) -> {
+    long r1Cnt = r1.getSystemRegionEntryCount();
+    long r2Cnt = r2.getSystemRegionEntryCount();
+    if (r1Cnt < r2Cnt) {
+      return -1;
+    } else if (r1Cnt > r2Cnt) {
+      return 1;
+    } else {
+      return 0;
     }
   };
 
   @Override
-  public JSONObject execute(final HttpServletRequest request) throws Exception {
+  public ObjectNode tempExecute(final HttpServletRequest request) throws Exception {
 
     String userName = request.getUserPrincipal().getName();
 
@@ -83,18 +80,14 @@ public class ClusterRegionService implements PulseService {
     Cluster cluster = Repository.get().getCluster();
 
     // json object to be sent as response
-    JSONObject responseJSON = new JSONObject();
-
-    try {
-      // getting cluster's Regions
-      responseJSON.put("clusterName", cluster.getServerName());
-      responseJSON.put("userName", userName);
-      responseJSON.put("region", getRegionJson(cluster));
-      // Send json response
-      return responseJSON;
-    } catch (JSONException e) {
-      throw new Exception(e);
-    }
+    ObjectNode responseJSON = mapper.createObjectNode();
+
+    // getting cluster's Regions
+    responseJSON.put("clusterName", cluster.getServerName());
+    responseJSON.put("userName", userName);
+    responseJSON.put("region", getRegionJson(cluster));
+    // Send json response
+    return responseJSON;
   }
 
   /**
@@ -103,9 +96,9 @@ public class ClusterRegionService implements PulseService {
    * all the regions associated with given cluster
    *
    * @param cluster
-   * @return JSONObject Array List
+   * @return ArrayNode Array List
    */
-  private List<JSONObject> getRegionJson(Cluster cluster) throws JSONException {
+  private ArrayNode getRegionJson(Cluster cluster) {
 
     Long totalHeapSize = cluster.getTotalHeapSize();
     Long totalDiskUsage = cluster.getTotalBytesOnDisk();
@@ -117,10 +110,10 @@ public class ClusterRegionService implements PulseService {
 
     Collections.sort(clusterRegionsList, regionEntryCountComparator);
 
-    List<JSONObject> regionListJson = new ArrayList<JSONObject>();
+    ArrayNode regionListJson = mapper.createArrayNode();
     for (int count = 0; count < clusterRegionsList.size(); count++) {
       Cluster.Region reg = clusterRegionsList.get(count);
-      JSONObject regionJSON = new JSONObject();
+      ObjectNode regionJSON = mapper.createObjectNode();
 
       regionJSON.put("name", reg.getName());
       regionJSON.put("totalMemory", totalHeapSize);
@@ -134,7 +127,7 @@ public class ClusterRegionService implements PulseService {
 
       Cluster.Member[] clusterMembersList = cluster.getMembers();
 
-      JSONArray memberNameArray = new JSONArray();
+      ArrayNode memberNameArray = mapper.createArrayNode();
       for (String memberName : reg.getMemberName()) {
         for (Cluster.Member member : clusterMembersList) {
           String name = member.getName();
@@ -143,10 +136,10 @@ public class ClusterRegionService implements PulseService {
           id = id.replace(":", "-");
 
           if ((memberName.equals(id)) || (memberName.equals(name))) {
-            JSONObject regionMember = new JSONObject();
+            ObjectNode regionMember = mapper.createObjectNode();
             regionMember.put("id", member.getId());
             regionMember.put("name", member.getName());
-            memberNameArray.put(regionMember);
+            memberNameArray.add(regionMember);
             break;
           }
         }
@@ -196,26 +189,14 @@ public class ClusterRegionService implements PulseService {
         regionJSON.put("regionPath", reg.getFullPath());
       }
 
-      regionJSON
-          .put(
-              "memoryReadsTrend",
-              new JSONArray(
-                  reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_GETS_PER_SEC_TREND)));
-      regionJSON
-          .put(
-              "memoryWritesTrend",
-              new JSONArray(
-                  reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_PUTS_PER_SEC_TREND)));
-      regionJSON
-          .put(
-              "diskReadsTrend",
-              new JSONArray(
-                  reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_READS_PER_SEC_TREND)));
-      regionJSON
-          .put(
-              "diskWritesTrend",
-              new JSONArray(
-                  reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_WRITES_PER_SEC_TREND)));
+      regionJSON.put("memoryReadsTrend",
+          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_GETS_PER_SEC_TREND)));
+      regionJSON.put("memoryWritesTrend",
+          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_PUTS_PER_SEC_TREND)));
+      regionJSON.put("diskReadsTrend",
+          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_READS_PER_SEC_TREND)));
+      regionJSON.put("diskWritesTrend",
+          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_WRITES_PER_SEC_TREND)));
       regionJSON.put("emptyNodes", reg.getEmptyNode());
       Long entrySize = reg.getEntrySize();
       DecimalFormat form = new DecimalFormat(


Mime
View raw message