Package org.glassfish.api
Class ActionReport
- java.lang.Object
-
- org.glassfish.api.ActionReport
-
- All Implemented Interfaces:
Serializable
@Contract public abstract class ActionReport extends Object implements Serializable
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
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classActionReport.ExitCodestatic classActionReport.MessagePart
-
Constructor Summary
Constructors Constructor Description ActionReport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ActionReportaddSubActionsReport()abstract voidappendMessage(String message)voidfailure(Logger logger, String message)Short forfailure(logger,message,null)voidfailure(Logger logger, String message, Throwable e)Report a failure to the logger andActionReport.StringfindProperty(String key)Search in message parts properties then in extra properties and then in sub reports.abstract ActionReport.ExitCodegetActionExitCode()abstract StringgetContentType()PropertiesgetExtraProperties()abstract ThrowablegetFailureCause()abstract StringgetMessage()<T> TgetResultType(Class<T> resultType)Gets a type that was set by the command implementationabstract List<? extends ActionReport>getSubActionsReport()abstract ActionReport.MessagePartgetTopMessagePart()abstract booleanhasFailures()return true if the action report or a subaction report has ExitCode.FAILURE.abstract booleanhasSuccesses()return true if the action report or a subaction report has ExitCode.SUCCESS.abstract booleanhasWarnings()return true if the action report or a subaction report has ExitCode.WARNING.abstract voidsetActionDescription(String message)abstract voidsetActionExitCode(ActionReport.ExitCode exitCode)abstract voidsetContentType(String s)voidsetExtraProperties(Properties properties)abstract voidsetFailureCause(Throwable t)abstract voidsetMessage(InputStream in)abstract voidsetMessage(String message)<T> voidsetResultType(Class<T> resultType, T resultTypeInstance)Stores the supplies type and its instance.abstract voidwriteReport(OutputStream os)
-
-
-
Method Detail
-
setActionDescription
public abstract void setActionDescription(String message)
-
setFailureCause
public abstract void setFailureCause(Throwable t)
-
getFailureCause
public abstract Throwable getFailureCause()
-
setMessage
public abstract void setMessage(String message)
-
appendMessage
public abstract void appendMessage(String message)
-
writeReport
public abstract void writeReport(OutputStream os) throws IOException
- Throws:
IOException
-
setMessage
public abstract void setMessage(InputStream in)
-
getMessage
public abstract 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 String getContentType()
-
setContentType
public abstract void setContentType(String s)
-
getSubActionsReport
public abstract List<? extends ActionReport> getSubActionsReport()
-
failure
public final void failure(Logger logger, String message, Throwable e)
Report a failure to the logger andActionReport. This is more of a convenience to the caller.
-
failure
public final void failure(Logger logger, String message)
Short forfailure(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 Properties getExtraProperties()
-
setExtraProperties
public void setExtraProperties(Properties properties)
-
getResultType
public <T> T getResultType(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(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 typeresultTypeInstance- the actual instance
-
-