gt:             for (String name : mp.keySet()) {
context: /*
   * Copyright 2015 Cloudius Systems
   */
  package com.cloudius.urchin.api;
  
  import java.io.StringReader;
  import java.net.InetAddress;
  import java.net.UnknownHostException;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  
  import javax.json.Json;
  import javax.json.JsonArray;
  import javax.json.JsonObject;
  import javax.json.JsonReader;
  import javax.json.JsonReaderFactory;
  import javax.json.JsonString;
  import javax.management.openmbean.TabularData;
  import javax.management.openmbean.TabularDataSupport;
  import javax.ws.rs.core.MultivaluedMap;
  import javax.ws.rs.core.UriBuilder;
  
  import com.cloudius.urchin.utils.SnapshotDetailsTabularData;
  import com.sun.jersey.api.client.Client;
  import com.sun.jersey.api.client.WebResource;
  import com.sun.jersey.api.client.WebResource.Builder;
  import com.sun.jersey.api.client.config.ClientConfig;
  import com.sun.jersey.api.client.config.DefaultClientConfig;
  import com.yammer.metrics.core.HistogramValues;
  
  import javax.ws.rs.core.MediaType;
  
  public class APIClient {
      JsonReaderFactory factory = Json.createReaderFactory(null);
      private static final java.util.logging.Logger logger = java.util.logging.Logger
              .getLogger(APIClient.class.getName());
  
      public static String getBaseUrl() {
          return "http://" + System.getProperty("apiaddress", "localhost") + ":"
                  + System.getProperty("apiport", "10000");
      }
  
      public Builder get(String path) {
          ClientConfig config = new DefaultClientConfig();
          Client client = Client.create(config);
          WebResource service = client.resource(UriBuilder.fromUri(getBaseUrl())
                  .build());
          return service.path(path).accept(MediaType.APPLICATION_JSON);
      }
  
      public Builder get(String path, MultivaluedMap<String, String> queryParams) {
          if (queryParams == null) {
              return get(path);
          }
          ClientConfig config = new DefaultClientConfig();
          Client client = Client.create(config);
          WebResource service = client.resource(UriBuilder.fromUri(getBaseUrl())
                  .build());
          return service.queryParams(queryParams).path(path)
                  .accept(MediaType.APPLICATION_JSON);
      }
  
      public void post(String path, MultivaluedMap<String, String> queryParams) {
          if (queryParams != null) {
              get(path, queryParams).post();
              return;
          }
          get(path).post();
      }
  
      public void post(String path) {
          post(path, null);
      }
  
      public String postGetVal(String path, MultivaluedMap<String, String> queryParams) {
          if (queryParams != null) {
              return get(path, queryParams).post(String.class);
          }
          return get(path).post(String.class);
      }
  
      public int postInt(String path, MultivaluedMap<String, String> queryParams) {
          return Integer.parseInt(postGetVal(path, queryParams));
      }
  
      public int postInt(String path) {
          return postInt(path, null);
      }
  
      public void delete(String path, MultivaluedMap<String, String> queryParams) {
          if (queryParams != null) {
              get(path, queryParams).delete();
              return;
          }
          get(path).delete();
      }
  
      public void delete(String path) {
          delete(path, null);
      }
  
      public String getRawValue(String string,
              MultivaluedMap<String, String> queryParams) {
          if (!string.equals("")) {
              return get(string, queryParams).get(String.class);
          }
          return "";
      }
  
      public String getRawValue(String string) {
          return getRawValue(string, null);
      }
  
      public String getStringValue(String string, MultivaluedMap<String, String> queryParams) {
          return getRawValue(string,
                  queryParams).replaceAll("^\"|\"$", "");
      }
  
      public String getStringValue(String string) {
          return getStringValue(string, null);
      }
  
      public JsonReader getReader(String string,
              MultivaluedMap<String, String> queryParams) {
          return factory.createReader(new StringReader(getRawValue(string,
                  queryParams)));
      }
  
      public JsonReader getReader(String string) {
          return getReader(string, null);
      }
  
      public String[] getStringArrValue(String string) {
          List<String> val = getListStrValue(string);
          return val.toArray(new String[val.size()]);
      }
  
      public int getIntValue(String string,
              MultivaluedMap<String, String> queryParams) {
          return Integer.parseInt(getRawValue(string, queryParams));
      }
  
      public int getIntValue(String string) {
          return getIntValue(string, null);
      }
  
      public boolean getBooleanValue(String string) {
          return Boolean.parseBoolean(getRawValue(string));
      }
  
      public double getDoubleValue(String string) {
          return Double.parseDouble(getRawValue(string));
      }
  
      public List<String> getListStrValue(String string,
              MultivaluedMap<String, String> queryParams) {
          JsonReader reader = getReader(string, queryParams);
          JsonArray arr = reader.readArray();
          List<String> res = new ArrayList<String>(arr.size());
          for (int i = 0; i < arr.size(); i++) {
              res.add(arr.getString(i));
          }
          reader.close();
          return res;
  
      }
  
      public List<String> getListStrValue(String string) {
          return getListStrValue(string, null);
  
      }
  
      public static List<String> listStrFromJArr(JsonArray arr) {
          List<String> res = new ArrayList<String>();
          for (int i = 0; i < arr.size(); i++) {
              res.add(arr.getString(i));
          }
          return res;
      }
  
      public static Map<String, String> mapStrFromJArr(JsonArray arr) {
          Map<String, String> res = new HashMap<String, String>();
          for (int i = 0; i < arr.size(); i++) {
              JsonObject obj = arr.getJsonObject(i);
              if (obj.containsKey("key") && obj.containsKey("value")) {
                  res.put(obj.getString("key"), obj.getString("value"));
              }
          }
          return res;
      }
  
      public static String join(String[] arr, String joiner) {
          String res = "";
          if (arr != null) {
              for (String name : arr) {
                  if (name != null && !name.equals("")) {
                      if (!res.equals("")) {
                          res = res + ",";
                      }
                      res = res + name;
                  }
              }
          }
          return res;
      }
  
      public static String join(String[] arr) {
          return join(arr, ",");
      }
  
      public static String mapToString(Map<String, String> mp, String pairJoin,
              String joiner) {
          String res = "";
          if (mp != null) {
  