|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.core.persistence.pool.AbstractBundlePersistenceManager
public abstract class AbstractBundlePersistenceManager
The AbstractBundlePersistenceManager
acts as base for all
persistence managers that store the state in a NodePropBundle
.
BundleCache
that caches already loaded bundles. The other is the
LRUNodeIdCache
that caches non-existent bundles. This is useful
because a lot of exists(NodeId)
calls are issued that would result
in a useless SQL execution if the desired bundle does not exist.
Configuration:bundleCacheSize
" value="8"/>
Field Summary | |
---|---|
protected PMContext |
context
the persistence manager context |
protected static String |
NODEFILENAME
the prefix of a node file |
protected static String |
NODEREFSFILENAME
the prefix of a node references file |
protected static String |
RES_NAME_INDEX
the name of the names-index resource |
protected static String |
RES_NS_INDEX
the name of the namespace-index resource |
Constructor Summary | |
---|---|
AbstractBundlePersistenceManager()
|
Method Summary | |
---|---|
protected StringBuffer |
buildBlobFilePath(StringBuffer buf,
PropertyId id,
int i)
Creates the file path for the given property id and value index that is suitable for storing property values in a filesystem. |
protected StringBuffer |
buildNodeFilePath(StringBuffer buf,
NodeId id)
Creates the file path for the given node id that is suitable for storing node states in a filesystem. |
protected StringBuffer |
buildNodeFolderPath(StringBuffer buf,
NodeId id)
Creates the folder path for the given node id that is suitable for storing states in a filesystem. |
protected StringBuffer |
buildNodeReferencesFilePath(StringBuffer buf,
NodeId id)
Creates the file path for the given references id that is suitable for storing reference states in a filesystem. |
protected StringBuffer |
buildPropFilePath(StringBuffer buf,
PropertyId id)
Creates the folder path for the given property id that is suitable for storing states in a filesystem. |
void |
checkConsistency(String[] uuids,
boolean recursive,
boolean fix)
This implementation does nothing. |
void |
close()
Closes the persistence manager. |
NodeState |
createNew(NodeId id)
Creates a new node state instance with the given id. |
PropertyState |
createNew(PropertyId id)
Creates a new property state instance with the given id. |
protected abstract void |
destroy(NodeReferences refs)
Deletes the node references from the underlying system. |
protected abstract void |
destroyBundle(NodePropBundle bundle)
Deletes the bundle from the underlying system. |
protected void |
evictBundle(NodeId id)
Evicts the bundle with id from the bundle cache. |
boolean |
exists(NodeId id)
Checks whether the identified node exists. |
boolean |
exists(PropertyId id)
Checks whether the identified property exists. |
protected abstract boolean |
existsBundle(NodeId id)
Checks if a bundle exists in the underlying system. |
protected abstract BundleBinding |
getBinding()
Returns the bundle binding that is used for serializing the bundles. |
String |
getBundleCacheSize()
Returns the size of the bundle cache in megabytes. |
StringIndex |
getNameIndex()
Returns the local name index |
StringIndex |
getNsIndex()
Returns the namespace index |
void |
init(PMContext context)
Initializes the persistence manager. |
NodeState |
load(NodeId id)
Load the persistent members of a node state. |
PropertyState |
load(PropertyId id)
Load the persistent members of a property state. |
protected abstract NodePropBundle |
loadBundle(NodeId id)
Loads a bundle from the underlying system. |
void |
onExternalUpdate(ChangeLog changes)
Notifies the persistence manager that an external (cluster) modification occured. |
void |
setBundleCacheSize(String bundleCacheSize)
Sets the size of the bundle cache in megabytes. |
void |
store(ChangeLog changeLog)
Right now, this iterates over all items in the changelog and calls the individual methods that handle single item states or node references objects. |
protected abstract void |
store(NodeReferences refs)
Stores a node references to the underlying system. |
protected abstract void |
storeBundle(NodePropBundle bundle)
Stores a bundle to the underlying system. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.jackrabbit.core.persistence.IterablePersistenceManager |
---|
getAllNodeIds |
Methods inherited from interface org.apache.jackrabbit.core.persistence.PersistenceManager |
---|
existsReferencesTo, loadReferencesTo |
Field Detail |
---|
protected static final String NODEFILENAME
protected static final String NODEREFSFILENAME
protected static final String RES_NAME_INDEX
protected static final String RES_NS_INDEX
protected PMContext context
Constructor Detail |
---|
public AbstractBundlePersistenceManager()
Method Detail |
---|
public String getBundleCacheSize()
public void setBundleCacheSize(String bundleCacheSize)
bundleCacheSize
- the bundle cache size in megabytes.protected StringBuffer buildNodeFolderPath(StringBuffer buf, NodeId id)
buf
- buffer to append to or null
id
- the id of the node
protected StringBuffer buildPropFilePath(StringBuffer buf, PropertyId id)
buf
- buffer to append to or null
id
- the id of the property
protected StringBuffer buildBlobFilePath(StringBuffer buf, PropertyId id, int i)
buf
- buffer to append to or null
id
- the id of the propertyi
- the index of the property value
protected StringBuffer buildNodeFilePath(StringBuffer buf, NodeId id)
buf
- buffer to append to or null
id
- the id of the node
protected StringBuffer buildNodeReferencesFilePath(StringBuffer buf, NodeId id)
buf
- buffer to append to or null
id
- the id of the node
public StringIndex getNsIndex()
IllegalStateException
- if an error occurs.public StringIndex getNameIndex()
IllegalStateException
- if an error occurs.public void onExternalUpdate(ChangeLog changes)
onExternalUpdate
in interface CachingPersistenceManager
changes
- the set of changes of the external modification.protected abstract NodePropBundle loadBundle(NodeId id) throws ItemStateException
id
- the node id of the bundle
null
if the bundle does not
exist.
ItemStateException
- if an error while loading occurs.protected abstract boolean existsBundle(NodeId id) throws ItemStateException
id
- the node id of the bundle
true
if the bundle exists;
false
otherwise.
ItemStateException
- if an error while checking occurs.protected abstract void storeBundle(NodePropBundle bundle) throws ItemStateException
bundle
- the bundle to store
ItemStateException
- if an error while storing occurs.protected abstract void destroyBundle(NodePropBundle bundle) throws ItemStateException
bundle
- the bundle to destroy
ItemStateException
- if an error while destroying occurs.protected abstract void destroy(NodeReferences refs) throws ItemStateException
refs
- the node references to destroy.
ItemStateException
- if an error while destroying occurs.protected abstract void store(NodeReferences refs) throws ItemStateException
refs
- the node references to store.
ItemStateException
- if an error while storing occurs.protected abstract BundleBinding getBinding()
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. Initializes the internal structures of this abstract persistence manager.
init
in interface PersistenceManager
context
- persistence manager context
Exception
- if the persistence manager initialization failedpublic 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. Closes the persistence manager, release acquired resourecs.
close
in interface PersistenceManager
Exception
- if the persistence manager failed to close properlypublic NodeState load(NodeId id) throws NoSuchItemStateException, ItemStateException
load
in interface PersistenceManager
id
- node id
NoSuchItemStateException
- if the node state does not exist
ItemStateException
- if another error occurspublic PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException
load
in interface PersistenceManager
id
- property id
NoSuchItemStateException
- if the property state does not exist
ItemStateException
- if another error occurspublic boolean exists(PropertyId id) throws ItemStateException
exists
in interface PersistenceManager
id
- property id
true
if the property exists,
false
otherwise
ItemStateException
- on persistence manager errorspublic boolean exists(NodeId id) throws ItemStateException
exists
in interface PersistenceManager
id
- node id
true
if the node exists,
false
otherwise
ItemStateException
- on persistence manager errorspublic NodeState createNew(NodeId id)
createNew
in interface PersistenceManager
id
- node id
public PropertyState createNew(PropertyId id)
createNew
in interface PersistenceManager
id
- property id
public void store(ChangeLog changeLog) throws ItemStateException
store
in interface PersistenceManager
changeLog
- change log containing states that were changed
ItemStateException
- if the changes could not be savedpublic void checkConsistency(String[] uuids, boolean recursive, boolean fix)
checkConsistency
in interface PersistenceManager
uuids
- list of UUIDs of nodes to be checked. if null, all nodes will
be checkedrecursive
- if true, the tree(s) below the given node(s) will be traversed
and checked as wellfix
- 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 loggedprotected void evictBundle(NodeId id)
id
from the bundle cache.
id
- the id of the bundle.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |