|
||||||||||
| 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 | |
|---|---|
protected boolean |
caseSensitive
|
protected Configuration |
config
|
static java.lang.String |
CONFIGURATION_ELEMENT_NAME
|
protected java.util.List<ContentLoadingObserver> |
contentLoadingObservers
Observer Design Pattern: List of ContentLoadingObserver objects |
protected java.lang.String |
id
|
protected IndexController |
indexController
|
protected static org.apache.log4j.Logger |
LOG
|
static int |
MATCH_CONTAINS
|
static int |
MATCH_ENDSWITH
|
static int |
MATCH_EXACT
|
static int |
MATCH_REGEXP
|
static int |
MATCH_STARTSWITH
|
static int |
MATCH_WILDCARDS
|
protected BrokerPool |
pool
|
static java.lang.String |
PROPERTY_XUPDATE_CONSISTENCY_CHECKS
|
static java.lang.String |
PROPERTY_XUPDATE_FRAGMENTATION_FACTOR
|
static java.lang.String |
ROOT_COLLECTION
Deprecated. |
static java.lang.String |
ROOT_COLLECTION_NAME
Deprecated. |
static java.lang.String |
SYSTEM_COLLECTION
Deprecated. |
static java.lang.String |
SYSTEM_COLLECTION_NAME
Deprecated. |
static java.lang.String |
TEMP_COLLECTION
Deprecated. |
static java.lang.String |
TEMP_COLLECTION_NAME
Deprecated. |
protected XQuery |
xqueryService
|
static java.lang.String |
XUPDATE_CONSISTENCY_CHECKS_ATTRIBUTE
|
static java.lang.String |
XUPDATE_FRAGMENTATION_FACTOR_ATTRIBUTE
|
| Constructor Summary | |
|---|---|
DBBroker()
|
|
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 |
copyResource(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,
java.lang.String content)
|
abstract void |
endElement(StoredNode node,
NodePath currentPath,
java.lang.String content,
boolean remove)
|
abstract void |
endRemove(Txn transaction)
|
abstract java.util.List<java.lang.String> |
findCollectionsMatching(java.lang.String regexp)
|
void |
flush()
Flush all data that has not been written before. |
abstract MutableDocumentSet |
getAllXMLResources(MutableDocumentSet docs)
Adds all the documents in the database to the specified DocumentSet. |
abstract java.io.InputStream |
getBinaryResource(BinaryDocument blob)
|
abstract long |
getBinaryResourceSize(BinaryDocument blob)
|
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()
|
java.lang.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. |
java.util.Iterator<StoredNode> |
getNodeIterator(StoredNode node)
Return a NodeIterator starting at the
specified node. |
java.lang.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 DocumentImpl |
getResource(XmldbURI docURI,
int accessType)
Return the document stored at the specified path. |
abstract void |
getResourceMetadata(DocumentImpl doc)
|
abstract void |
getResourcesFailsafe(BTreeCallback callback,
boolean fullScan)
|
abstract Serializer |
getSerializer()
Get an instance of the Serializer used for converting nodes back to XML. |
abstract StructuralIndex |
getStructuralIndex()
|
Subject |
getSubject()
The subject that is currently using this DBBroker object |
abstract TextSearchEngine |
getTextEngine()
Get the TextSearchEngine associated with this broker. |
Subject |
getUser()
Deprecated. user getSubject |
abstract NativeValueIndex |
getValueIndex()
|
abstract org.w3c.dom.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 MutableDocumentSet |
getXMLResourcesByDoctype(java.lang.String doctype,
MutableDocumentSet result)
|
abstract EmbeddedXMLStreamReader |
getXMLStreamReader(NodeHandle 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 |
moveResource(Txn transaction,
DocumentImpl doc,
Collection destination,
XmldbURI newName)
Move a resource to the destination collection and rename it. |
abstract Serializer |
newSerializer()
|
abstract EmbeddedXMLStreamReader |
newXMLStreamReader(NodeHandle node,
boolean reportAttributes)
|
abstract StoredNode |
objectWith(org.w3c.dom.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,
java.io.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,
java.lang.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(java.lang.String id)
|
void |
setSubject(Subject subject)
Set the subject that is currently using this DBBroker object. |
void |
setUser(Subject user)
Deprecated. use setSubject |
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,
java.io.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. |
java.lang.String |
toString()
|
abstract void |
updateNode(Txn transaction,
StoredNode node,
boolean reindex)
Update a node's data. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, 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 int MATCH_CONTAINS
public static final int MATCH_STARTSWITH
public static final int MATCH_ENDSWITH
@Deprecated public static final java.lang.String ROOT_COLLECTION_NAME
@Deprecated public static final java.lang.String ROOT_COLLECTION
@Deprecated public static final java.lang.String SYSTEM_COLLECTION_NAME
@Deprecated public static final java.lang.String SYSTEM_COLLECTION
@Deprecated public static final java.lang.String TEMP_COLLECTION_NAME
@Deprecated public static final java.lang.String TEMP_COLLECTION
public static final java.lang.String CONFIGURATION_ELEMENT_NAME
public static final java.lang.String XUPDATE_FRAGMENTATION_FACTOR_ATTRIBUTE
public static final java.lang.String PROPERTY_XUPDATE_FRAGMENTATION_FACTOR
public static final java.lang.String XUPDATE_CONSISTENCY_CHECKS_ATTRIBUTE
public static final java.lang.String PROPERTY_XUPDATE_CONSISTENCY_CHECKS
protected static final org.apache.log4j.Logger LOG
protected boolean caseSensitive
protected Configuration config
protected BrokerPool pool
protected XQuery xqueryService
protected java.lang.String id
protected IndexController indexController
protected java.util.List<ContentLoadingObserver> contentLoadingObservers
| Constructor Detail |
|---|
public DBBroker()
public DBBroker(BrokerPool pool,
Configuration config)
| Method Detail |
|---|
public void initIndexModules()
public void setUser(Subject user)
user - @Deprecated public Subject getUser()
public void setSubject(Subject subject)
subject - public Subject getSubject()
public IndexController getIndexController()
public XQuery getXQueryService()
XQuery service.public abstract ElementIndex getElementIndex()
public abstract StructuralIndex getStructuralIndex()
public void flush()
public void clearContentLoadingObservers()
public void addContentLoadingObserver(ContentLoadingObserver observer)
public void removeContentLoadingObserver(ContentLoadingObserver observer)
public abstract MutableDocumentSet getAllXMLResources(MutableDocumentSet docs)
docs - a (possibly empty) document set to which the found documents
are added.
public abstract void getResourcesFailsafe(BTreeCallback callback,
boolean fullScan)
throws TerminatedException
TerminatedException
public abstract void getCollectionsFailsafe(BTreeCallback callback)
throws TerminatedException
TerminatedExceptionpublic 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 java.util.List<java.lang.String> findCollectionsMatching(java.lang.String regexp)
public abstract Collection getOrCreateCollection(Txn transaction,
XmldbURI uri)
throws PermissionDeniedException,
java.io.IOException,
TriggerException
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
java.io.IOException
TriggerExceptionpublic Configuration getConfiguration()
public java.util.Iterator<StoredNode> getNodeIterator(StoredNode node)
NodeIterator starting at the
specified node.
node -
public abstract org.w3c.dom.Document getXMLResource(XmldbURI docURI)
throws PermissionDeniedException
PermissionDeniedException
public abstract DocumentImpl getResource(XmldbURI docURI,
int accessType)
throws PermissionDeniedException
PermissionDeniedException
public abstract DocumentImpl getXMLResource(XmldbURI docURI,
int lockMode)
throws PermissionDeniedException
PermissionDeniedException
public abstract int getNextResourceId(Txn transaction,
Collection collection)
throws EXistException
EXistException
public java.lang.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(org.w3c.dom.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,
java.io.IOException,
TriggerException
PermissionDeniedException
java.io.IOException
TriggerException
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,
java.io.IOException,
TriggerException
transaction - collection - Collection to store
PermissionDeniedException
java.io.IOException
TriggerExceptionpublic 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,
java.lang.String content)
public abstract void endElement(StoredNode node,
NodePath currentPath,
java.lang.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)
throws java.io.IOException
blob - the binary document descriptordata - the document binary data
java.io.IOException
public abstract void storeBinaryResource(Txn transaction,
BinaryDocument blob,
java.io.InputStream is)
throws java.io.IOException
blob - the binary document descriptoris - the document binary data as input stream
java.io.IOExceptionpublic abstract void getCollectionResources(Collection collection)
public abstract void readBinaryResource(BinaryDocument blob,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOException
public abstract java.io.InputStream getBinaryResource(BinaryDocument blob)
throws java.io.IOException
java.io.IOException
public abstract long getBinaryResourceSize(BinaryDocument blob)
throws java.io.IOException
java.io.IOExceptionpublic abstract void getResourceMetadata(DocumentImpl doc)
public abstract void removeBinaryResource(Txn transaction,
BinaryDocument blob)
throws PermissionDeniedException,
java.io.IOException
blob - the binary document descriptor
PermissionDeniedException - if you don't have the right to do this
java.io.IOException
public abstract void moveCollection(Txn transaction,
Collection collection,
Collection destination,
XmldbURI newName)
throws PermissionDeniedException,
LockException,
java.io.IOException,
TriggerException
collection - the collection to movedestination - the destination collectionnewName - the new name the collection should have in the destination
collection
PermissionDeniedException
LockException
java.io.IOException
TriggerException
public abstract void moveResource(Txn transaction,
DocumentImpl doc,
Collection destination,
XmldbURI newName)
throws PermissionDeniedException,
LockException,
java.io.IOException,
TriggerException
doc - the resource to movedestination - the destination collectionnewName - the new name the resource should have in the destination
collection
PermissionDeniedException
LockException
java.io.IOException
TriggerException
public abstract void copyCollection(Txn transaction,
Collection collection,
Collection destination,
XmldbURI newName)
throws PermissionDeniedException,
LockException,
java.io.IOException,
TriggerException,
EXistException
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
java.io.IOException
TriggerException
EXistException
public abstract void copyResource(Txn transaction,
DocumentImpl doc,
Collection destination,
XmldbURI newName)
throws PermissionDeniedException,
LockException,
EXistException
doc - the resource to copydestination - the destination collectionnewName - the new name the resource should have in the destination
collection
PermissionDeniedException
LockException
EXistException
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
EXistExceptionpublic 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_SYNC
public 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,
java.lang.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
LockExceptionpublic abstract void cleanUpTempResources()
public abstract void cleanUpTempResources(boolean forceRemoval)
forceRemoval - Should temporary resources be forcefully removedpublic abstract void checkAvailableMemory()
public abstract MutableDocumentSet getXMLResourcesByDoctype(java.lang.String doctype,
MutableDocumentSet result)
public int getReferenceCount()
public void incReferenceCount()
public void decReferenceCount()
public abstract IndexSpec getIndexConfiguration()
public void setId(java.lang.String id)
public java.lang.String getId()
public java.lang.String toString()
toString in class java.lang.Object
public abstract EmbeddedXMLStreamReader getXMLStreamReader(NodeHandle node,
boolean reportAttributes)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
public abstract EmbeddedXMLStreamReader newXMLStreamReader(NodeHandle node,
boolean reportAttributes)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
public abstract void backupToArchive(RawDataBackup backup)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||