|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.xquery.XQueryContext
public class XQueryContext
The current XQuery execution context. Contains the static as well as the dynamic XQuery context components.
| Field Summary | |
|---|---|
static String |
HTTP_SESSIONVAR_XMLDB_USER
|
static String |
XQUERY_CONTEXTVAR_XQUERY_UPDATE_ERROR
|
static String |
XQUERY_LOCAL_NS
|
| Constructor Summary | |
|---|---|
XQueryContext(DBBroker broker,
AccessContext accessCtx)
|
|
XQueryContext(XQueryContext copyFrom)
|
|
| Method Summary | |
|---|---|
void |
addForwardReference(FunctionCall call)
Add a forward reference to an undeclared function. |
void |
addOption(String qnameString,
String contents)
|
boolean |
checkModulesValid()
For compiled expressions: check if the source of any module imported by the current query has changed since compilation. |
void |
clearNamespaces()
Clear all user-defined prefix/namespace mappings. |
XQueryContext |
copyContext()
|
void |
declareFunction(UserDefinedFunction function)
Declare a user-defined function. |
Variable |
declareGlobalVariable(Variable var)
Declare a global variable as by "declare variable". |
void |
declareInScopeNamespace(String prefix,
String uri)
Declare an in-scope namespace. |
void |
declareNamespace(String prefix,
String uri)
Declare a user-defined prefix/namespace mapping. |
void |
declareNamespaces(Map namespaceMap)
|
Variable |
declareVariable(String qname,
Object value)
Declare a user-defined variable. |
LocalVariable |
declareVariableBinding(LocalVariable var)
Declare a local variable. |
void |
finishBatchTransaction()
Completes a batch transaction, by committing the transaction and calling finish on any triggers set by setBatchTransactionTrigger() |
void |
functionEnd()
Report the end of the currently executed function. |
void |
functionStart(FunctionSignature signature)
Report the start of a function execution. |
AccessContext |
getAccessContext()
|
AnyURIValue |
getBaseURI()
Get the base URI of the evaluation context. |
Txn |
getBatchTransaction()
Get the Transaction for the batch |
DBBroker |
getBroker()
Get the DBBroker instance used for the current query. |
Collator |
getCollator(String uri)
|
int |
getContextPosition()
Get the current context position, i.e. |
int |
getCurrentStackSize()
Returns the current size of the stack. |
String |
getDefaultCollation()
|
Collator |
getDefaultCollator()
|
String |
getDefaultFunctionNamespace()
Returns the current default function namespace. |
MemTreeBuilder |
getDocumentBuilder()
Get the document builder currently used for creating temporary document fragments. |
int |
getExpressionCount()
Returns the number of expression objects in the internal representation of the query. |
DocumentSet |
getLockedDocuments()
Returns the set of documents that have been loaded and locked during query execution. |
Module |
getModule(String namespaceURI)
Get the built-in module registered for the given namespace URI. |
String |
getModuleLoadPath()
|
Iterator |
getModules()
|
Option |
getOption(QName qname)
|
ExistPDP |
getPDP()
Convenience method that returns the XACML Policy Decision Point for this database instance. |
Pragma |
getPragma(String name,
String contents)
|
String |
getPrefixForURI(String uri)
|
Profiler |
getProfiler()
Returns the Profiler instance of this context
if profiling is enabled. |
Expression |
getRootExpression()
Returns the root expression of the XQuery associated with this context. |
Iterator |
getSignaturesForFunction(QName name)
|
DocumentSet |
getStaticallyKnownDocuments()
|
String |
getURIForPrefix(String prefix)
Return the namespace URI mapped to the registered prefix or null if the prefix is not registered. |
User |
getUser()
Get the user which executes the current query. |
XQueryWatchDog |
getWatchDog()
|
Object |
getXQueryContextVar(String name)
Get an XQuery Context variable. |
boolean |
hasBatchTransaction()
Determines if a batch transaction should be performed |
void |
importModule(String namespaceURI,
String prefix,
String location)
Import a module and make it available in this context. |
boolean |
isBackwardsCompatible()
XPath 1.0 backwards compatibility turned on? In XPath 1.0 compatible mode, additional conversions will be applied to values if a numeric value is expected. |
boolean |
isProfilingEnabled()
|
boolean |
isProfilingEnabled(int verbosity)
|
boolean |
isVarDeclared(QName qname)
|
Module |
loadBuiltInModule(String namespaceURI,
String moduleClass)
Load a built-in module from the given class name and assign it to the namespace URI. |
Iterator |
localFunctions()
|
boolean |
lockDocumentsOnLoad()
Should loaded documents be locked? |
LocalVariable |
markLocalVariables(boolean newContext)
Returns the last variable on the local variable stack. |
boolean |
optimizationsEnabled()
|
void |
popDocumentContext()
|
void |
popInScopeNamespaces()
|
void |
popLocalVariables(LocalVariable var)
Restore the local variable stack to the position marked by variable var. |
void |
popNamespaceContext()
|
void |
prepare()
Prepares the current context before xquery execution |
void |
proceed()
|
void |
proceed(Expression expr)
|
void |
proceed(Expression expr,
MemTreeBuilder builder)
|
void |
pushDocumentContext()
Push any document fragment created within the current execution context on the stack. |
void |
pushInScopeNamespaces()
Push all in-scope namespace declarations onto the stack. |
void |
pushNamespaceContext()
|
void |
recover()
|
void |
registerUpdateListener(UpdateListener listener)
|
void |
releaseLockedDocuments()
Release all locks on documents that have been locked during query execution. |
DocumentSet |
releaseUnusedDocuments(Sequence seq)
Release all locks on documents not being referenced by the sequence. |
void |
removeNamespace(String uri)
Removes the namespace URI from the prefix/namespace mappings table. |
void |
reset()
Prepare this XQueryContext to be reused. |
void |
resolveForwardReferences()
Resolve all forward references to previously undeclared functions. |
UserDefinedFunction |
resolveFunction(QName name,
int argCount)
Resolve a user-defined function. |
Variable |
resolveVariable(QName qname)
Try to resolve a variable. |
Variable |
resolveVariable(String name)
Try to resolve a variable. |
void |
setBackwardsCompatibility(boolean backwardsCompatible)
Turn on/off XPath 1.0 backwards compatibility. |
void |
setBaseURI(AnyURIValue uri)
Set the base URI for the evaluation context. |
void |
setBaseURI(AnyURIValue uri,
boolean setInProlog)
Set the base URI for the evaluation context. |
void |
setBatchTransactionTrigger(DocumentImpl doc)
Set's that a trigger should be executed for the provided document as part of the batch transaction |
void |
setBroker(DBBroker broker)
|
void |
setContextPosition(int pos)
Set the current context position, i.e. |
void |
setDefaultCollation(String uri)
Set the default collation to be used by all operators and functions on strings. |
void |
setDefaultFunctionNamespace(String uri)
Set the default function namespace. |
void |
setLockDocumentsOnLoad(boolean lock)
If lock is true, all documents loaded during query execution will be locked. |
void |
setModuleLoadPath(String path)
Set the path to a base directory where modules should be loaded from. |
void |
setRootExpression(Expression expr)
Called from the XQuery compiler to set the root expression for this context. |
void |
setStaticallyKnownDocuments(DocumentSet set)
|
void |
setStaticallyKnownDocuments(XmldbURI[] docs)
Set the set of statically known documents for the current execution context. |
void |
setStripWhitespace(boolean strip)
|
void |
setXQueryContextVar(String name,
Object XQvar)
Set an XQuery Context variable. |
void |
setXQuerySerializer(String name,
boolean indent,
boolean omitxmldeclaration)
Set the serializer to use for output Used by the context extension module; called by context:set-serializer(). |
void |
startBatchTransaction()
Starts a batch Transaction |
DocumentImpl |
storeTemporaryDoc(DocumentImpl doc)
Store the supplied data to a temporary document fragment. |
boolean |
stripWhitespace()
Returns true if whitespace between constructed element nodes should be stripped by default. |
boolean |
tailRecursiveCall(FunctionSignature signature)
Check if the specified function signature is found in the current function called stack. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String XQUERY_LOCAL_NS
public static final String XQUERY_CONTEXTVAR_XQUERY_UPDATE_ERROR
public static final String HTTP_SESSIONVAR_XMLDB_USER
| Constructor Detail |
|---|
public XQueryContext(DBBroker broker,
AccessContext accessCtx)
public XQueryContext(XQueryContext copyFrom)
| Method Detail |
|---|
public XQueryContext copyContext()
public void prepare()
public AccessContext getAccessContext()
public boolean isProfilingEnabled()
public boolean isProfilingEnabled(int verbosity)
public Profiler getProfiler()
Profiler instance of this context
if profiling is enabled.
public void setRootExpression(Expression expr)
expr - public Expression getRootExpression()
public int getExpressionCount()
public void declareNamespace(String prefix,
String uri)
throws XPathException
prefix - uri -
XPathExceptionpublic void declareNamespaces(Map namespaceMap)
public void declareInScopeNamespace(String prefix,
String uri)
prefix - uri - public String getDefaultFunctionNamespace()
public void setDefaultFunctionNamespace(String uri)
throws XPathException
uri -
XPathException
public void setDefaultCollation(String uri)
throws XPathException
uri -
XPathExceptionpublic String getDefaultCollation()
public Collator getCollator(String uri)
throws XPathException
XPathExceptionpublic Collator getDefaultCollator()
public String getURIForPrefix(String prefix)
prefix -
public String getPrefixForURI(String uri)
uri -
public void removeNamespace(String uri)
uri - public void clearNamespaces()
public void setStaticallyKnownDocuments(XmldbURI[] docs)
docs - public void setStaticallyKnownDocuments(DocumentSet set)
public DocumentSet getStaticallyKnownDocuments()
throws XPathException
XPathExceptionpublic boolean lockDocumentsOnLoad()
setLockDocumentsOnLoad(boolean)public void setLockDocumentsOnLoad(boolean lock)
lock - public DocumentSet getLockedDocuments()
setLockDocumentsOnLoad(boolean)public void releaseLockedDocuments()
setLockDocumentsOnLoad(boolean)
public DocumentSet releaseUnusedDocuments(Sequence seq)
throws XPathException
seq -
XPathExceptionpublic void reset()
public boolean stripWhitespace()
public void setStripWhitespace(boolean strip)
public Iterator getModules()
public Module getModule(String namespaceURI)
namespaceURI -
public boolean checkModulesValid()
public Module loadBuiltInModule(String namespaceURI,
String moduleClass)
Module. The method will try to instantiate the class. If the
class is not found or an exception is thrown, the method will silently
fail. The namespace URI has to be equal to the namespace URI declared
by the module class. Otherwise, the module is not loaded.
namespaceURI - moduleClass - public ExistPDP getPDP()
public void declareFunction(UserDefinedFunction function)
throws XPathException
function -
XPathException
public UserDefinedFunction resolveFunction(QName name,
int argCount)
throws XPathException
name -
XPathExceptionpublic Iterator getSignaturesForFunction(QName name)
public Iterator localFunctions()
public LocalVariable declareVariableBinding(LocalVariable var)
throws XPathException
var -
XPathException
public Variable declareGlobalVariable(Variable var)
throws XPathException
var -
XPathException
public Variable declareVariable(String qname,
Object value)
throws XPathException
qname - the qualified name of the new variable. Any namespaces should
have been declared before.value - a Java object, representing the fixed value of the variable
XPathException - if the value cannot be converted into a known XPath value
or the variable QName references an unknown namespace-prefix.
public Variable resolveVariable(String name)
throws XPathException
name - the qualified name of the variable as string
XPathException - if the variable is unknown
public Variable resolveVariable(QName qname)
throws XPathException
qname - the qualified name of the variable
XPathException - if the variable is unknownpublic boolean isVarDeclared(QName qname)
public void setBackwardsCompatibility(boolean backwardsCompatible)
backwardsCompatible - public boolean isBackwardsCompatible()
public DBBroker getBroker()
public void setBroker(DBBroker broker)
public User getUser()
public MemTreeBuilder getDocumentBuilder()
public void proceed()
throws TerminatedException
TerminatedException
public void proceed(Expression expr)
throws TerminatedException
TerminatedException
public void proceed(Expression expr,
MemTreeBuilder builder)
throws TerminatedException
TerminatedExceptionpublic void recover()
public XQueryWatchDog getWatchDog()
public void pushDocumentContext()
public void popDocumentContext()
public void setBaseURI(AnyURIValue uri)
uri -
public void setBaseURI(AnyURIValue uri,
boolean setInProlog)
uri - setInProlog - public void setModuleLoadPath(String path)
path - public String getModuleLoadPath()
public AnyURIValue getBaseURI()
public void setContextPosition(int pos)
pos - public int getContextPosition()
public void pushInScopeNamespaces()
public void popInScopeNamespaces()
public void pushNamespaceContext()
public void popNamespaceContext()
public LocalVariable markLocalVariables(boolean newContext)
popLocalVariables(LocalVariable).
public void popLocalVariables(LocalVariable var)
var - public int getCurrentStackSize()
public void functionStart(FunctionSignature signature)
public void functionEnd()
public boolean tailRecursiveCall(FunctionSignature signature)
signature -
public void importModule(String namespaceURI,
String prefix,
String location)
throws XPathException
namespaceURI - prefix - location -
XPathExceptionpublic void addForwardReference(FunctionCall call)
call -
public void resolveForwardReferences()
throws XPathException
XPathExceptionpublic boolean optimizationsEnabled()
public void addOption(String qnameString,
String contents)
throws XPathException
XPathExceptionpublic Option getOption(QName qname)
public Pragma getPragma(String name,
String contents)
throws XPathException
XPathException
public DocumentImpl storeTemporaryDoc(DocumentImpl doc)
throws XPathException
doc -
XPathException
public void setXQueryContextVar(String name,
Object XQvar)
name - The variable nameXQvar - The variable value, may be of any xs: typepublic Object getXQueryContextVar(String name)
name - The variable name
public void startBatchTransaction()
throws TransactionException
TransactionExceptionpublic boolean hasBatchTransaction()
public Txn getBatchTransaction()
public void setBatchTransactionTrigger(DocumentImpl doc)
doc - The document to trigger for
public void finishBatchTransaction()
throws TransactionException
TransactionException
public void setXQuerySerializer(String name,
boolean indent,
boolean omitxmldeclaration)
throws XPathException
name - The name of the serializer to useindent - Should the output be indented?omitxmldeclaration - Should the output omit the xml declaration?
XPathExceptionpublic void registerUpdateListener(UpdateListener listener)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||