Class ContextState

java.lang.Object
org.gcube.common.health.api.ContextState

public final class ContextState extends Object
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, inactive when it cannot work there. A degraded or inactive state has a reason, which names the Context, e.g. "CKAN not found or not configured in /gcube/devsec/CCP". The health is public: the reason names what is missing, never a secret.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The value of an application that works in the Context.
    static final String
    The value of an application that works in the Context with a problem to verify.
    static final String
    The value of an application that cannot work in the Context.
    static final String
    The value of an application not prepared yet in the Context.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the state of an application that works in the Context.
    degraded(String reason)
    Returns the state of an application that works in the Context with a problem to verify.
    boolean
    equals(Object other)
     
    Returns the reason of a degraded or inactive state.
    Returns the value of the state: pending, active, degraded or inactive.
    int
     
    inactive(String reason)
    Returns the state of an application that cannot work in the Context.
    boolean
    Tells whether the application works in the Context (active or degraded).
    Returns the state of an application not prepared yet in the Context.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • PENDING

      public static final String PENDING
      The value of an application not prepared yet in the Context.
      See Also:
    • ACTIVE

      public static final String ACTIVE
      The value of an application that works in the Context.
      See Also:
    • DEGRADED

      public static final String DEGRADED
      The value of an application that works in the Context with a problem to verify.
      See Also:
    • INACTIVE

      public static final String INACTIVE
      The value of an application that cannot work in the Context.
      See Also:
  • Method Details

    • pending

      public static ContextState pending()
      Returns the state of an application not prepared yet in the Context.
      Returns:
      the pending state
    • active

      public static ContextState active()
      Returns the state of an application that works in the Context.
      Returns:
      the active state
    • degraded

      public static ContextState degraded(String reason)
      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 degraded state
    • inactive

      public static ContextState inactive(String reason)
      Returns the state of an application that cannot work in the Context.
      Parameters:
      reason - why, naming the Context
      Returns:
      the inactive state
    • getValue

      public String getValue()
      Returns the value of the state: pending, active, degraded or inactive.
      Returns:
      the value
    • getReason

      public String getReason()
      Returns the reason of a degraded or inactive state.
      Returns:
      the reason, or null for pending and active
    • isWorking

      public boolean isWorking()
      Tells whether the application works in the Context (active or degraded).
      Returns:
      true when it works there
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object