/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param value A Map value. * @return this. */ public JSONArray put(final Map value) { put(new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param value A Map value. * @return this. */ public JSONArray put(final Map value) { put(new JSONObject(value)); return this; }
/** * Put a key/value pair in the JSONObject, where the value will be a * JSONObject which is produced from a Map. * @param key A key string. * @param value A Map value. * @return this. * @throws JSONException */ public JSONObject put(final String key, final Map value) throws JSONException { put(key, new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param index The subscript. * @param value The Map value. * @return this. * @throws JSONException If the index is negative or if the the value is * an invalid number. */ public JSONArray put(final int index, final Map value) throws JSONException { put(index, new JSONObject(value)); return this; }
/** * Put a key/value pair in the JSONObject, where the value will be a * JSONObject which is produced from a Map. * @param key A key string. * @param value A Map value. * @return this. * @throws JSONException */ public JSONObject put(final String key, final Map value) throws JSONException { put(key, new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param index The subscript. * @param value The Map value. * @return this. * @throws JSONException If the index is negative or if the the value is * an invalid number. */ public JSONArray put(final int index, final Map value) throws JSONException { put(index, new JSONObject(value)); return this; }
private static JSONArray toJSONMsgArray(final Map<String, Object>[] messages) { JSONArray array = new JSONArray(); for (Map<String, Object> message : messages) { array.put(new JSONObject(message)); } return array; }
public static String toJSon(final MessageCounter counter) throws Exception { DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); JSONObject json = new JSONObject(counter); String lastAddTimestamp = dateFormat.format(new Date(counter.getLastAddedMessageTime())); json.put("lastAddTimestamp", lastAddTimestamp); String updateTimestamp = dateFormat.format(new Date(counter.getLastUpdate())); json.put("updateTimestamp", updateTimestamp); return json.toString(); }
/** * Returns a JSON String serialization of a {@link MessageCounter} object. * @param counter * @return * @throws Exception */ public static String toJSon(final MessageCounter counter) throws Exception { DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); JSONObject json = new JSONObject(counter); String lastAddTimestamp = dateFormat.format(new Date(counter.getLastAddedMessageTime())); json.put("lastAddTimestamp", lastAddTimestamp); String updateTimestamp = dateFormat.format(new Date(counter.getLastUpdate())); json.put("updateTimestamp", updateTimestamp); return json.toString(); }
static String toJSON(final Map<String, Object>[] messages) { JSONArray array = new JSONArray(); for (Map<String, Object> message : messages) { array.put(new JSONObject(message)); } return array.toString(); }
private static String toJSON(final Map<String, Object>[] messages) { JSONArray array = new JSONArray(); for (Map<String, Object> message : messages) { array.put(new JSONObject(message)); } return array.toString(); }
public static String toJSON(final DayCounterInfo[] infos) throws JSONException { JSONObject json = new JSONObject(); JSONArray counters = new JSONArray(); for (DayCounterInfo info : infos) { JSONObject counter = new JSONObject(); counter.put("date", info.getDate()); counter.put("counters", Arrays.asList(info.getCounters())); counters.put(counter); } json.put("dayCounters", counters); return json.toString(); }
public static String toJSON(final DayCounterInfo[] infos) throws JSONException { JSONObject json = new JSONObject(); JSONArray counters = new JSONArray(); for (DayCounterInfo info : infos) { JSONObject counter = new JSONObject(); counter.put("date", info.getDate()); counter.put("counters", Arrays.asList(info.getCounters())); counters.put(counter); } json.put("dayCounters", counters); return json.toString(); }
@Override public void describeProducersInfo(JSONArray array) throws Exception { Map<SimpleString, Pair<UUID, AtomicLong>> targetCopy = cloneTargetAddresses(); for (Map.Entry<SimpleString, Pair<UUID, AtomicLong>> entry : targetCopy.entrySet()) { JSONObject producerInfo = new JSONObject(); producerInfo.put("connectionID", this.getConnectionID().toString()); producerInfo.put("sessionID", this.getName()); producerInfo.put("destination", entry.getKey().toString()); producerInfo.put("lastUUIDSent", entry.getValue().getA()); producerInfo.put("msgSent", entry.getValue().getB().longValue()); array.put(producerInfo); } }
public void describeProducersInfo(JSONArray array) throws Exception { Map<SimpleString, Pair<UUID, AtomicLong>> targetCopy = cloneTargetAddresses(); for (Map.Entry<SimpleString, Pair<UUID, AtomicLong>> entry : targetCopy.entrySet()) { JSONObject producerInfo = new JSONObject(); producerInfo.put("connectionID", this.getConnectionID().toString()); producerInfo.put("sessionID", this.getName()); producerInfo.put("destination", entry.getKey().toString()); producerInfo.put("lastUUIDSent", entry.getValue().getA()); producerInfo.put("msgSent", entry.getValue().getB().longValue()); array.put(producerInfo); } }
public String getConnectorsAsJSON() throws Exception { checkStarted(); clearIO(); try { JSONArray array = new JSONArray(); for (TransportConfiguration config : configuration.getConnectorConfigurations().values()) { array.put(new JSONObject(config)); } return array.toString(); } finally { blockOnIO(); } }
public String getConnectorsAsJSON() throws Exception { checkStarted(); clearIO(); try { JSONArray array = new JSONArray(); for (TransportConfiguration config : configuration.getConnectorConfigurations().values()) { array.put(new JSONObject(config)); } return array.toString(); } finally { blockOnIO(); } }
public String getRolesAsJSON() throws Exception { clearIO(); try { JSONArray json = new JSONArray(); Set<Role> roles = securityRepository.getMatch(address.toString()); for (Role role : roles) { json.put(new JSONObject(role)); } return json.toString(); } finally { blockOnIO(); } }
public String getRolesAsJSON(final String addressMatch) throws Exception { checkStarted(); clearIO(); try { JSONArray json = new JSONArray(); Set<Role> roles = server.getSecurityRepository().getMatch(addressMatch); for (Role role : roles) { json.put(new JSONObject(role)); } return json.toString(); } finally { blockOnIO(); } }
public static final AddressSettingsInfo from(final String jsonString) throws Exception { JSONObject object = new JSONObject(jsonString); return new AddressSettingsInfo(object.getString("addressFullMessagePolicy"), object.getLong("maxSizeBytes"), object.getInt("pageSizeBytes"), object.getInt("pageCacheMaxSize"), object.getInt("maxDeliveryAttempts"), object.getLong("redeliveryDelay"), object.getString("DLA"), object.getString("expiryAddress"), object.getBoolean("lastValueQueue"), object.getLong("redistributionDelay"), object.getBoolean("sendToDLAOnNoRoute")); }