|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
org.exist.storage.DBBroker
public abstract class DBBroker
This is the base class for all database backends. All the basic database operations like storing, removing or index access are provided by subclasses of this class.
Field Summary | |
---|---|
static String |
CONFIGURATION_ELEMENT_NAME
|
static int |
MATCH_EXACT
|
static int |
MATCH_REGEXP
|
static int |
MATCH_WILDCARDS
|
static String |
PROPERTY_XUPDATE_CONSISTENCY_CHECKS
|
static String |
PROPERTY_XUPDATE_FRAGMENTATION_FACTOR
|
static String |
ROOT_COLLECTION
|
static String |
ROOT_COLLECTION_NAME
|
static String |
SYSTEM_COLLECTION
|
static String |
SYSTEM_COLLECTION_NAME
|
static String |
TEMP_COLLECTION
|
static String |
TEMP_COLLECTION_NAME
|
static String |
XUPDATE_CONSISTENCY_CHECKS_ATTRIBUTE
|
static String |
XUPDATE_FRAGMENTATION_FACTOR_ATTRIBUTE
|
Constructor Summary | |
---|---|
DBBroker(BrokerPool pool,
Configuration config)
|
Method Summary | |
---|---|
void |
addContentLoadingObserver(ContentLoadingObserver observer)
Observer Design Pattern: add an observer. |
abstract void |
backupToArchive(RawDataBackup backup)
|
abstract void |
checkAvailableMemory()
Convenience method that allows to check available memory during broker-related processes. |
abstract void |
checkXMLResourceConsistency(DocumentImpl doc)
|
abstract void |
checkXMLResourceTree(DocumentImpl doc)
Perform a consistency check on the specified document. |
abstract void |
cleanUpTempResources()
Clean up temporary resources. |
abstract void |
cleanUpTempResources(boolean forceRemoval)
Clean up temporary resources. |
void |
clearContentLoadingObservers()
Remove all observers |
void |
closeDocument()
|
abstract void |
copyCollection(Txn transaction,
Collection collection,
Collection destination,
XmldbURI newName)
Copy a collection to the destination collection and rename it. |
abstract void |
copyXMLResource(Txn transaction,
DocumentImpl doc,
Collection destination,
XmldbURI newName)
Copy a resource to the destination collection and rename it. |
void |
decReferenceCount()
|
abstract void |
defragXMLResource(Txn transaction,
DocumentImpl doc)
Defragment pages of this document. |
void |
endElement(StoredNode node,
NodePath currentPath,
String content)
|
abstract void |
endElement(StoredNode node,
NodePath currentPath,
String content,
boolean remove)
|
abstract void |
endRemove(Txn transaction)
|
void |
flush()
Flush all data that has not been written before. |
abstract DocumentSet |
getAllXMLResources(DocumentSet docs)
Adds all the documents in the database to the specified DocumentSet. |
abstract byte[] |
getBinaryResource(BinaryDocument blob)
Retrieve the binary data stored under the resource descriptor BinaryDocument. |
BrokerPool |
getBrokerPool()
|
abstract Collection |
getCollection(XmldbURI uri)
Returns the database collection identified by the specified path. |
abstract void |
getCollectionResources(Collection collection)
|
abstract void |
getCollectionsFailsafe(BTreeCallback callback)
|
Configuration |
getConfiguration()
Returns the configuration object used to initialize the current database instance. |
abstract ElementIndex |
getElementIndex()
|
String |
getId()
|
abstract IndexSpec |
getIndexConfiguration()
|
IndexController |
getIndexController()
|
abstract int |
getNextResourceId(Txn transaction,
Collection collection)
Get a new document id that does not yet exist within the collection. |
Iterator |
getNodeIterator(StoredNode node)
Return a NodeIterator starting at the
specified node. |
String |
getNodeValue(StoredNode node,
boolean addWhitespace)
Get the string value of the specified node. |
abstract Collection |
getOrCreateCollection(Txn transaction,
XmldbURI uri)
Returns the database collection identified by the specified path. |
int |
getReferenceCount()
|
abstract void |
getResourceMetadata(DocumentImpl doc)
|
abstract void |
getResourcesFailsafe(BTreeCallback callback)
|
abstract Serializer |
getSerializer()
Get an instance of the Serializer used for converting nodes back to XML. |
abstract TextSearchEngine |
getTextEngine()
Get the TextSearchEngine associated with this broker. |
User |
getUser()
|
abstract NativeValueIndex |
getValueIndex()
|
abstract Document |
getXMLResource(XmldbURI docURI)
Return the document stored at the specified path. |
abstract DocumentImpl |
getXMLResource(XmldbURI docURI,
int lockMode)
Return the document stored at the specified path. |
abstract DocumentSet |
getXMLResourcesByDoctype(String doctype,
DocumentSet result)
|
abstract EmbeddedXMLStreamReader |
getXMLStreamReader(NodeProxy node,
boolean reportAttributes)
|
abstract EmbeddedXMLStreamReader |
getXMLStreamReader(StoredNode node,
boolean reportAttributes)
|
XQuery |
getXQueryService()
|
void |
incReferenceCount()
|
void |
indexNode(Txn transaction,
StoredNode node)
|
abstract void |
indexNode(Txn transaction,
StoredNode node,
NodePath currentPath)
|
void |
initIndexModules()
|
abstract void |
insertNodeAfter(Txn transaction,
StoredNode previous,
StoredNode node)
|
boolean |
isReadOnly()
Is the database running read-only? Returns false by default. |
abstract void |
moveCollection(Txn transaction,
Collection collection,
Collection destination,
XmldbURI newName)
Move a collection and all its subcollections to another collection and rename it. |
abstract void |
moveXMLResource(Txn transaction,
DocumentImpl doc,
Collection destination,
XmldbURI newName)
Move a resource to the destination collection and rename it. |
abstract Serializer |
newSerializer()
|
abstract StoredNode |
objectWith(Document doc,
NodeId nodeId)
Get a node with given owner document and id from the database. |
abstract StoredNode |
objectWith(NodeProxy p)
|
abstract Collection |
openCollection(XmldbURI uri,
int lockMode)
Open a collection for reading or writing. |
abstract void |
readBinaryResource(BinaryDocument blob,
OutputStream os)
|
abstract void |
reindexCollection(XmldbURI collectionName)
Reindex a collection. |
abstract void |
removeAllNodes(Txn transaction,
StoredNode node,
NodePath currentPath,
StreamListener listener)
|
abstract void |
removeBinaryResource(Txn transaction,
BinaryDocument blob)
Completely delete this binary document (descriptor and binary data). |
abstract boolean |
removeCollection(Txn transaction,
Collection collection)
Remove the collection and all its subcollections from the database. |
void |
removeContentLoadingObserver(ContentLoadingObserver observer)
Observer Design Pattern: remove an observer. |
abstract void |
removeNode(Txn transaction,
StoredNode node,
NodePath currentPath,
String content)
|
void |
removeXMLResource(Txn transaction,
DocumentImpl document)
Remove a document from the database. |
abstract void |
removeXMLResource(Txn transaction,
DocumentImpl document,
boolean freeDocId)
|
abstract void |
repair()
|
abstract void |
saveCollection(Txn transaction,
Collection collection)
Saves the specified collection to storage. |
void |
setId(String id)
|
void |
setUser(User user)
Set the user that is currently using this DBBroker object. |
void |
shutdown()
Shut down the database instance. |
abstract void |
storeBinaryResource(Txn transaction,
BinaryDocument blob,
byte[] data)
Stores the given data under the given binary resource descriptor (BinaryDocument). |
abstract void |
storeBinaryResource(Txn transaction,
BinaryDocument blob,
InputStream is)
Stores the given data under the given binary resource descriptor (BinaryDocument). |
void |
storeNode(Txn transaction,
StoredNode node,
NodePath currentPath,
IndexSpec indexSpec)
|
abstract void |
storeNode(Txn transaction,
StoredNode node,
NodePath currentPath,
IndexSpec indexSpec,
boolean index)
Store a node into the database. |
abstract DocumentImpl |
storeTempResource(DocumentImpl doc)
Create a temporary document in the temp collection and store the supplied data. |
abstract void |
storeXMLResource(Txn transaction,
DocumentImpl doc)
Store a document (descriptor) into the database. |
abstract void |
sync(int syncEvent)
Sync dom and collection state data (pages) to disk. |
String |
toString()
|
abstract void |
updateNode(Txn transaction,
StoredNode node,
boolean reindex)
Update a node's data. |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MATCH_EXACT
public static final int MATCH_REGEXP
public static final int MATCH_WILDCARDS
public static final String ROOT_COLLECTION_NAME
public static final String ROOT_COLLECTION
public static final String SYSTEM_COLLECTION_NAME
public static final String SYSTEM_COLLECTION
public static final String TEMP_COLLECTION_NAME
public static final String TEMP_COLLECTION
public static final String CONFIGURATION_ELEMENT_NAME
public static final String XUPDATE_FRAGMENTATION_FACTOR_ATTRIBUTE
public static final String PROPERTY_XUPDATE_FRAGMENTATION_FACTOR
public static final String XUPDATE_CONSISTENCY_CHECKS_ATTRIBUTE
public static final String PROPERTY_XUPDATE_CONSISTENCY_CHECKS
Constructor Detail |
---|
public DBBroker(BrokerPool pool, Configuration config) throws EXistException
EXistException
Method Detail |
---|
public void initIndexModules()
public void setUser(User user)
user
- public User getUser()
public IndexController getIndexController()
public XQuery getXQueryService()
XQuery
service.public abstract ElementIndex getElementIndex()
public void flush()
public void clearContentLoadingObservers()
public void addContentLoadingObserver(ContentLoadingObserver observer)
public void removeContentLoadingObserver(ContentLoadingObserver observer)
public abstract DocumentSet getAllXMLResources(DocumentSet docs)
docs
- a (possibly empty) document set to which the found documents
are added.public abstract void getResourcesFailsafe(BTreeCallback callback)
public abstract void getCollectionsFailsafe(BTreeCallback callback)
public abstract Collection getCollection(XmldbURI uri)
public abstract Collection openCollection(XmldbURI uri, int lockMode)
uri
- The collection pathlockMode
- one of the modes specified in class
Lock
public abstract Collection getOrCreateCollection(Txn transaction, XmldbURI uri) throws PermissionDeniedException, IOException
transaction
- The transaction, which registers the acquired write locks. The locks should be released on commit/abort.uri
- The collection's URI
null
if no collection matches the path
PermissionDeniedException
IOException
public Configuration getConfiguration()
public Iterator getNodeIterator(StoredNode node)
NodeIterator
starting at the
specified node.
node
-
public abstract Document getXMLResource(XmldbURI docURI) throws PermissionDeniedException
PermissionDeniedException
public abstract DocumentImpl getXMLResource(XmldbURI docURI, int lockMode) throws PermissionDeniedException
PermissionDeniedException
public abstract int getNextResourceId(Txn transaction, Collection collection)
public String getNodeValue(StoredNode node, boolean addWhitespace)
public abstract Serializer getSerializer()
public abstract TextSearchEngine getTextEngine()
public abstract NativeValueIndex getValueIndex()
public abstract Serializer newSerializer()
public abstract StoredNode objectWith(Document doc, NodeId nodeId)
doc
- the document the node belongs tonodeId
- the node's unique identifierpublic abstract StoredNode objectWith(NodeProxy p)
public abstract boolean removeCollection(Txn transaction, Collection collection) throws PermissionDeniedException, IOException
PermissionDeniedException
IOException
public void removeXMLResource(Txn transaction, DocumentImpl document) throws PermissionDeniedException
PermissionDeniedException
public abstract void removeXMLResource(Txn transaction, DocumentImpl document, boolean freeDocId) throws PermissionDeniedException
PermissionDeniedException
public abstract void reindexCollection(XmldbURI collectionName) throws PermissionDeniedException
collectionName
-
PermissionDeniedException
- public abstract void reindexCollection(String collectionName) throws
PermissionDeniedException;public abstract void repair() throws PermissionDeniedException
PermissionDeniedException
public abstract void saveCollection(Txn transaction, Collection collection) throws PermissionDeniedException, IOException
transaction
- collection
- Collection to store
PermissionDeniedException
IOException
public void closeDocument()
public void shutdown()
public abstract void storeNode(Txn transaction, StoredNode node, NodePath currentPath, IndexSpec indexSpec, boolean index)
node
- the node to be storedcurrentPath
- path expression which points to this node's element-parent or
to itself if it is an element (currently used by the Broker to
determine if a node's content should be fulltext-indexed).public void storeNode(Txn transaction, StoredNode node, NodePath currentPath, IndexSpec indexSpec)
public void endElement(StoredNode node, NodePath currentPath, String content)
public abstract void endElement(StoredNode node, NodePath currentPath, String content, boolean remove)
public abstract void storeXMLResource(Txn transaction, DocumentImpl doc)
doc
- the document's metadata to store.public abstract void storeBinaryResource(Txn transaction, BinaryDocument blob, byte[] data)
blob
- the binary document descriptordata
- the document binary datapublic abstract void storeBinaryResource(Txn transaction, BinaryDocument blob, InputStream is)
blob
- the binary document descriptoris
- the document binary data as input streampublic abstract void getCollectionResources(Collection collection)
public abstract byte[] getBinaryResource(BinaryDocument blob)
blob
- the binary document descriptor
public abstract void readBinaryResource(BinaryDocument blob, OutputStream os)
public abstract void getResourceMetadata(DocumentImpl doc)
public abstract void removeBinaryResource(Txn transaction, BinaryDocument blob) throws PermissionDeniedException
blob
- the binary document descriptor
PermissionDeniedException
- if you don't have the right to do thispublic abstract void moveCollection(Txn transaction, Collection collection, Collection destination, XmldbURI newName) throws PermissionDeniedException, LockException, IOException
collection
- the collection to movedestination
- the destination collectionnewName
- the new name the collection should have in the destination
collection
PermissionDeniedException
LockException
IOException
public abstract void moveXMLResource(Txn transaction, DocumentImpl doc, Collection destination, XmldbURI newName) throws PermissionDeniedException, LockException, IOException
doc
- the resource to movedestination
- the destination collectionnewName
- the new name the resource should have in the destination
collection
PermissionDeniedException
LockException
IOException
public abstract void copyCollection(Txn transaction, Collection collection, Collection destination, XmldbURI newName) throws PermissionDeniedException, LockException, IOException
transaction
- The transaction, which registers the acquired write locks. The locks should be released on commit/abort.collection
- The origin collectiondestination
- The destination parent collectionnewName
- The new name of the collection
PermissionDeniedException
LockException
IOException
public abstract void copyXMLResource(Txn transaction, DocumentImpl doc, Collection destination, XmldbURI newName) throws PermissionDeniedException, LockException
doc
- the resource to copydestination
- the destination collectionnewName
- the new name the resource should have in the destination
collection
PermissionDeniedException
LockException
public abstract void defragXMLResource(Txn transaction, DocumentImpl doc)
doc
- to defragpublic abstract void checkXMLResourceTree(DocumentImpl doc)
doc
- public abstract void checkXMLResourceConsistency(DocumentImpl doc) throws EXistException
EXistException
public abstract void sync(int syncEvent)
Sync.MAJOR_SYNC
, sync all states (dom,
collection, text and element) to disk.
syncEvent
- Sync.MAJOR_SYNC or Sync.MINOR_SYNCpublic abstract void updateNode(Txn transaction, StoredNode node, boolean reindex)
node
- Description of the Parameterpublic boolean isReadOnly()
public BrokerPool getBrokerPool()
public abstract void insertNodeAfter(Txn transaction, StoredNode previous, StoredNode node)
public abstract void indexNode(Txn transaction, StoredNode node, NodePath currentPath)
public void indexNode(Txn transaction, StoredNode node)
public abstract void removeNode(Txn transaction, StoredNode node, NodePath currentPath, String content)
public abstract void removeAllNodes(Txn transaction, StoredNode node, NodePath currentPath, StreamListener listener)
public abstract void endRemove(Txn transaction)
public abstract DocumentImpl storeTempResource(DocumentImpl doc) throws EXistException, PermissionDeniedException, LockException
doc
-
EXistException
PermissionDeniedException
LockException
public abstract void cleanUpTempResources()
public abstract void cleanUpTempResources(boolean forceRemoval)
forceRemoval
- Should temporary resources be forcefully removedpublic abstract void checkAvailableMemory()
public abstract DocumentSet getXMLResourcesByDoctype(String doctype, DocumentSet result)
public int getReferenceCount()
public void incReferenceCount()
public void decReferenceCount()
public abstract IndexSpec getIndexConfiguration()
public void setId(String id)
public String getId()
public String toString()
toString
in class Object
public abstract EmbeddedXMLStreamReader getXMLStreamReader(StoredNode node, boolean reportAttributes) throws IOException, XMLStreamException
IOException
XMLStreamException
public abstract EmbeddedXMLStreamReader getXMLStreamReader(NodeProxy node, boolean reportAttributes) throws IOException, XMLStreamException
IOException
XMLStreamException
public abstract void backupToArchive(RawDataBackup backup) throws IOException
IOException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |