Author: jmesnil
Date: 2010-01-07 04:49:21 -0500 (Thu, 07 Jan 2010)
New Revision: 8759
Modified:
trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java
trunk/src/main/org/hornetq/api/core/management/ResourceNames.java
trunk/src/main/org/hornetq/api/jms/management/JMSManagementHelper.java
Log:
javadoc
Modified: trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java 2010-01-07
09:38:09 UTC (rev 8758)
+++ trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java 2010-01-07
09:49:21 UTC (rev 8759)
@@ -81,12 +81,30 @@
// Static --------------------------------------------------------
+ /**
+ * Stores a resource attribute in a message to retrieve the value from the server
resource.
+ *
+ * @param message message
+ * @param resourceName the name of the resource
+ * @param attribute the name of the attribute
+ *
+ * @see ResourceNames
+ */
public static void putAttribute(final Message message, final String resourceName,
final String attribute)
{
message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, new
SimpleString(resourceName));
message.putStringProperty(ManagementHelper.HDR_ATTRIBUTE, new
SimpleString(attribute));
}
+ /**
+ * 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
@@ -94,6 +112,16 @@
ManagementHelper.putOperationInvocation(message, resourceName, operationName,
(Object[])null);
}
+ /**
+ * 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 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
+ *
+ * @see ResourceNames
+ */
public static void putOperationInvocation(final Message message,
final String resourceName,
final String operationName,
@@ -271,6 +299,9 @@
}
}
+ /**
+ * Used by HornetQ management service.
+ */
public static Object[] retrieveOperationParameters(final Message message) throws
Exception
{
String jsonString = message.getBodyBuffer().readNullableString();
@@ -287,16 +318,25 @@
}
}
+ /**
+ * Returns whether the JMS message corresponds to the result of a management operation
invocation.
+ */
public static boolean isOperationResult(final Message message)
{
return message.containsProperty(ManagementHelper.HDR_OPERATION_SUCCEEDED);
}
+ /**
+ * 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 void storeResult(final Message message, final Object result) throws
Exception
{
String resultString;
@@ -317,6 +357,12 @@
message.getBodyBuffer().writeNullableString(resultString);
}
+ /**
+ * Returns the result of an operation invocation or an attribute value.
+ *
+ * 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
{
String jsonString = message.getBodyBuffer().readNullableString();
@@ -335,6 +381,12 @@
}
}
+ /**
+ * Returns the result of an operation invocation or an attribute value.
+ *
+ * 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);
@@ -349,6 +401,9 @@
}
}
+ /**
+ * Returns whether the invocation of the management operation on the server resource
succeeded.
+ */
public static boolean hasOperationSucceeded(final Message message)
{
if (!ManagementHelper.isOperationResult(message))
@@ -362,6 +417,9 @@
return false;
}
+ /**
+ * Used by HornetQ management service.
+ */
public static Map<String, Object> fromCommaSeparatedKeyValues(final String str)
throws Exception
{
if (str == null || str.trim().length() == 0)
@@ -375,6 +433,9 @@
return params;
}
+ /**
+ * Used by HornetQ management service.
+ */
public static Object[] fromCommaSeparatedArrayOfCommaSeparatedKeyValues(final String
str) throws Exception
{
if (str == null || str.trim().length() == 0)
Modified: trunk/src/main/org/hornetq/api/core/management/ResourceNames.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/ResourceNames.java 2010-01-07 09:38:09
UTC (rev 8758)
+++ trunk/src/main/org/hornetq/api/core/management/ResourceNames.java 2010-01-07 09:49:21
UTC (rev 8759)
@@ -15,6 +15,9 @@
/**
* Helper class used to build resource names used by management messages.
+ *
+ * Resource's name is build by appending its <em>name</em> to its
corresponding type.
+ * For example, the resource name of the "foo" queue is {@code CORE_QUEUE +
"foo"}.
*
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
*/
Modified: trunk/src/main/org/hornetq/api/jms/management/JMSManagementHelper.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/JMSManagementHelper.java 2010-01-07
09:38:09 UTC (rev 8758)
+++ trunk/src/main/org/hornetq/api/jms/management/JMSManagementHelper.java 2010-01-07
09:49:21 UTC (rev 8759)
@@ -17,9 +17,12 @@
import javax.jms.Message;
import org.hornetq.api.core.management.ManagementHelper;
+import org.hornetq.api.core.management.ResourceNames;
import org.hornetq.jms.client.HornetQMessage;
-/*
+/**
+ * Helper class to use JMS messages to manage HornetQ server resources.
+ *
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*
@@ -44,11 +47,31 @@
return ((HornetQMessage)jmsMessage).getCoreMessage();
}
+ /**
+ * 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);
}
+ /**
+ * 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 resource
+ * @param operationName the name of the operation to invoke on the 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) throws
JMSException
@@ -74,6 +97,17 @@
return jmse;
}
+ /**
+ * 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,
@@ -92,26 +126,47 @@
}
}
+ /**
+ * Returns whether the JMS message corresponds to the result of a management operation
invocation.
+ */
public static boolean isOperationResult(final Message message) throws JMSException
{
return
ManagementHelper.isOperationResult(JMSManagementHelper.getCoreMessage(message));
}
+ /**
+ * Returns whether the JMS message corresponds to the result of a management attribute
value.
+ */
public static boolean isAttributesResult(final Message message) throws JMSException
{
return
ManagementHelper.isAttributesResult(JMSManagementHelper.getCoreMessage(message));
}
+ /**
+ * Returns whether the invocation of the management operation on the server resource
succeeded.
+ */
public static boolean hasOperationSucceeded(final Message message) throws
JMSException
{
return
ManagementHelper.hasOperationSucceeded(JMSManagementHelper.getCoreMessage(message));
}
+ /**
+ * Returns the result of an operation invocation or an attribute value.
+ *
+ * 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
{
return ManagementHelper.getResults(JMSManagementHelper.getCoreMessage(message));
}
+ /**
+ * Returns the result of an operation invocation or an attribute value.
+ *
+ * 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));