Interface MdibStorage

  • All Known Implementing Classes:
    MdibStorageImpl

    public interface MdibStorage
    Registry-based access to MdibEntity instances derived from an Mdib.

    In this case "registry-based" means that there is fast (hash map) access to any MdibEntity instance if not mentioned otherwise.

    • Method Detail

      • apply

        WriteDescriptionResult apply​(MdibVersion mdibVersion,
                                     @Nullable
                                     BigInteger mdDescriptionVersion,
                                     @Nullable
                                     BigInteger mdStateVersion,
                                     MdibDescriptionModifications descriptionModifications)
        Applies description modifications on this object regardless of any consistency checks.

        Versions are applied without being verified.

        Parameters:
        mdibVersion - the MDIB version to apply.
        mdDescriptionVersion - the MD description version to apply. Value null leaves version as is.
        mdStateVersion - the MD state version to apply. Value null leaves version as is.
        descriptionModifications - the modifications to apply.
        Returns:
        a result set with inserted, updated and deleted entities.
      • apply

        WriteStateResult apply​(MdibVersion mdibVersion,
                               @Nullable
                               BigInteger mdStateVersion,
                               MdibStateModifications stateModifications)
        Applies state modifications on this object regardless of any consistency checks.

        Versions are applied without being verified.

        Parameters:
        mdibVersion - the MDIB version to apply.
        mdStateVersion - the MD state version to apply. Value null leaves version as is.
        stateModifications - the modifications to apply.
        Returns:
        a result set with updated states.
      • getDescriptor

        <T extends AbstractDescriptorOptional<T> getDescriptor​(String handle,
                                                                 Class<T> descrClass)
        Retrieves a specific descriptor of the hosted Mdib.
        Type Parameters:
        T - any abstract descriptor.
        Parameters:
        handle - Handle name of the descriptor.
        descrClass - Class to cast to. If cast fails, Optional.empty() will be returned.
        Returns:
        Optional of the requested descriptor or Optional.empty() if not found or something went wrong.
      • findEntitiesByType

        <T extends AbstractDescriptorCollection<MdibEntity> findEntitiesByType​(Class<T> type)
        Searches all entities that match a specific type.
        Type Parameters:
        T - the descriptor type defined by the class.
        Parameters:
        type - the class to filter for.
        Returns:
        a collection of entities where type matches.
      • getChildrenByType

        <T extends AbstractDescriptorList<MdibEntity> getChildrenByType​(String handle,
                                                                          Class<T> type)
        Resolves the children of a specific type given a parent handle.
        Type Parameters:
        T - the descriptor type defined by the class.
        Parameters:
        handle - the parent handle of the entity.
        type - The class to filter for.
        Returns:
        a list of children that matches type (while preserving ordering).
      • getRootEntities

        List<MdibEntity> getRootEntities()
        Gets all MdibEntity objects that are root elements.
        Returns:
        the root elements, i.e., entities whose descriptors are of type MdsDescriptor.
      • getState

        Optional<AbstractState> getState​(String handle)
        Retrieves a specific abstract state of the hosted Mdib.
        Parameters:
        handle - the state or descriptor handle of the state to request (descriptor handle is used in case of single states).
        Returns:
        Optional of the requested state or Optional.empty() if not found or something went wrong.
      • getState

        <T extends AbstractStateOptional<T> getState​(String handle,
                                                       Class<T> stateClass)
        Retrieves a specific state of the hosted Mdib.
        Type Parameters:
        T - any abstract state.
        Parameters:
        handle - the state or descriptor handle of the state to request (descriptor handle is used in case of single states).
        stateClass - the class to cast to. If cast fails, Optional.empty() will be returned.
        Returns:
        Optional of the requested state or Optional.empty() if not found or something went wrong.
      • getContextStates

        <T extends AbstractContextStateList<T> getContextStates​(String descriptorHandle,
                                                                  Class<T> stateClass)
        Finds all context states of a certain descriptor given a state class.
        Type Parameters:
        T - any abstract context state.
        Parameters:
        descriptorHandle - the descriptor handle to seek.
        stateClass - the class to filter for.
        Returns:
        a list of the context states of descriptorHandle.
        See Also:
        MdibAccess.getContextStates(String, Class)
      • getMultiStates

        List<AbstractMultiState> getMultiStates​(String descriptorHandle)
        Finds all multi states of a certain handle.
        Parameters:
        descriptorHandle - the descriptor handle to seek.
        Returns:
        a list of the multi states of descriptorHandle.
      • getContextStates

        List<AbstractContextState> getContextStates()
        Gets all context states.

        Attention: collections may be created on function call, hence be careful with performance issues.

        Returns:
        a list of all context states.
      • findContextStatesByType

        <T extends AbstractContextStateList<T> findContextStatesByType​(Class<T> stateClass)
        Gets all context states of a specific type.
        Type Parameters:
        T - the context type to filter for.
        Parameters:
        stateClass - the class information to filter for.
        Returns:
        a list of all context states with the given type.