/** * Stores a operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * @see ResourceNames */ public static void putOperationInvocation(final Message message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[]) 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 getResult(final Message message) throws Exception { Object[] res = ManagementHelper.getResults(message); if (res != null) { return res[0]; } else { return null; } }
/** * Returns whether the JMS message corresponds to the result of a management attribute value. */ public static boolean isAttributesResult(final Message message) { return !ManagementHelper.isOperationResult(message); }
/** * 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; }
val = ManagementHelper.toJSONArray((Object[]) val); ManagementHelper.checkType(val); jsonArray.put(ManagementHelper.toJSONArray(innerArray)); ManagementHelper.checkType(parameter);
Object[] params = ManagementHelper.retrieveOperationParameters(message); ManagementHelper.storeResult(reply, result); ManagementHelper.storeResult(reply, exceptionMessage); ManagementHelper.storeResult(reply, result); ManagementHelper.storeResult(reply, exceptionMessage);
ManagementHelper.putAttribute(managementMessage, "core.queue." + queue, "ID"); managementSession.start(); ClientMessage reply = requestor.request(managementMessage); long queueID = (Integer) ManagementHelper.getResult(reply); logMessage.append(queue).append(", "); buffer.putLong(queueID);
/** * 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)); }
/** * 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 getResult(final Message message) throws Exception { return ManagementHelper.getResult(JMSManagementHelper.getCoreMessage(message)); }
/** * Stores a resource attribute in a JMS message to retrieve the value from the server resource. * * @param message JMS message * @param resourceName the name of the resource * @param attribute the name of the attribute * @throws JMSException if an exception occurs while putting the information in the message * * @see ResourceNames */ public static void putAttribute(final Message message, final String resourceName, final String attribute) throws JMSException { ManagementHelper.putAttribute(JMSManagementHelper.getCoreMessage(message), resourceName, attribute); }
/** * 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; }
val = ManagementHelper.toJSONArray((Object[])val); ManagementHelper.checkType(val); jsonArray.put(ManagementHelper.toJSONArray(innerArray)); ManagementHelper.checkType(parameter);
Object[] params = ManagementHelper.retrieveOperationParameters(message); ManagementHelper.storeResult(reply, result); ManagementHelper.storeResult(reply, exceptionMessage); ManagementHelper.storeResult(reply, result); ManagementHelper.storeResult(reply, exceptionMessage);
/** * 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)); }
/** * Stores a operation invocation in a message to invoke the corresponding operation the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param operationName the name of the operation to invoke on the resource * * @see ResourceNames */ public static void putOperationInvocation(final Message message, final String resourceName, final String operationName) throws Exception { ManagementHelper.putOperationInvocation(message, resourceName, operationName, (Object[])null); }
/** * Returns whether the JMS message corresponds to the result of a management attribute value. */ public static boolean isAttributesResult(final Message message) { return !ManagementHelper.isOperationResult(message); }
/** * 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); }
/** * 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 getResult(final Message message) throws Exception { Object[] res = ManagementHelper.getResults(message); if (res != null) { return res[0]; } else { return null; } }
JSONArray jsonArray = ManagementHelper.toJSONArray(parameters);
/** * Stores a operation invocation in a JMS message to invoke the corresponding operation the value from the server resource. * * @param message JMS message * @param resourceName the name of the server resource * @param operationName the name of the operation to invoke on the server resource * @param parameters the parameters to use to invoke the server resource * @throws JMSException if an exception occurs while putting the information in the message * * @see ResourceNames */ public static void putOperationInvocation(final Message message, final String resourceName, final String operationName, final Object... parameters) throws JMSException { try { ManagementHelper.putOperationInvocation(JMSManagementHelper.getCoreMessage(message), resourceName, operationName, parameters); } catch (Exception e) { throw JMSManagementHelper.convertFromException(e); } }