Class ActionReport

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    ActionReporter, CliActionReport

    @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
    • Constructor Detail

      • ActionReport

        public ActionReport()
    • 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
        Outputs the formatted information
        Parameters:
        os - The OutputStream to which the information is sent to
        Throws:
        IOException
      • setMessage

        public abstract void setMessage​(InputStream in)
      • getMessage

        public abstract String getMessage()
      • addSubActionsReport

        public abstract ActionReport addSubActionsReport()
      • setActionExitCode

        public abstract void setActionExitCode​(ActionReport.ExitCode exitCode)
        Sets the exit code for the report. Note that subreports may have a different exitcode.
        Parameters:
        exitCode -
      • 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 and ActionReport. This is more of a convenience to the caller.
        Parameters:
        logger -
        message -
        e -
      • hasSuccesses

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

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

        public abstract boolean hasFailures()
        return true if the action report or a subaction report has ExitCode.FAILURE.
        Returns:
      • 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 type
        resultTypeInstance - the actual instance
      • findProperty

        public String findProperty​(String key)
        Search in message parts properties then in extra properties and then in sub reports. Returns first occurrence of the key.
        Parameters:
        key -
        Returns: