public class BundleFsPersistenceManager extends AbstractBundlePersistenceManager
NodePropBundle
s
in a filesystem.
Configuration:
blobFSBlockSize
" value="0"/>
minBlobSize
" value="4096"/>
errorHandling
" value=""/>
Modifier and Type | Class and Description |
---|---|
protected static interface |
BundleFsPersistenceManager.CloseableBLOBStore
Helper interface for closeable stores
|
Modifier and Type | Field and Description |
---|---|
protected BundleBinding |
binding
the bundle binding
|
protected BundleFsPersistenceManager.CloseableBLOBStore |
blobStore
file system where BLOB data is stored
|
protected ErrorHandling |
errorHandling
flag for error handling
|
protected boolean |
initialized
flag indicating if this manager was initialized
|
context, NODEFILENAME, NODEREFSFILENAME, RES_NAME_INDEX, RES_NS_INDEX
ACCESS_INTERVAL
Constructor and Description |
---|
BundleFsPersistenceManager() |
Modifier and Type | Method and Description |
---|---|
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 |
buildNodeReferencesFilePath(StringBuffer buf,
NodeId id)
Creates the file path for the given references id that is
suitable for storing reference states in a filesystem.
|
void |
close()
Closes the persistence manager.
|
void |
destroy(NodeReferences refs)
Deletes the node references from the underlying system.
|
protected void |
destroyBundle(NodePropBundle bundle)
Deletes the bundle from the underlying system.
|
boolean |
existsReferencesTo(NodeId targetId)
Checks whether references of the identified target node exist.
|
List<NodeId> |
getAllNodeIds(NodeId bigger,
int maxCount)
Get all node ids.
|
String |
getBlobFSBlockSize()
Returns the configured block size of the blob cqfs
|
protected BLOBStore |
getBlobStore()
Returns the BLOB store used by this persistence manager.
|
String |
getErrorHandling()
Returns the error handling configuration of this manager
|
protected NodeId |
getIdFromFileName(String fileName) |
String |
getMinBlobSize()
Returns the mininum blob size.
|
void |
init(PMContext context)
Initializes the persistence manager.
|
protected NodePropBundle |
loadBundle(NodeId id)
Loads a bundle from the underlying system.
|
NodeReferences |
loadReferencesTo(NodeId targetId)
Load the persisted references to the node with the given identifier.
|
protected void |
logException(String message,
SQLException se)
logs an sql exception
|
void |
setBlobFSBlockSize(String size)
Sets the block size of the blob fs and controls how blobs are handled.
|
void |
setErrorHandling(String errorHandling)
Sets the error handling behaviour of this manager.
|
void |
setMinBlobSize(String minBlobSize)
Sets the minimum blob size.
|
void |
store(NodeReferences refs)
Stores a node references to the underlying system.
|
protected void |
storeBundle(NodePropBundle bundle)
Stores a bundle to the underlying system.
|
String |
toString() |
boolean |
useLocalFsBlobStore()
Returns
true if the blobs are stored in the local fs. |
buildBlobFilePath, buildNodeFolderPath, buildPropFilePath, cacheAccessed, check, checkConsistency, createNew, createNew, disposeCache, evictBundle, exists, exists, getAllNodeInfos, getBundleCacheSize, getNameIndex, getNsIndex, load, load, onExternalUpdate, setBundleCacheSize, setEventChannel, store
protected boolean initialized
protected BundleFsPersistenceManager.CloseableBLOBStore blobStore
protected ErrorHandling errorHandling
protected BundleBinding binding
public String getBlobFSBlockSize()
public void setBlobFSBlockSize(String size)
getMinBlobSize()
.size
- the block sizepublic boolean useLocalFsBlobStore()
true
if the blobs are stored in the local fs.true
if the blobs are stored in the local fs.public String getMinBlobSize()
public void setMinBlobSize(String minBlobSize)
minBlobSize
- public void setErrorHandling(String errorHandling)
ErrorHandling
for details about the flags.errorHandling
- public String getErrorHandling()
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
init
in class AbstractBundlePersistenceManager
context
- persistence manager contextException
- if the persistence manager initialization failedprotected BLOBStore getBlobStore()
getBlobStore
in class AbstractBundlePersistenceManager
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. Closes the persistence manager, release acquired resources.
close
in interface PersistenceManager
close
in class AbstractBundlePersistenceManager
Exception
- if the persistence manager failed to close properlyprotected NodePropBundle loadBundle(NodeId id) throws ItemStateException
loadBundle
in class AbstractBundlePersistenceManager
id
- the node id of the bundlenull
if the bundle does not
exist.ItemStateException
- if an error while loading occurs.protected StringBuffer buildNodeFilePath(StringBuffer buf, NodeId id)
buildNodeFilePath
in class AbstractBundlePersistenceManager
buf
- buffer to append to or null
id
- the id of the nodeprotected StringBuffer buildNodeReferencesFilePath(StringBuffer buf, NodeId id)
buildNodeReferencesFilePath
in class AbstractBundlePersistenceManager
buf
- buffer to append to or null
id
- the id of the nodeprotected void storeBundle(NodePropBundle bundle) throws ItemStateException
storeBundle
in class AbstractBundlePersistenceManager
bundle
- the bundle to storeItemStateException
- if an error while storing occurs.protected void destroyBundle(NodePropBundle bundle) throws ItemStateException
destroyBundle
in class AbstractBundlePersistenceManager
bundle
- the bundle to destroyItemStateException
- if an error while destroying occurs.public NodeReferences loadReferencesTo(NodeId targetId) throws NoSuchItemStateException, ItemStateException
targetId
- reference target node idNoSuchItemStateException
- if the target node does not existItemStateException
- if another error occurspublic void store(NodeReferences refs) throws ItemStateException
store
in class AbstractBundlePersistenceManager
refs
- the node references to store.ItemStateException
- if an error while storing occurs.public void destroy(NodeReferences refs) throws ItemStateException
destroy
in class AbstractBundlePersistenceManager
refs
- the node references to destroy.ItemStateException
- if an error while destroying occurs.public boolean existsReferencesTo(NodeId targetId) throws ItemStateException
targetId
- target node idtrue
if the references exist,
false
otherwiseItemStateException
- on persistence manager errorsprotected void logException(String message, SQLException se)
message
- se
- public List<NodeId> getAllNodeIds(NodeId bigger, int maxCount) throws ItemStateException
bigger
- the lower limit, or null for no limit.maxCount
- the maximum number of node ids to return, or 0 for no limit.ItemStateException
- if an error while loading occurs.Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.