Class ContextImpl

    • Field Detail

      • name

        protected String name
        The name of the context.
      • parent

        protected Context parent
        The parent of the context.
      • children

        protected List<Context> children
        The children of the context.
      • history

        protected List<Event> history
        The history events of the context.
      • path

        protected String path
        The hierarchical path of the context, e.g. /gcube/devsec/devVRE.
      • previousPaths

        protected Set<String> previousPaths
        The previous hierarchical paths under which this context still resolves.
      • state

        protected ContextState state
        The state of the context.
      • effectiveState

        protected ContextState effectiveState
        The effective (inherited) state of the context.
      • additionalProperties

        protected Map<String,​Object> additionalProperties
        Additional properties of the context.
      • allowedAdditionalKeys

        protected final Set<String> allowedAdditionalKeys
        A set of keys that are allowed as additional properties, even if they start with '_' or '@'.
    • Constructor Detail

      • ContextImpl

        protected ContextImpl()
        Default constructor.
      • ContextImpl

        public ContextImpl​(UUID uuid)
        Constructs a new context with a given UUID.
        Parameters:
        uuid - The UUID.
      • ContextImpl

        public ContextImpl​(String name)
        Constructs a new context with a given name.
        Parameters:
        name - The name.
      • ContextImpl

        public ContextImpl​(String name,
                           UUID uuid)
        Constructs a new context with a given name and UUID.
        Parameters:
        name - The name.
        uuid - The UUID.
    • Method Detail

      • getName

        public String getName()
        Returns the name of the context.
        Specified by:
        getName in interface Context
        Returns:
        The context name.
      • setName

        public void setName​(String name)
        Sets the name of the context.
        Specified by:
        setName in interface Context
        Parameters:
        name - The name to set.
      • getPath

        public String getPath()
        Returns the hierarchical path of the context, e.g. /gcube/devsec/devVRE.
        Specified by:
        getPath in interface Context
        Returns:
        The path of the context.
      • setPath

        public 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.

        Specified by:
        setPath in interface Context
        Parameters:
        path - The path to set.
      • getPreviousPaths

        public Set<String> getPreviousPaths()
        Returns the set of historical paths this context still answers to.
        Specified by:
        getPreviousPaths in interface Context
        Returns:
        The set of previous paths, never null (empty set by default).
      • setPreviousPaths

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

        public ContextState getState()
        Returns the current state of the context.
        Specified by:
        getState in interface Context
        Returns:
        The context state.
      • setState

        public void setState​(ContextState state)
        Sets the state of the context.
        Specified by:
        setState in interface Context
        Parameters:
        state - The state to set.
      • getEffectiveState

        public ContextState getEffectiveState()
        Returns the current effective state of the context.
        Specified by:
        getEffectiveState in interface Context
        Returns:
        The context effective state.
      • setEffectiveState

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

        The effective state is derived from the context's own Context.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.

        Specified by:
        setEffectiveState in interface Context
        Parameters:
        effectiveState - The effective state to set.
      • getParent

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

        public void setParent​(UUID uuid)
        Sets the parent of this context by its UUID.
        Specified by:
        setParent in interface Context
        Parameters:
        uuid - The UUID of the parent context.
      • setParent

        public void setParent​(Context context)
        Sets the parent of this context.
        Specified by:
        setParent in interface Context
        Parameters:
        context - The parent context.
      • setParentFromJson

        protected void setParentFromJson​(Context context)
        Sets the parent from a JSON-deserialized context object.
        Parameters:
        context - The deserialized parent context.
      • getChildren

        public List<Context> getChildren()
        Returns the children of this context.
        Specified by:
        getChildren in interface Context
        Returns:
        A list of child contexts.
      • setChildrenFromJson

        protected void setChildrenFromJson​(List<Context> children)
        Sets the children from a JSON-deserialized list of contexts.
        Parameters:
        children - The list of deserialized child contexts.
      • addChildFromJson

        protected void addChildFromJson​(Context child)
        Adds a child from a JSON-deserialized context object.
        Parameters:
        child - The deserialized child context.
      • addChild

        public void addChild​(UUID uuid)
        Adds a child to this context by its UUID.
        Specified by:
        addChild in interface Context
        Parameters:
        uuid - The UUID of the child context.
      • addChild

        public void addChild​(Context child)
        Adds a child to this context.
        Specified by:
        addChild in interface Context
        Parameters:
        child - The child context.
      • getHistory

        public List<Event> getHistory()
        Returns the list of history events for this context.
        Specified by:
        getHistory in interface Context
        Returns:
        The history events.
      • setHistory

        public void setHistory​(List<Event> history)
        Sets the history events for this context.
        Specified by:
        setHistory in interface Context
        Parameters:
        history - The history events to set.