Class DFDeploymentStatus


  • public class DFDeploymentStatus
    extends Object
    This class encapsulates all status related to backend deployment Backend deployement can consist of several stages. Those stages are organized in a parent/children relationship where the children are the sub stages of a parent stage. For instance, deployment stage consist of j2eec stage and application loading stage. For a stage to be sucessful, its status and all its children's status must be warning or success
    Author:
    Jerome Dochez
    • Constructor Detail

      • DFDeploymentStatus

        public DFDeploymentStatus()
        Creates a new uninitialized DFDeploymentStatus instance
      • DFDeploymentStatus

        public DFDeploymentStatus​(DFDeploymentStatus parent)
        Creates a new uninitialized DFDeploymentStatus instance as a sub stage deployment status of the passed DFDeploymentStatus
        Parameters:
        parent - DFDeploymentStatus
    • Method Detail

      • getStatus

        public DFDeploymentStatus.Status getStatus()
        Returns:
        the combined status for the stage and its children, it will return the lowest status as defined in the constants
      • addSubStage

        public void addSubStage​(DFDeploymentStatus subStage)
        Add a sub stage to this deployment status
        Parameters:
        subStage - the sub stage deployment status
      • getSubStages

        public Iterator<DFDeploymentStatus> getSubStages()
        Get the list of sub stages for this deployment status
        Returns:
        an Iterator for the sub stages
      • setStageStatus

        public void setStageStatus​(DFDeploymentStatus.Status status)
        Set the status for this stage
        Parameters:
        status - the status as defined in the constants
      • getStageStatus

        public DFDeploymentStatus.Status getStageStatus()
        Returns:
        the status for this stage (ignoring sub stages status)
      • getStageException

        public Throwable getStageException()
        Returns:
        the exception if an exception was thrown during the execution of the stage
      • getStageIdentifier

        public String getStageIdentifier()
        Returns:
        a meaningful i18ned stage description
      • getStageDescription

        public String getStageDescription()
        Returns:
        a meaningful i18ned stage description
      • getStageStatusMessage

        public String getStageStatusMessage()
        Returns:
        a meaningful i18ned reason for failure or warning
      • setStageException

        public void setStageException​(Throwable throwable)
        When the stage throws an exception, it should store it here in the assiciated deployment status
        Parameters:
        throwable -
      • setStageDescription

        public void setStageDescription​(String string)
        Parameters:
        string - for a meaningful i18ned stage description
      • setStageStatusMessage

        public void setStageStatusMessage​(String string)
        Parameters:
        string - for a meaningful i18ned reason for stage warning or failure
      • getStageStatusForLevel

        public DFDeploymentStatus getStageStatusForLevel​(DFDeploymentStatus.Status level)
        Returns:
        the current deployment status or one of the sub stage deployment status with a status equal to the provided level.
      • getParent

        public DFDeploymentStatus getParent()
        Returns:
        the parent status for this status if any
      • setParent

        public void setParent​(DFDeploymentStatus parent)
        Setthe parent status for this status
      • getMainStatus

        public DFDeploymentStatus getMainStatus()
        Returns:
        the main status for this deployment operation, which is the parent of all status in this hierarchy
      • addProperty

        public void addProperty​(String propertyName,
                                String propertyValue)
        Add a new property to this status object
      • getProperty

        public String getProperty​(String propertyName)
        Returns:
        the value of for property name
      • getAdditionalStatus

        public Map getAdditionalStatus()
        Returns:
        the additional status map
      • getAllStageMessages

        public String getAllStageMessages()
      • setAdditionalStatus

        public void setAdditionalStatus​(Map additionalStatus)
        Set the additional status for this status
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        a meaningful string about mysefl
      • getAllStageStatusForLevel

        public static Iterator<DFDeploymentStatus> getAllStageStatusForLevel​(DFDeploymentStatus status,
                                                                             DFDeploymentStatus.Status level)
        Get all stages with this deployment status level
        Parameters:
        status - parent status it needs to iterate through
        level - status level it's looking for
        Returns:
        an iterator for the stages with the level
      • parseDeploymentStatus

        public static void parseDeploymentStatus​(DFDeploymentStatus status,
                                                 PrintWriter pw)
        Traverse through the DeploymenStatus hierarchy and write failure/warning msgs to the print writer