org.rhq.core.pluginapi.operation
Class OperationResult

java.lang.Object
  extended by org.rhq.core.pluginapi.operation.OperationResult

public class OperationResult
extends Object

An object that encapsulates the results of a single operation invocation. Since this class contains a Configuration object, it can be used to store complex results. However, if an operation needs to only return a single string result, use the convienence constructor OperationResult(String) or the method setSimpleResult(String) to pass in that simple string value without the need to use the more complex Configuration API.

See Also:
Configuration, OperationFacet

Field Summary
static String SIMPLE_OPERATION_RESULT_NAME
           
 
Constructor Summary
OperationResult()
          Constructor that builds an empty result.
OperationResult(String simpleResult)
          Convienence constructor that builds a result that contains a single, simple result string.
 
Method Summary
 Configuration getComplexResults()
          Returns the Configuration object that is used to contain all the complex data that resulted from an operation invocation.
 String getSimpleResult()
          Gets the simple string result that was stored in this object.
 void setSimpleResult(String simpleResult)
          Use this method if an operation returned a simple string result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMPLE_OPERATION_RESULT_NAME

public static final String SIMPLE_OPERATION_RESULT_NAME
See Also:
Constant Field Values
Constructor Detail

OperationResult

public OperationResult()
Constructor that builds an empty result. You can then use getComplexResults() to obtain the Configuration object in order to populate it with complex results returned by the operation. You are also free to store a simple result by using setSimpleResult(String). Typically, you will normally want to store either a simple result or a complex result, but not both (although technically you are not prohibited from using both).

See Also:
getComplexResults()

OperationResult

public OperationResult(String simpleResult)
Convienence constructor that builds a result that contains a single, simple result string. You can technically still use getComplexResults() to obtain the Configuration object in order to populate it with additional, complex results returned by the operation but, typically, callers that use this constructor only need to store a single result string in the results.

Parameters:
simpleResult - the single, simple result string to store in the results object
See Also:
getSimpleResult()
Method Detail

getSimpleResult

public String getSimpleResult()
Gets the simple string result that was stored in this object.

Returns:
the simple string result
See Also:
OperationResult(String), setSimpleResult(String)

setSimpleResult

public void setSimpleResult(String simpleResult)
Use this method if an operation returned a simple string result. This is a convienence method that places the given result string in the getComplexResults() object under the name SIMPLE_OPERATION_RESULT_NAME.

Parameters:
simpleResult - a simple string result

getComplexResults

public Configuration getComplexResults()
Returns the Configuration object that is used to contain all the complex data that resulted from an operation invocation. The returned object is not a copy, so you can use this object to populate the complex results.

Note that this is the same object that will be populated by the convienence method setSimpleResult(String).

Returns:
the object that will contain the complex results


Copyright © 2008 RHQ Project Advisory Board (Red Hat, Inc. and Hyperic, Inc.). All Rights Reserved.