org.glassfish.api
Class ActionReport

java.lang.Object
  extended by org.glassfish.api.ActionReport

@Contract
public abstract class ActionReport
extends java.lang.Object

An action report is an abstract class allowing any type of server side action like a service execution, a command execution to report on its execution to the originator of the action. Implementations of this interface should provide a good reporting experience based on the user's interface like a browser or a command line shell.

Author:
Jerome Dochez

Nested Class Summary
static class ActionReport.ExitCode
           
static class ActionReport.MessagePart
           
 
Constructor Summary
ActionReport()
           
 
Method Summary
abstract  ActionReport addSubActionsReport()
           
abstract  void appendMessage(java.lang.String message)
           
 void failure(java.util.logging.Logger logger, java.lang.String message)
          Short for failure(logger,message,null)
 void failure(java.util.logging.Logger logger, java.lang.String message, java.lang.Throwable e)
          Report a failure to the logger and ActionReport.
abstract  ActionReport.ExitCode getActionExitCode()
           
abstract  java.lang.String getContentType()
           
 java.util.Properties getExtraProperties()
           
abstract  java.lang.Throwable getFailureCause()
           
abstract  java.lang.String getMessage()
           
<T> T
getResultType(java.lang.Class<T> resultType)
          Gets a type that was set by the command implementation
abstract  java.util.List<? extends ActionReport> getSubActionsReport()
           
abstract  ActionReport.MessagePart getTopMessagePart()
           
abstract  boolean hasFailures()
          return true if the action report or a subaction report has ExitCode.FAILURE.
abstract  boolean hasSuccesses()
          return true if the action report or a subaction report has ExitCode.SUCCESS.
abstract  boolean hasWarnings()
          return true if the action report or a subaction report has ExitCode.WARNING.
abstract  void setActionDescription(java.lang.String message)
           
abstract  void setActionExitCode(ActionReport.ExitCode exitCode)
           
abstract  void setContentType(java.lang.String s)
           
 void setExtraProperties(java.util.Properties properties)
           
abstract  void setFailureCause(java.lang.Throwable t)
           
abstract  void setMessage(java.io.InputStream in)
           
abstract  void setMessage(java.lang.String message)
           
<T> void
setResultType(java.lang.Class<T> resultType, T resultTypeInstance)
          Stores the supplies type and its instance.
abstract  void writeReport(java.io.OutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionReport

public ActionReport()
Method Detail

setActionDescription

public abstract void setActionDescription(java.lang.String message)

setFailureCause

public abstract void setFailureCause(java.lang.Throwable t)

getFailureCause

public abstract java.lang.Throwable getFailureCause()

setMessage

public abstract void setMessage(java.lang.String message)

appendMessage

public abstract void appendMessage(java.lang.String message)

writeReport

public abstract void writeReport(java.io.OutputStream os)
                          throws java.io.IOException
Throws:
java.io.IOException

setMessage

public abstract void setMessage(java.io.InputStream in)

getMessage

public abstract java.lang.String getMessage()

getTopMessagePart

public abstract ActionReport.MessagePart getTopMessagePart()

addSubActionsReport

public abstract ActionReport addSubActionsReport()

setActionExitCode

public abstract void setActionExitCode(ActionReport.ExitCode exitCode)

getActionExitCode

public abstract ActionReport.ExitCode getActionExitCode()

getContentType

public abstract java.lang.String getContentType()

setContentType

public abstract void setContentType(java.lang.String s)

getSubActionsReport

public abstract java.util.List<? extends ActionReport> getSubActionsReport()

failure

public final void failure(java.util.logging.Logger logger,
                          java.lang.String message,
                          java.lang.Throwable e)
Report a failure to the logger and ActionReport. This is more of a convenience to the caller.


failure

public final void failure(java.util.logging.Logger logger,
                          java.lang.String message)
Short for failure(logger,message,null)


hasSuccesses

public abstract boolean hasSuccesses()
return true if the action report or a subaction report has ExitCode.SUCCESS.


hasWarnings

public abstract boolean hasWarnings()
return true if the action report or a subaction report has ExitCode.WARNING.


hasFailures

public abstract boolean hasFailures()
return true if the action report or a subaction report has ExitCode.FAILURE.


getExtraProperties

public final java.util.Properties getExtraProperties()

setExtraProperties

public void setExtraProperties(java.util.Properties properties)

getResultType

public <T> T getResultType(java.lang.Class<T> resultType)
Gets a type that was set by the command implementation

Parameters:
resultType - the type requested
Returns:
the actual instance that was set

setResultType

public <T> void setResultType(java.lang.Class<T> resultType,
                              T resultTypeInstance)
Stores the supplies type and its instance. This is a way for the command implementation to pass information between Supplemental command(s) and the main command. For example, the Supplemental command for DeployCommand requires information on pay load, generated directories etc. In this case, the DeployCommand will be expected to set this information in, for example DeployResult, and set it in the ActionReport. The Supplemental Command will then retrieve the DeployResult for its use.

Parameters:
resultType - the type
resultTypeInstance - the actual instance


Copyright © 2012 GlassFish Community. All Rights Reserved.