Class ProgressStatusMirroringImpl

  • All Implemented Interfaces:
    Serializable, ProgressStatus

    public class ProgressStatusMirroringImpl
    extends ProgressStatusBase
    This implementation is used for modeling of command execution with supplemental commands. It only mirrors all sizes (total steps and current steps from its children.
    Author:
    mmares
    See Also:
    Serialized Form
    • Method Detail

      • setTotalStepCount

        public void setTotalStepCount​(int totalStepCount)
        Description copied from interface: ProgressStatus
        Number of steps necessary to complete the operation. Value is used to determine percentage of work completed. This method can be used to override the totalStepCount if it was established via the org.glassfish.api.Progress annotation. The total step count is used as the denominator for computing the completion percentage as reported in the command's progress output: percent complete = current step count / total step count * 100 Note the above formula is a bit more complex when child ProgressStatus objects are in use.

        The total step count can be changed after being set but may result in the completion percentage jumping (forward or backwards).

        If the total step count is not set then a completion percentage will not be available.

        It can be also set during injection using totalStepCount parameter in org.glassfish.api.Progress annotation.

        Specified by:
        setTotalStepCount in interface ProgressStatus
        Overrides:
        setTotalStepCount in class ProgressStatusBase
        Parameters:
        totalStepCount - non-negative value defines denominator for the percentage computation
      • progress

        public void progress​(int steps,
                             String message)
        Description copied from interface: ProgressStatus
        Indicates progress occurred. The steps taken will be used to reduce the remaining step count. If the number of steps taken exceeds the total step count the current step count will be normalized to the total step count. This avoids the completion percentage ever exceeding 100%. The message will be sent to the client along with the completion percentage if it can be computed.
        Specified by:
        progress in interface ProgressStatus
        Overrides:
        progress in class ProgressStatusBase
        Parameters:
        steps - the number of steps taken. Negative steps will reduce the completion percentage. Never to non-negative value.
        message - to be displayed by the client.
      • setCurrentStepCount

        public void setCurrentStepCount​(int stepCount)
        Description copied from interface: ProgressStatus
        This allows the current step count to be changed to a specific value, for example when an error occurs and the command must repeat a set of operations.
        This will likely result in the overall completion percentage jumping when the next progress() message is generated. If child ProgressStatus objects exist care must be taken when changing the step count value to account for steps allocated to children. Generally the current step count should not be advanced beyond the number of steps allocated to child ProgressStatus objects.
        Specified by:
        setCurrentStepCount in interface ProgressStatus
        Overrides:
        setCurrentStepCount in class ProgressStatusBase
        Parameters:
        stepCount - new stepCount value. Negative is normalized to 0 greater than the total step count is normalized to the total step count