Package org.gcube.common.health.api
Class ContextState
java.lang.Object
org.gcube.common.health.api.ContextState
The state of an application in one of its Contexts:
pending before it has been prepared
there, active when it works there, degraded when it works with a problem to verify,
unavailable when it should work there and cannot (a fault), unconfigured when it is
not set up to work there (e.g. it has no configuration in the Context: nothing to fix). A
degraded, unavailable or unconfigured state has a reason, which names the Context,
e.g. "The catalogue cannot reach CKAN in /gcube/devsec/CCP". The health is public: the reason names
what is missing, never a secret.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe value of an application that works in the Context.static final StringThe value of an application that works in the Context with a problem to verify.static final StringThe value of an application not prepared yet in the Context.static final StringThe value of an application that should work in the Context and cannot: a fault.static final StringThe value of an application that is not set up to work in the Context: nothing to fix. -
Method Summary
Modifier and TypeMethodDescriptionstatic ContextStateactive()Returns the state of an application that works in the Context.static ContextStateReturns the state of an application that works in the Context with a problem to verify.booleanReturns the reason of adegraded,unavailableorunconfiguredstate.getValue()Returns the value of the state:pending,active,degraded,unavailableorunconfigured.inthashCode()booleanTells whether the application works in the Context (activeordegraded).static ContextStatepending()Returns the state of an application not prepared yet in the Context.toString()static ContextStateunavailable(String reason) Returns the state of an application that should work in the Context and cannot: a fault (e.g. a backend it needs does not answer), which makes the applicationdegradedin its health.static ContextStateunconfigured(String reason) Returns the state of an application that is not set up to work in the Context (e.g. it has no configuration there): nothing to fix, so it does not change the health of the application.
-
Field Details
-
PENDING
The value of an application not prepared yet in the Context.- See Also:
-
ACTIVE
The value of an application that works in the Context.- See Also:
-
DEGRADED
The value of an application that works in the Context with a problem to verify.- See Also:
-
UNAVAILABLE
The value of an application that should work in the Context and cannot: a fault.- See Also:
-
UNCONFIGURED
The value of an application that is not set up to work in the Context: nothing to fix.- See Also:
-
-
Method Details
-
pending
Returns the state of an application not prepared yet in the Context.- Returns:
- the
pendingstate
-
active
Returns the state of an application that works in the Context.- Returns:
- the
activestate
-
degraded
Returns the state of an application that works in the Context with a problem to verify.- Parameters:
reason- the problem, naming the Context- Returns:
- the
degradedstate
-
unconfigured
Returns the state of an application that is not set up to work in the Context (e.g. it has no configuration there): nothing to fix, so it does not change the health of the application.- Parameters:
reason- why, naming the Context- Returns:
- the
unconfiguredstate
-
getValue
Returns the value of the state:pending,active,degraded,unavailableorunconfigured.- Returns:
- the value
-
getReason
Returns the reason of adegraded,unavailableorunconfiguredstate.- Returns:
- the reason, or
nullforpendingandactive
-
isWorking
public boolean isWorking()Tells whether the application works in the Context (activeordegraded).- Returns:
truewhen it works there
-
equals
-
hashCode
public int hashCode() -
toString
-