Package org.jenkinsci.plugins.cloudstats
Class ProvisioningActivity
- java.lang.Object
-
- org.jenkinsci.plugins.cloudstats.ProvisioningActivity
-
- All Implemented Interfaces:
ModelObject
,Comparable<ProvisioningActivity>
public final class ProvisioningActivity extends Object implements ModelObject, Comparable<ProvisioningActivity>
Record of provisioning attempt lifecycle.- Author:
- ogondza.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProvisioningActivity.Id
Activity identifier.static class
ProvisioningActivity.Phase
Progress of an activity.static class
ProvisioningActivity.Status
-
Field Summary
Fields Modifier and Type Field Description static String
PREMATURE_COMPLETION_DETECTED
-
Constructor Summary
Constructors Constructor Description ProvisioningActivity(ProvisioningActivity.Id id)
-
Method Summary
-
-
-
Field Detail
-
PREMATURE_COMPLETION_DETECTED
public static final String PREMATURE_COMPLETION_DETECTED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProvisioningActivity
public ProvisioningActivity(@NonNull ProvisioningActivity.Id id)
-
-
Method Detail
-
getId
@NonNull public ProvisioningActivity.Id getId()
-
getStarted
@NonNull public Date getStarted()
-
getStartedTimestamp
public long getStartedTimestamp()
-
getPhaseExecution
@CheckForNull public PhaseExecution getPhaseExecution(@NonNull ProvisioningActivity.Phase phase)
PhaseExecution
or null in case it is/was not executed.
-
getPhaseExecutions
@NonNull public Map<ProvisioningActivity.Phase,PhaseExecution> getPhaseExecutions()
Get sorted mapping of all phase executions.- Returns:
- Map of
ProvisioningActivity.Phase
and nullablePhaseExecution
.
-
getCurrentPhaseExecution
@NonNull public PhaseExecution getCurrentPhaseExecution()
Get currentPhaseExecution
.
-
getCurrentPhase
@NonNull public ProvisioningActivity.Phase getCurrentPhase()
Get currentProvisioningActivity.Phase
.
-
getStatus
@NonNull public ProvisioningActivity.Status getStatus()
Status of the activity as a whole.It is the works status of any of the phases, OK by default.
-
enter
public void enter(@NonNull ProvisioningActivity.Phase phase)
Make the phase of this activity entered.- Throws:
IllegalArgumentException
- In case phases are entered repeatedly.
-
enterIfNotAlready
public boolean enterIfNotAlready(@NonNull ProvisioningActivity.Phase phase)
Make sure the phase of this activity is entered.Exposed for convenience of clients that can be invoked repeatedly and have no easier way to tell if phase was entered already, such as launch listener.
- Returns:
true
is phase was entered.
-
getName
@CheckForNull public String getName()
-
getDisplayName
@NonNull public String getDisplayName()
- Specified by:
getDisplayName
in interfaceModelObject
-
getPhase
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public PhaseExecution getPhase(@NonNull String phaseName)
-
getDuration
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public long getDuration(@NonNull PhaseExecution execution)
Get duration of the activity phase.- Returns:
- Positive integer in case the phase is completed, negative in case it is in progress
-
isFor
public boolean isFor(ProvisioningActivity.Id id)
-
compareTo
public int compareTo(@NonNull ProvisioningActivity o)
- Specified by:
compareTo
in interfaceComparable<ProvisioningActivity>
-
-