org.exist.xquery.update
Class Modification

java.lang.Object
  extended byorg.exist.xquery.AbstractExpression
      extended byorg.exist.xquery.update.Modification
All Implemented Interfaces:
Expression
Direct Known Subclasses:
Delete, Insert, Rename, Replace, Update

public abstract class Modification
extends AbstractExpression

Author:
wolf

Field Summary
protected  DocumentSet lockedDocuments
           
protected static Logger LOG
           
protected  Expression select
           
protected  Expression value
           
 
Fields inherited from class org.exist.xquery.AbstractExpression
astNode, context, contextDocSet, contextId
 
Fields inherited from interface org.exist.xquery.Expression
EXPRESSION_ID_INVALID, IGNORE_CONTEXT, IN_PREDICATE, IN_UPDATE, IN_WHERE_CLAUSE, NO_CONTEXT_ID, SINGLE_STEP_EXECUTION
 
Constructor Summary
Modification(XQueryContext context, Expression select, Expression value)
           
 
Method Summary
 void analyze(AnalyzeContextInfo contextInfo)
          Statically analyze the expression and its subexpressions.
protected  void checkFragmentation(Txn transaction, DocumentSet docs)
          Check if any of the modified documents needs defragmentation.
protected  Sequence deepCopy(Sequence inSeq)
           
 int getCardinality()
          The default cardinality is Cardinality.EXACTLY_ONE.
 void resetState()
          Called to inform an expression that it should reset to its initial state.
 int returnsType()
          The static return type of the expression.
protected  StoredNode[] selectAndLock(NodeSet nodes)
          Acquire a lock on all documents processed by this modification.
protected  void unlockDocuments()
          Release all acquired document locks.
 
Methods inherited from class org.exist.xquery.AbstractExpression
eval, eval, getASTNode, getContextDocSet, getContextId, getDependencies, getExpressionId, setASTNode, setContextDocSet, setPrimaryAxis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.exist.xquery.Expression
dump
 

Field Detail

LOG

protected static final Logger LOG

select

protected final Expression select

value

protected final Expression value

lockedDocuments

protected DocumentSet lockedDocuments
Constructor Detail

Modification

public Modification(XQueryContext context,
                    Expression select,
                    Expression value)
Parameters:
context -
Method Detail

getCardinality

public int getCardinality()
Description copied from class: AbstractExpression
The default cardinality is Cardinality.EXACTLY_ONE.

Specified by:
getCardinality in interface Expression
Overrides:
getCardinality in class AbstractExpression

returnsType

public int returnsType()
Description copied from interface: Expression
The static return type of the expression. This method should return one of the type constants defined in class Type. If the return type cannot be determined statically, return Type.ITEM.

Specified by:
returnsType in interface Expression
Specified by:
returnsType in class AbstractExpression

resetState

public void resetState()
Description copied from interface: Expression
Called to inform an expression that it should reset to its initial state. All cached data in the expression object should be dropped. For example, the document() function calls this method whenever the input document set has changed.

Specified by:
resetState in interface Expression
Overrides:
resetState in class AbstractExpression

analyze

public void analyze(AnalyzeContextInfo contextInfo)
             throws XPathException
Description copied from interface: Expression
Statically analyze the expression and its subexpressions. During the static analysis phase, the query engine can detect unknown variables and some type errors.

Throws:
XPathException

selectAndLock

protected StoredNode[] selectAndLock(NodeSet nodes)
                              throws LockException,
                                     PermissionDeniedException,
                                     XPathException
Acquire a lock on all documents processed by this modification. We have to avoid that node positions change during the operation.

Returns:
Throws:
LockException
PermissionDeniedException
XPathException

deepCopy

protected Sequence deepCopy(Sequence inSeq)
                     throws XPathException
Throws:
XPathException

unlockDocuments

protected void unlockDocuments()
Release all acquired document locks.


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


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