/** * Make a prettyprinted JSON text of this JSONArray. * Warning: This method assumes that the data structure is acyclical. * @param indentFactor The number of spaces to add to each level of * indentation. * @return a printable, displayable, transmittable * representation of the object, beginning * with <code>[</code> <small>(left bracket)</small> and ending * with <code>]</code> <small>(right bracket)</small>. * @throws JSONException */ public String toString(final int indentFactor) throws JSONException { return toString(indentFactor, 0); }
/** * Make a pretty-printed JSON text of this JSONArray. Warning: This method assumes that the data * structure is acyclical. * @param indentFactor The number of spaces to add to each level of indentation. * @return a printable, displayable, transmittable representation of the object, beginning with * <code>[</code> <small>(left bracket)</small> and ending with <code>]</code> * <small>(right bracket)</small>. * @throws JSONException */ public String toString(final int indentFactor) throws JSONException { return toString(indentFactor, 0); }
private static String toJSON(final Map<String, Object>[] messages) { JSONArray array = toJSONMsgArray(messages); return array.toString(); }
public String listProducersInfoAsJSON() throws Exception { JSONArray producers = new JSONArray(); for (ServerSession session : server.getSessions()) { session.describeProducersInfo(producers); } return producers.toString(); }
public String listProducersInfoAsJSON() throws Exception { JSONArray producers = new JSONArray(); for (ServerSession session : server.getSessions()) { session.describeProducersInfo(producers); } return producers.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(); }
/** * Used by HornetQ management service. */ public static void storeResult(final Message message, final Object result) throws Exception { String resultString; if (result != null) { // Result is stored in body, also encoded as JSON array of length 1 JSONArray jsonArray = ManagementHelper.toJSONArray(new Object[]{result}); resultString = jsonArray.toString(); } else { resultString = null; } message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(resultString)); }
private static String toJSON(final Map<String, Map<String, Object>[]> messages) { try { JSONArray arrayReturn = new JSONArray(); for (Map.Entry<String, Map<String, Object>[]> entry : messages.entrySet()) { JSONObject objectItem = new JSONObject(); objectItem.put("consumerName", entry.getKey()); objectItem.put("elements", toJSONMsgArray(entry.getValue())); arrayReturn.put(objectItem); } return arrayReturn.toString(); } catch (JSONException e) { return "Invalid conversion " + e.toString(); } }
/** * Used by HornetQ management service. */ public static void storeResult(final Message message, final Object result) throws Exception { String resultString; if (result != null) { // Result is stored in body, also encoded as JSON array of length 1 JSONArray jsonArray = ManagementHelper.toJSONArray(new Object[] { result }); resultString = jsonArray.toString(); } else { resultString = null; } message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(resultString)); }
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 getConnectorPairsAsJSON() throws Exception { clearIO(); try { JSONArray array = new JSONArray(); for (String connector : configuration.getConnectorInfos()) { array.put(connector); } 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 getConnectorPairsAsJSON() throws Exception { clearIO(); try { JSONArray array = new JSONArray(); for (String connector : configuration.getConnectorInfos()) { array.put(connector); } return array.toString(); } finally { blockOnIO(); } }
public String getStaticConnectorsAsJSON() throws Exception { clearIO(); try { List<String> connectors = configuration.getStaticConnectors(); if (connectors == null) { return null; } JSONArray array = new JSONArray(); for (String connector : connectors) { array.put(connector); } 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() 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 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 String listSessionsAsJSON(final String connectionID) throws Exception { checkStarted(); clearIO(); JSONArray array = new JSONArray(); try { List<ServerSession> sessions = server.getHornetQServer().getSessions(connectionID); for (ServerSession sess : sessions) { JSONObject obj = new JSONObject(); obj.put("sessionID", sess.getName()); obj.put("creationTime", sess.getCreationTime()); array.put(obj); } } finally { blockOnIO(); } return array.toString(); }