Class InMemPersistenceManager

  • All Implemented Interfaces:
    PersistenceManager

    @Deprecated
    public class InMemPersistenceManager
    extends AbstractPersistenceManager
    Deprecated.
    Please migrate to a bundle persistence manager (JCR-2802)
    InMemPersistenceManager is a very simple HashMap-based PersistenceManager for Jackrabbit that keeps all data in memory and that is capable of storing and loading its contents using a simple custom binary serialization format (see Serializer).

    It is configured through the following properties:

    • initialCapacity: initial capacity of the hash map used to store the data
    • loadFactor: load factor of the hash map used to store the data
    • persistent: if true the contents of the hash map is loaded on startup and stored on shutdown; if false nothing is persisted
    Please note that this class should only be used for testing purposes.
    • Field Detail

      • initialized

        protected boolean initialized
        Deprecated.
      • stateStore

        protected Map<ItemId,​byte[]> stateStore
        Deprecated.
      • refsStore

        protected Map<NodeId,​byte[]> refsStore
        Deprecated.
      • INITIAL_BUFFER_SIZE

        protected static final int INITIAL_BUFFER_SIZE
        Deprecated.
        See Also:
        Constant Field Values
      • blobStore

        protected BLOBStore blobStore
        Deprecated.
      • wspFS

        protected FileSystem wspFS
        Deprecated.
        file system where the content of the hash maps are read from/written to (if persistent==true)
      • initialCapacity

        protected int initialCapacity
        Deprecated.
      • loadFactor

        protected float loadFactor
        Deprecated.
      • persistent

        protected boolean persistent
        Deprecated.
    • Constructor Detail

      • InMemPersistenceManager

        public InMemPersistenceManager()
        Deprecated.
        Creates a new InMemPersistenceManager instance.
    • Method Detail

      • setInitialCapacity

        public void setInitialCapacity​(int initialCapacity)
        Deprecated.
      • setInitialCapacity

        public void setInitialCapacity​(String initialCapacity)
        Deprecated.
      • getInitialCapacity

        public String getInitialCapacity()
        Deprecated.
      • setLoadFactor

        public void setLoadFactor​(float loadFactor)
        Deprecated.
      • setLoadFactor

        public void setLoadFactor​(String loadFactor)
        Deprecated.
      • getLoadFactor

        public String getLoadFactor()
        Deprecated.
      • isPersistent

        public boolean isPersistent()
        Deprecated.
      • setPersistent

        public void setPersistent​(boolean persistent)
        Deprecated.
      • setPersistent

        public void setPersistent​(String persistent)
        Deprecated.
      • buildBlobFilePath

        protected static String buildBlobFilePath​(String parentUUID,
                                                  Name propName,
                                                  int index)
        Deprecated.
      • loadContents

        public void loadContents()
                          throws Exception
        Deprecated.
        Reads the content of the hash maps from the file system
        Throws:
        Exception - if an error occurs
      • storeContents

        public void storeContents()
                           throws Exception
        Deprecated.
        Writes the content of the hash maps to the file system
        Throws:
        Exception - if an error occurs
      • init

        public void init​(PMContext context)
                  throws Exception
        Deprecated.
        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

        public void close()
                   throws Exception
        Deprecated.
        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
      • exists

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

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

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