|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.xquery.XQueryContext
The current XQuery execution context. Contains the static as well as the dynamic XQuery context components.
| Field Summary | |
protected java.lang.String |
baseURI
|
protected boolean |
baseURISetInProlog
|
protected DBBroker |
broker
The main database broker object providing access to storage and indexes. |
protected java.util.Stack |
contextStack
|
protected java.util.TreeMap |
declaredFunctions
|
protected java.lang.String |
defaultFunctionNamespace
|
protected java.util.Stack |
forwardReferences
|
protected java.util.TreeMap |
globalVariables
|
protected java.util.HashMap |
inScopeNamespaces
|
protected java.util.HashMap |
inScopePrefixes
|
protected LocalVariable |
lastVar
|
protected java.lang.String |
moduleLoadPath
|
protected java.util.HashMap |
modules
Loaded modules. |
protected java.util.HashMap |
namespaces
|
protected java.util.Stack |
namespaceStack
|
protected java.util.List |
pragmas
|
protected java.util.HashMap |
prefixes
|
protected java.lang.String[] |
staticDocumentPaths
The set of statically known documents specified as an array of paths to documents and collections. |
protected DocumentSet |
staticDocuments
The actual set of statically known documents. |
protected int |
variableStackSize
|
protected XQueryWatchDog |
watchdog
the watchdog object assigned to this query |
static java.lang.String |
XQUERY_LOCAL_NS
|
| Constructor Summary | |
protected |
XQueryContext(AccessContext accessCtx)
|
|
XQueryContext(DBBroker broker,
AccessContext accessCtx)
|
| Method Summary | |
void |
addForwardReference(FunctionCall call)
Add a forward reference to an undeclared function. |
void |
addPragma(java.lang.String qnameString,
java.lang.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. |
protected void |
clearUpdateListeners()
|
void |
declareFunction(UserDefinedFunction function)
Declare a user-defined function. |
Variable |
declareGlobalVariable(Variable var)
Declare a global variable as by "declare variable". |
void |
declareInScopeNamespace(java.lang.String prefix,
java.lang.String uri)
Declare an in-scope namespace. |
void |
declareNamespace(java.lang.String prefix,
java.lang.String uri)
Declare a user-defined prefix/namespace mapping. |
void |
declareNamespaces(java.util.Map namespaceMap)
|
Variable |
declareVariable(java.lang.String qname,
java.lang.Object value)
Declare a user-defined variable. |
LocalVariable |
declareVariableBinding(LocalVariable var)
Declare a local variable. |
AccessContext |
getAccessContext()
|
java.lang.String |
getBaseURI()
Get the base URI of the evaluation context. |
DBBroker |
getBroker()
Get the DBBroker instance used for the current query. |
java.text.Collator |
getCollator(java.lang.String uri)
|
int |
getContextPosition()
Get the current context position, i.e. |
int |
getCurrentStackSize()
Returns the current size of the stack. |
java.lang.String |
getDefaultCollation()
|
java.text.Collator |
getDefaultCollator()
|
java.lang.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(java.lang.String namespaceURI)
Get the built-in module registered for the given namespace URI. |
java.lang.String |
getModuleLoadPath()
|
java.util.Iterator |
getModules()
Return an iterator over all built-in modules currently registered. |
ExistPDP |
getPDP()
Convenience method that returns the XACML Policy Decision Point for this database instance. |
Pragma |
getPragma(QName qname)
|
java.lang.String |
getPrefixForURI(java.lang.String uri)
Return the prefix mapped to the registered URI or null if the URI is not registered. |
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. |
java.util.Iterator |
getSignaturesForFunction(QName name)
|
DocumentSet |
getStaticallyKnownDocuments()
Get the set of statically known documents. |
java.lang.String |
getURIForPrefix(java.lang.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()
|
java.lang.Object |
getXQueryContextVar(java.lang.String name)
|
void |
importModule(java.lang.String namespaceURI,
java.lang.String prefix,
java.lang.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(java.lang.String namespaceURI,
java.lang.String moduleClass)
Load a built-in module from the given class name and assign it to the namespace URI. |
protected void |
loadDefaults(Configuration config)
Load the default prefix/namespace mappings table and set up internal functions. |
java.util.Iterator |
localFunctions()
|
boolean |
lockDocumentsOnLoad()
Should loaded documents be locked? |
LocalVariable |
markLocalVariables(boolean newContext)
Returns the last variable on the local variable stack. |
protected int |
nextExpressionId()
Returns the next unique expression id. |
void |
popDocumentContext()
|
void |
popInScopeNamespaces()
|
void |
popLocalVariables(LocalVariable var)
Restore the local variable stack to the position marked by variable var. |
void |
popNamespaceContext()
|
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(java.lang.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(java.lang.String name)
Try to resolve a variable. |
void |
setBackwardsCompatibility(boolean backwardsCompatible)
Turn on/off XPath 1.0 backwards compatibility. |
void |
setBaseURI(java.lang.String uri)
Set the base URI for the evaluation context. |
void |
setBaseURI(java.lang.String uri,
boolean setInProlog)
Set the base URI for the evaluation context. |
void |
setBroker(DBBroker broker)
|
void |
setContextPosition(int pos)
Set the current context position, i.e. |
void |
setDefaultCollation(java.lang.String uri)
Set the default collation to be used by all operators and functions on strings. |
void |
setDefaultFunctionNamespace(java.lang.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(java.lang.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(java.lang.String[] docs)
Set the set of statically known documents for the current execution context. |
void |
setStripWhitespace(boolean strip)
|
protected void |
setWatchDog(XQueryWatchDog watchdog)
|
void |
setXQueryContextVar(java.lang.String name,
java.lang.Object XQvar)
|
void |
setXQuerySerializer(java.lang.String name,
boolean indent,
boolean omitxmldeclaration)
|
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String XQUERY_LOCAL_NS
protected java.util.HashMap namespaces
protected java.util.HashMap inScopeNamespaces
protected java.util.HashMap prefixes
protected final java.util.HashMap inScopePrefixes
protected final java.util.Stack namespaceStack
protected final java.util.TreeMap declaredFunctions
protected final java.util.TreeMap globalVariables
protected LocalVariable lastVar
protected final java.util.Stack contextStack
protected int variableStackSize
protected final java.util.Stack forwardReferences
protected java.util.List pragmas
protected XQueryWatchDog watchdog
protected final java.util.HashMap modules
protected java.lang.String[] staticDocumentPaths
protected DocumentSet staticDocuments
protected DBBroker broker
protected java.lang.String baseURI
protected boolean baseURISetInProlog
protected java.lang.String moduleLoadPath
protected java.lang.String defaultFunctionNamespace
| Constructor Detail |
protected XQueryContext(AccessContext accessCtx)
public XQueryContext(DBBroker broker,
AccessContext accessCtx)
| Method Detail |
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()
protected int nextExpressionId()
public int getExpressionCount()
public void declareNamespace(java.lang.String prefix,
java.lang.String uri)
throws XPathException
prefix - uri -
XPathExceptionpublic void declareNamespaces(java.util.Map namespaceMap)
public void declareInScopeNamespace(java.lang.String prefix,
java.lang.String uri)
prefix - uri - public java.lang.String getDefaultFunctionNamespace()
public void setDefaultFunctionNamespace(java.lang.String uri)
uri -
public void setDefaultCollation(java.lang.String uri)
throws XPathException
uri -
XPathExceptionpublic java.lang.String getDefaultCollation()
public java.text.Collator getCollator(java.lang.String uri)
throws XPathException
XPathExceptionpublic java.text.Collator getDefaultCollator()
public java.lang.String getURIForPrefix(java.lang.String prefix)
prefix -
public java.lang.String getPrefixForURI(java.lang.String uri)
uri -
public void removeNamespace(java.lang.String uri)
uri - public void clearNamespaces()
public void setStaticallyKnownDocuments(java.lang.String[] 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)
seq -
public void reset()
public boolean stripWhitespace()
public void setStripWhitespace(boolean strip)
public java.util.Iterator getModules()
public Module getModule(java.lang.String namespaceURI)
namespaceURI -
public boolean checkModulesValid()
public Module loadBuiltInModule(java.lang.String namespaceURI,
java.lang.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 java.util.Iterator getSignaturesForFunction(QName name)
public java.util.Iterator localFunctions()
public LocalVariable declareVariableBinding(LocalVariable var)
throws XPathException
var -
XPathException
public Variable declareGlobalVariable(Variable var)
throws XPathException
XPathException
public Variable declareVariable(java.lang.String qname,
java.lang.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(java.lang.String name)
throws XPathException
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()
protected void setWatchDog(XQueryWatchDog watchdog)
public void pushDocumentContext()
public void popDocumentContext()
public void setBaseURI(java.lang.String uri)
uri -
public void setBaseURI(java.lang.String uri,
boolean setInProlog)
uri - setInProlog - public void setModuleLoadPath(java.lang.String path)
path - public java.lang.String getModuleLoadPath()
public java.lang.String 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 importModule(java.lang.String namespaceURI,
java.lang.String prefix,
java.lang.String location)
throws XPathException
namespaceURI - prefix - location -
XPathExceptionpublic void addForwardReference(FunctionCall call)
call -
public void resolveForwardReferences()
throws XPathException
XPathException
public void addPragma(java.lang.String qnameString,
java.lang.String contents)
throws XPathException
XPathExceptionpublic Pragma getPragma(QName qname)
public DocumentImpl storeTemporaryDoc(DocumentImpl doc)
throws XPathException
XPathException
public void setXQueryContextVar(java.lang.String name,
java.lang.Object XQvar)
public java.lang.Object getXQueryContextVar(java.lang.String name)
public void setXQuerySerializer(java.lang.String name,
boolean indent,
boolean omitxmldeclaration)
throws XPathException
XPathExceptionprotected void loadDefaults(Configuration config)
public void registerUpdateListener(UpdateListener listener)
protected void clearUpdateListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||