org.exist.xupdate
Class Modification

java.lang.Object
  extended byorg.exist.xupdate.Modification
Direct Known Subclasses:
Append, Conditional, Insert, Remove, Rename, Replace, Update

public abstract class Modification
extends java.lang.Object

Base class for all XUpdate modifications.

Author:
Wolfgang Meier

Field Summary
protected  DBBroker broker
           
protected  org.w3c.dom.NodeList content
          NodeList to keep track of created document fragments within the currently processed XUpdate modification.
protected  DocumentSet docs
          Documents concerned by this XUpdate modification, i.e.
protected  DocumentSet lockedDocuments
           
protected static Logger LOG
           
protected  java.util.Map namespaces
           
protected  java.lang.String selectStmt
          select Statement in the current XUpdate definition; defines the set of nodes to which this XUpdate might apply.
protected  java.util.Map variables
           
 
Constructor Summary
Modification(DBBroker broker, DocumentSet docs, java.lang.String selectStmt, java.util.Map namespaces, java.util.Map variables)
          Constructor for Modification.
 
Method Summary
protected  void checkFragmentation(Txn transaction, DocumentSet docs)
          Check if any of the modified documents needs defragmentation.
protected  void declareNamespaces(XQueryContext context)
           
protected  void declareVariables(XQueryContext context)
           
 AccessContext getAccessContext()
           
abstract  java.lang.String getName()
           
abstract  long process(Txn transaction)
          Process the modification.
protected  org.w3c.dom.NodeList select(DocumentSet docs)
          Evaluate the select expression.
protected  StoredNode[] selectAndLock()
          Acquire a lock on all documents processed by this modification.
 void setAccessContext(AccessContext accessCtx)
           
 void setContent(org.w3c.dom.NodeList nodes)
           
 java.lang.String toString()
           
protected  void unlockDocuments()
          Release all acquired document locks; feature trigger_update : at the same time we leverage on the fact that it's called after database modification to call the eventual triggers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final Logger LOG

selectStmt

protected java.lang.String selectStmt
select Statement in the current XUpdate definition; defines the set of nodes to which this XUpdate might apply.


content

protected org.w3c.dom.NodeList content
NodeList to keep track of created document fragments within the currently processed XUpdate modification. see XUpdateProcessor#contents


broker

protected DBBroker broker

docs

protected DocumentSet docs
Documents concerned by this XUpdate modification, i.e. the set of documents to which this XUpdate might apply.


namespaces

protected java.util.Map namespaces

variables

protected java.util.Map variables

lockedDocuments

protected DocumentSet lockedDocuments
Constructor Detail

Modification

public Modification(DBBroker broker,
                    DocumentSet docs,
                    java.lang.String selectStmt,
                    java.util.Map namespaces,
                    java.util.Map variables)
Constructor for Modification.

Method Detail

setAccessContext

public final void setAccessContext(AccessContext accessCtx)

getAccessContext

public final AccessContext getAccessContext()

process

public abstract long process(Txn transaction)
                      throws PermissionDeniedException,
                             LockException,
                             EXistException,
                             XPathException
Process the modification. This is the main method that has to be implemented by all subclasses.

Returns:
Throws:
PermissionDeniedException
LockException
EXistException
XPathException

getName

public abstract java.lang.String getName()

setContent

public void setContent(org.w3c.dom.NodeList nodes)

select

protected org.w3c.dom.NodeList select(DocumentSet docs)
                               throws PermissionDeniedException,
                                      EXistException,
                                      XPathException
Evaluate the select expression.

Parameters:
docs -
Returns:
Throws:
PermissionDeniedException
EXistException
XPathException

declareVariables

protected void declareVariables(XQueryContext context)
                         throws XPathException
Parameters:
context -
Throws:
XPathException

declareNamespaces

protected void declareNamespaces(XQueryContext context)
                          throws XPathException
Parameters:
context -
Throws:
XPathException

selectAndLock

protected final StoredNode[] selectAndLock()
                                    throws LockException,
                                           PermissionDeniedException,
                                           EXistException,
                                           XPathException
Acquire a lock on all documents processed by this modification. We have to avoid that node positions change during the operation. feature trigger_update : At the same time we leverage on the fact that it's called before database modification to call the eventual triggers.

Returns:
Throws:
LockException
PermissionDeniedException
EXistException
XPathException

unlockDocuments

protected final void unlockDocuments()
Release all acquired document locks; feature trigger_update : at the same time we leverage on the fact that it's called after database modification to call the eventual triggers


checkFragmentation

protected void checkFragmentation(Txn transaction,
                                  DocumentSet docs)
                           throws EXistException
Check if any of the modified documents needs defragmentation. Defragmentation will take place if the number of split pages in the document exceeds the limit defined in the configuration file.

Parameters:
docs -
Throws:
EXistException

toString

public java.lang.String toString()


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.