All Superinterfaces:
Element, EntityElement, IdentifiableElement, SchemaMixedElement, Serializable
All Known Implementing Classes:
ContextImpl

@TypeMetadata(name="Context", description="Represents a Context, the hierarchical grouping mechanism for resources; contexts form a tree structure and have a lifecycle managed by their state.", version="1.0.0") @Change(version="1.0.0", description="First Version") public interface Context extends EntityElement, SchemaMixedElement
Represents a context, which is a hierarchical grouping mechanism for resources.

Contexts form a tree structure and have a lifecycle managed by their state.

Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • NAME

      static final String NAME
      The name of the Context entity type.
      See Also:
    • NAME_PROPERTY

      static final String NAME_PROPERTY
      The property name for the context's name.
      See Also:
    • NAME_REGEX

      static final String NAME_REGEX
      The regular expression defining valid characters for a Context name.
      See Also:
    • PATH

      static final String PATH
      The property name for the computed hierarchical path of the context, e.g. /gcube/devsec/devVRE.

      This value is persisted by the resource-registry at creation, rename, and reparent time so that deleted (cemetery) contexts retain their last known path even after the ChildOf edges have been severed.

      See Also:
    • PREVIOUS_PATHS

      static final String PREVIOUS_PATHS
      The property name for the previous hierarchical paths under which this context still resolves.
      See Also:
    • STATE

      static final String STATE
      The property name for the state of the context.

      The resource-registry manages the following states:

      • created: A newly created context.
      • active: An operational context.
      • deleted: A context marked for deletion.
      Other states can be defined and managed by a Manager.
      See Also:
    • EFFECTIVE_STATE

      static final String EFFECTIVE_STATE
      The property name for the effective (inherited) state of the context.

      The effective state is derived from the context's own STATE and the effective state of its parent chain. A context is SUSPENDED when any ancestor is CREATED or SUSPENDED, regardless of the context's own local state.

      See Also:
    • PARENT_PROPERTY

      static final String PARENT_PROPERTY
      The property name for the parent relationship.
      See Also:
    • CHILDREN_PROPERTY

      static final String CHILDREN_PROPERTY
      The property name for the children relationships.
      See Also:
    • HISTORY

      static final String HISTORY
      The property name for the context history events.
      See Also:
  • Method Details

    • getName

      @ISProperty(name="name", mandatory=true) String getName()
      Returns the name of the context.
      Returns:
      The context name.
    • setName

      void setName(String name)
      Sets the name of the context.
      Parameters:
      name - The name to set.
    • getPath

      String getPath()
      Returns the hierarchical path of the context, e.g. /gcube/devsec/devVRE.
      Returns:
      The path of the context.
    • setPath

      void setPath(String path)
      Sets the hierarchical path of the context.

      This method is intended for internal use by the resource-registry to persist the path at creation, rename, and reparent time. It is not expected to be called by external clients, and may not perform any path validation or recomputation.

      Parameters:
      path - The path to set.
    • getPreviousPaths

      @ISProperty(name="previousPaths", mandatory=false) Set<String> getPreviousPaths()
      Returns the set of historical paths this context still answers to.
      Returns:
      The set of previous paths, never null (empty set by default).
    • setPreviousPaths

      void setPreviousPaths(Set<String> previousPaths)
      Sets the set of historical paths this context still answers to.
      Parameters:
      previousPaths - The set of previous paths to set.
    • getState

      @ISProperty(name="state", mandatory=true) ContextState getState()
      Returns the current state of the context.
      Returns:
      The context state.
    • setState

      void setState(ContextState state)
      Sets the state of the context.
      Parameters:
      state - The state to set.
    • getEffectiveState

      @ISProperty(name="effectiveState", mandatory=true) ContextState getEffectiveState()
      Returns the current effective state of the context.
      Returns:
      The context effective state.
    • setEffectiveState

      void setEffectiveState(ContextState state)
      Sets the effective state of the context.

      The effective state is derived from the context's own STATE and the effective state of its parent chain. A context is SUSPENDED when any ancestor is CREATED or SUSPENDED, regardless of the context's own local state. This method is intended for internal use by the resource-registry to persist the effective state at creation, rename, reparent, and state change time. It is not expected to be called by external clients, and may not perform any effective state recomputation based on the parent chain.

      Parameters:
      state - The effective state to set.
    • getParent

      Context getParent()
      Returns the parent of this context.
      Returns:
      The parent context, or null if this is a root context.
    • setParent

      void setParent(UUID uuid)
      Sets the parent of this context by its UUID.
      Parameters:
      uuid - The UUID of the parent context.
    • setParent

      void setParent(Context context)
      Sets the parent of this context.
      Parameters:
      context - The parent context.
    • getChildren

      List<Context> getChildren()
      Returns the children of this context.
      Returns:
      A list of child contexts.
    • addChild

      void addChild(UUID uuid)
      Adds a child to this context by its UUID.
      Parameters:
      uuid - The UUID of the child context.
    • addChild

      void addChild(Context child)
      Adds a child to this context.
      Parameters:
      child - The child context.
    • getHistory

      @ISProperty(name="history", mandatory=false) List<Event> getHistory()
      Returns the list of history events for this context.
      Returns:
      The history events.
    • setHistory

      void setHistory(List<Event> history)
      Sets the history events for this context.
      Parameters:
      history - The history events to set.
    • getAdditionalProperties

      Map<String,Object> getAdditionalProperties()
      Returns a map of all additional properties not defined in the schema.
      Specified by:
      getAdditionalProperties in interface SchemaMixedElement
      Returns:
      A Map containing the additional properties, where the key is the property name and the value is the property value.
    • setAdditionalProperties

      void setAdditionalProperties(Map<String,Object> additionalProperties)
      Sets the map of additional properties for the element.
      Specified by:
      setAdditionalProperties in interface SchemaMixedElement
      Parameters:
      additionalProperties - A Map of additional properties.
    • getAdditionalProperty

      Object getAdditionalProperty(String key)
      Retrieves a single additional property by its key.
      Specified by:
      getAdditionalProperty in interface SchemaMixedElement
      Parameters:
      key - The name of the additional property to retrieve.
      Returns:
      The value of the property, or null if the key is not found.
    • setAdditionalProperty

      void setAdditionalProperty(String key, Object value)
      Sets a single additional property.
      Specified by:
      setAdditionalProperty in interface SchemaMixedElement
      Parameters:
      key - The name of the additional property.
      value - The value of the additional property.