Interface PersistenceManager

    • Method Detail

      • init

        void init​(PMContext context)
           throws Exception
        Initializes the persistence manager. The persistence manager is permanently bound to the given context, and any required external resources are acquired.

        An appropriate exception is thrown if the persistence manager initialization fails for whatever reason. In this case the state of the persistence manager is undefined and the instance should be discarded.

        Parameters:
        context - persistence manager context
        Throws:
        Exception - if the persistence manager initialization failed
      • close

        void close()
            throws Exception
        Closes the persistence manager. The consistency of the persistent storage is guaranteed and all acquired resources are released. It is an error to invoke any methods on a closed persistence manager, and implementations are free to enforce this constraint by throwing IllegalStateExceptions in such cases.

        An appropriate exception is thrown if the persistence manager could not be closed properly. In this case the state of the persistence manager is undefined and the instance should be discarded.

        Throws:
        Exception - if the persistence manager failed to close properly
      • createNew

        NodeState createNew​(NodeId id)
        Creates a new node state instance with the given id.
        Parameters:
        id - node id
        Returns:
        node state instance
      • createNew

        PropertyState createNew​(PropertyId id)
        Creates a new property state instance with the given id.
        Parameters:
        id - property id
        Returns:
        property state instance
      • exists

        boolean exists​(NodeId id)
                throws ItemStateException
        Checks whether the identified node exists.
        Parameters:
        id - node id
        Returns:
        true if the node exists, false otherwise
        Throws:
        ItemStateException - on persistence manager errors
      • exists

        boolean exists​(PropertyId id)
                throws ItemStateException
        Checks whether the identified property exists.
        Parameters:
        id - property id
        Returns:
        true if the property exists, false otherwise
        Throws:
        ItemStateException - on persistence manager errors
      • existsReferencesTo

        boolean existsReferencesTo​(NodeId targetId)
                            throws ItemStateException
        Checks whether references of the identified target node exist.
        Parameters:
        targetId - target node id
        Returns:
        true if the references exist, false otherwise
        Throws:
        ItemStateException - on persistence manager errors
      • store

        void store​(ChangeLog changeLog)
            throws ItemStateException
        Atomically saves the given set of changes.
        Parameters:
        changeLog - change log containing states that were changed
        Throws:
        ItemStateException - if the changes could not be saved
      • checkConsistency

        void checkConsistency​(String[] uuids,
                              boolean recursive,
                              boolean fix)
        Perform a consistency check of the data. An example are non-existent nodes referenced in a child node entry. The existence of this feature and the scope of the implementation can vary in different PersistenceManager implementations.
        Parameters:
        uuids - list of UUIDs of nodes to be checked. if null, all nodes will be checked
        recursive - if true, the tree(s) below the given node(s) will be traversed and checked as well
        fix - if true, any problems found that can be repaired will be repaired. if false, no data will be modified, instead all inconsistencies will only get logged