/** * Used by HornetQ management service. */ public static Map<String, Object> fromCommaSeparatedKeyValues(final String str) throws Exception { if (str == null || str.trim().length() == 0) { return Collections.emptyMap(); } // create a JSON array with 1 object: JSONArray array = new JSONArray("[{" + str + "}]"); Map<String, Object> params = (Map<String, Object>)ManagementHelper.fromJSONArray(array)[0]; return params; }
/** * Used by HornetQ management service. */ public static Map<String, Object> fromCommaSeparatedKeyValues(final String str) throws Exception { if (str == null || str.trim().length() == 0) { return Collections.emptyMap(); } // create a JSON array with 1 object: JSONArray array = new JSONArray("[{" + str + "}]"); Map<String, Object> params = (Map<String, Object>) ManagementHelper.fromJSONArray(array)[0]; return params; }
/** * Used by HornetQ management service. */ public static Object[] fromCommaSeparatedArrayOfCommaSeparatedKeyValues(final String str) throws Exception { if (str == null || str.trim().length() == 0) { return new Object[0]; } String s = str; // if there is a single item, we wrap it in to make it a JSON object if (!s.trim().startsWith("{")) { s = "{" + s + "}"; } JSONArray array = new JSONArray("[" + s + "]"); return ManagementHelper.fromJSONArray(array); }
/** * Used by HornetQ management service. */ public static Object[] fromCommaSeparatedArrayOfCommaSeparatedKeyValues(final String str) throws Exception { if (str == null || str.trim().length() == 0) { return new Object[0]; } String s = str; // if there is a single item, we wrap it in to make it a JSON object if (!s.trim().startsWith("{")) { s = "{" + s + "}"; } JSONArray array = new JSONArray("[" + s + "]"); return ManagementHelper.fromJSONArray(array); }
Object[] inner = ManagementHelper.fromJSONArray((JSONArray) val); innerVal = ManagementHelper.fromJSONArray(((JSONArray) innerVal));
Object[] inner = ManagementHelper.fromJSONArray((JSONArray)val); innerVal = ManagementHelper.fromJSONArray(((JSONArray)innerVal));
/** * Used by HornetQ management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.getBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JSONArray jsonArray = new JSONArray(jsonString); return ManagementHelper.fromJSONArray(jsonArray); } else { return null; } }
/** * Used by HornetQ management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.getBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JSONArray jsonArray = new JSONArray(jsonString); return ManagementHelper.fromJSONArray(jsonArray); } else { return null; } }
/** * Returns the result of an operation invocation or an attribute value. * <br> * If an error occurred on the server, {@link #hasOperationSucceeded(Message)} will return {@code false}. * and the result will be a String corresponding to the server exception. */ public static Object[] getResults(final Message message) throws Exception { SimpleString sstring = message.getBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JSONArray jsonArray = new JSONArray(jsonString); Object[] res = ManagementHelper.fromJSONArray(jsonArray); return res; } else { return null; } }
/** * Returns the result of an operation invocation or an attribute value. * <br> * If an error occurred on the server, {@link #hasOperationSucceeded(Message)} will return {@code false}. * and the result will be a String corresponding to the server exception. */ public static Object[] getResults(final Message message) throws Exception { SimpleString sstring = message.getBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); ; if (jsonString != null) { JSONArray jsonArray = new JSONArray(jsonString); Object[] res = ManagementHelper.fromJSONArray(jsonArray); return res; } else { return null; } }