|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.persistence.AbstractPersistenceManager
org.apache.jackrabbit.core.persistence.mem.InMemPersistenceManager
public class InMemPersistenceManager
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).
initialCapacity: initial capacity of the hash map used to store the dataloadFactor: load factor of the hash map used to store the datapersistent: if true the contents of the hash map
is loaded on startup and stored on shutdown;
if false nothing is persisted
| Field Summary | |
|---|---|
protected FileSystem |
blobFS
|
protected BLOBStore |
blobStore
|
protected static int |
INITIAL_BUFFER_SIZE
|
protected int |
initialCapacity
|
protected boolean |
initialized
|
protected float |
loadFactor
|
protected static byte |
NODE_ENTRY
|
protected boolean |
persistent
|
protected static byte |
PROP_ENTRY
|
protected static String |
REFS_FILE_PATH
|
protected Map<NodeId,byte[]> |
refsStore
|
protected static String |
STATE_FILE_PATH
|
protected Map<ItemId,byte[]> |
stateStore
|
protected FileSystem |
wspFS
file system where the content of the hash maps are read from/written to (if persistent==true) |
| Constructor Summary | |
|---|---|
InMemPersistenceManager()
Creates a new InMemPersistenceManager instance. |
|
| Method Summary | |
|---|---|
protected static String |
buildBlobFilePath(String parentUUID,
Name propName,
int index)
|
void |
close()
Closes the persistence manager. |
protected void |
destroy(NodeReferences refs)
Destroy a node references object. |
protected void |
destroy(NodeState state)
Destroy a node state. |
protected void |
destroy(PropertyState state)
Destroy a property state. |
boolean |
exists(NodeId id)
Checks whether the identified node exists. |
boolean |
exists(PropertyId id)
Checks whether the identified property exists. |
boolean |
existsReferencesTo(NodeId id)
Checks whether references of the identified target node exist. |
String |
getInitialCapacity()
|
String |
getLoadFactor()
|
void |
init(PMContext context)
Initializes the persistence manager. |
boolean |
isPersistent()
|
NodeState |
load(NodeId id)
Load the persistent members of a node state. |
PropertyState |
load(PropertyId id)
Load the persistent members of a property state. |
void |
loadContents()
Reads the content of the hash maps from the file system |
NodeReferences |
loadReferencesTo(NodeId id)
Load the persisted references to the node with the given identifier. |
void |
setInitialCapacity(int initialCapacity)
|
void |
setInitialCapacity(String initialCapacity)
|
void |
setLoadFactor(float loadFactor)
|
void |
setLoadFactor(String loadFactor)
|
void |
setPersistent(boolean persistent)
|
void |
setPersistent(String persistent)
|
protected void |
store(NodeReferences refs)
Store a references object. |
protected void |
store(NodeState state)
Store a node state. |
protected void |
store(PropertyState state)
Store a property state. |
void |
storeContents()
Writes the content of the hash maps to the file system |
| Methods inherited from class org.apache.jackrabbit.core.persistence.AbstractPersistenceManager |
|---|
checkConsistency, createNew, createNew, store |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean initialized
protected Map<ItemId,byte[]> stateStore
protected Map<NodeId,byte[]> refsStore
protected static final int INITIAL_BUFFER_SIZE
protected static final String STATE_FILE_PATH
protected static final String REFS_FILE_PATH
protected static final byte NODE_ENTRY
protected static final byte PROP_ENTRY
protected FileSystem blobFS
protected BLOBStore blobStore
protected FileSystem wspFS
persistent==true)
protected int initialCapacity
protected float loadFactor
protected boolean persistent
| Constructor Detail |
|---|
public InMemPersistenceManager()
InMemPersistenceManager instance.
| Method Detail |
|---|
public void setInitialCapacity(int initialCapacity)
public void setInitialCapacity(String initialCapacity)
public String getInitialCapacity()
public void setLoadFactor(float loadFactor)
public void setLoadFactor(String loadFactor)
public String getLoadFactor()
public boolean isPersistent()
public void setPersistent(boolean persistent)
public void setPersistent(String persistent)
protected static String buildBlobFilePath(String parentUUID,
Name propName,
int index)
public void loadContents()
throws Exception
Exception - if an error occurs
public void storeContents()
throws Exception
Exception - if an error occurs
public void init(PMContext context)
throws Exception
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.
context - persistence manager context
Exception - if the persistence manager initialization failed
public void close()
throws Exception
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.
Exception - if the persistence manager failed to close properly
public NodeState load(NodeId id)
throws NoSuchItemStateException,
ItemStateException
id - node id
NoSuchItemStateException - if the node state does not exist
ItemStateException - if another error occurs
public PropertyState load(PropertyId id)
throws NoSuchItemStateException,
ItemStateException
id - property id
NoSuchItemStateException - if the property state does not exist
ItemStateException - if another error occurs
protected void store(NodeState state)
throws ItemStateException
store in class AbstractPersistenceManagerstate - node state to store
ItemStateException - if an error occurs
protected void store(PropertyState state)
throws ItemStateException
store in class AbstractPersistenceManagerstate - property state to store
ItemStateException - if an error occurs
protected void destroy(NodeState state)
throws ItemStateException
destroy in class AbstractPersistenceManagerstate - node state to destroy
ItemStateException - if an error occurs
protected void destroy(PropertyState state)
throws ItemStateException
destroy in class AbstractPersistenceManagerstate - property state to destroy
ItemStateException - if an error occurs
public NodeReferences loadReferencesTo(NodeId id)
throws NoSuchItemStateException,
ItemStateException
id - reference target node id
NoSuchItemStateException - if the target node does not exist
ItemStateException - if another error occurs
protected void store(NodeReferences refs)
throws ItemStateException
store in class AbstractPersistenceManagerrefs - references object to store
ItemStateException - if an error occurs
protected void destroy(NodeReferences refs)
throws ItemStateException
destroy in class AbstractPersistenceManagerrefs - node references object to destroy
ItemStateException - if an error occurs
public boolean exists(PropertyId id)
throws ItemStateException
id - property id
true if the property exists,
false otherwise
ItemStateException - on persistence manager errors
public boolean exists(NodeId id)
throws ItemStateException
id - node id
true if the node exists,
false otherwise
ItemStateException - on persistence manager errors
public boolean existsReferencesTo(NodeId id)
throws ItemStateException
id - target node id
true if the references exist,
false otherwise
ItemStateException - on persistence manager errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||