|
|||||||
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 |
BUILT_IN_MODULE_CLASS_ATTRIBUTE
|
static String |
BUILT_IN_MODULE_SOURCE_ATTRIBUTE
|
static String |
BUILT_IN_MODULE_URI_ATTRIBUTE
|
static String |
CONFIGURATION_ELEMENT_NAME
|
static String |
CONFIGURATION_MODULE_ELEMENT_NAME
|
static String |
CONFIGURATION_MODULES_ELEMENT_NAME
|
static String |
ENABLE_QUERY_REWRITING_ATTRIBUTE
|
static String |
HTTP_SESSIONVAR_XMLDB_USER
|
static String |
PROPERTY_BUILT_IN_MODULES
|
static String |
PROPERTY_ENABLE_QUERY_REWRITING
|
static String |
PROPERTY_STATIC_MODULE_MAP
|
static String |
PROPERTY_XQUERY_BACKWARD_COMPATIBLE
|
static String |
PROPERTY_XQUERY_RAISE_ERROR_ON_FAILED_RETRIEVAL
|
static String |
XQUERY_BACKWARD_COMPATIBLE_ATTRIBUTE
|
static String |
XQUERY_CONTEXTVAR_XQUERY_UPDATE_ERROR
|
static String |
XQUERY_RAISE_ERROR_ON_FAILED_RETRIEVAL_ATTRIBUTE
|
static boolean |
XQUERY_RAISE_ERROR_ON_FAILED_RETRIEVAL_DEFAULT
|
Constructor Summary | |
---|---|
XQueryContext(DBBroker broker,
AccessContext accessCtx)
|
|
XQueryContext(XQueryContext copyFrom)
|
Method Summary | |
---|---|
void |
addDynamicOption(String qnameString,
String contents)
for dynamic run-time options i.e. |
void |
addForwardReference(FunctionCall call)
Add a forward reference to an undeclared function. |
void |
addLockedDocument(DocumentImpl doc)
|
void |
addModifiedDoc(DocumentImpl document)
|
void |
addOption(String qnameString,
String contents)
for static compile-time options i.e. |
void |
analyzeAndOptimizeIfModulesChanged(PathExpr expr)
|
boolean |
checkModulesValid()
For compiled expressions: check if the source of any module imported by the current query has changed since compilation. |
void |
checkOptions(Properties properties)
Check if the XQuery contains pragmas that define serialization settings. |
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 static prefix/namespace mapping. |
void |
declareNamespaces(Map namespaceMap)
|
Variable |
declareVariable(QName qn,
Object value)
|
Variable |
declareVariable(String qname,
Object value)
Declare a user-defined variable. |
LocalVariable |
declareVariableBinding(LocalVariable var)
Declare a local variable. |
void |
expressionEnd(Expression expr)
|
void |
expressionStart(Expression expr)
|
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()
|
Iterator |
getAllModules()
|
Object |
getAttribute(String attribute)
|
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. |
XMLGregorianCalendar |
getCalendar()
|
Collator |
getCollator(String uri)
|
XQueryContext |
getContext()
|
int |
getContextPosition()
Get the current context position, i.e. |
int |
getCurrentStackSize()
Returns the current size of the stack. |
DebuggeeJoint |
getDebuggeeJoint()
|
String |
getDefaultCollation()
|
Collator |
getDefaultCollator()
|
String |
getDefaultElementNamespace()
Returns the current default element namespace. |
String |
getDefaultElementNamespaceSchema()
Returns the current default element namespace. |
String |
getDefaultFunctionNamespace()
Returns the current default function namespace. |
MemTreeBuilder |
getDocumentBuilder()
Get the document builder currently used for creating temporary document fragments. |
MemTreeBuilder |
getDocumentBuilder(boolean explicitCreation)
|
int |
getExpressionCount()
Returns the number of expression objects in the internal representation of the query. |
TimeZone |
getImplicitTimeZone()
|
String |
getInheritedNamespace(String prefix)
|
String |
getInheritedPrefix(String uri)
|
String |
getInScopeNamespace(String prefix)
|
String |
getInScopePrefix(String uri)
|
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. |
LockedDocumentMap |
getProtectedDocs()
|
XQueryContext |
getRootContext()
|
Expression |
getRootExpression()
Returns the root expression of the XQuery associated with this context. |
Module |
getRootModule(String namespaceURI)
|
Iterator |
getRootModules()
|
NamePool |
getSharedNamePool()
Returns the shared name pool used by all in-memory documents which are created within this query context. |
Iterator |
getSignaturesForFunction(QName name)
|
XACMLSource |
getSource()
|
String |
getSourceKey()
Returns the Source Key of the XQuery associated with this context. |
String |
getSourceType()
Returns the Source Type of the XQuery associated with this context. |
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. |
Map<QName,Variable> |
getVariables()
|
XQueryWatchDog |
getWatchDog()
|
Object |
getXQueryContextVar(String name)
Get an XQuery Context variable. |
boolean |
hasBatchTransaction()
Determines if a batch transaction should be performed |
boolean |
hasParent()
Returns true if this context has a parent context (means it is a module context). |
void |
importModule(String namespaceURI,
String prefix,
String location)
Import a module and make it available in this context. |
boolean |
inheritNamespaces()
Returns true if namespaces for constructed element and document nodes should be inherited on copy by default. |
boolean |
inProtectedMode()
|
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 |
isBaseURIDeclared()
The method isBaseURIDeclared |
boolean |
isDebugMode()
|
boolean |
isProfilingEnabled()
|
boolean |
isProfilingEnabled(int verbosity)
|
boolean |
isRaiseErrorOnFailedRetrieval()
|
boolean |
isShared()
|
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. |
static void |
loadModuleClasses(Element xquery,
Map classMap,
Map externalMap)
Read list of built-in modules from the configuration. |
Iterator |
localFunctions()
|
boolean |
lockDocumentsOnLoad()
Should loaded documents be locked? see #setLockDocumentsOnLoad(boolean) |
void |
mapModule(String namespace,
XmldbURI uri)
|
LocalVariable |
markLocalVariables(boolean newContext)
Returns the last variable on the local variable stack. |
boolean |
optimizationsEnabled()
|
boolean |
orderEmptyGreatest()
Returns true if order empty is set to gretest, otherwise false for order empty is least. |
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 |
boolean |
preserveNamespaces()
Returns true if namespaces for constructed element and document nodes should be preserved on copy by default. |
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()
|
void |
pushInScopeNamespaces(boolean inherit)
Push all in-scope namespace declarations onto the stack. |
void |
pushNamespaceContext()
|
void |
registerUpdateListener(UpdateListener listener)
|
void |
removeNamespace(String uri)
Removes the namespace URI from the prefix/namespace mappings table. |
void |
reset()
|
void |
reset(boolean keepGlobals)
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 |
setAttribute(String attribute,
Object value)
|
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 |
setCalendar(XMLGregorianCalendar newCalendar)
|
void |
setContextPosition(int pos)
Set the current context position, i.e. |
void |
setDebuggeeJoint(DebuggeeJoint joint)
|
void |
setDebugMode(boolean isDebugMode)
|
void |
setDefaultCollation(String uri)
Set the default collation to be used by all operators and functions on strings. |
void |
setDefaultElementNamespace(String uri,
String schema)
Set the default element namespace. |
void |
setDefaultElementNamespaceSchema(String uri)
Set the default element namespace. |
void |
setDefaultFunctionNamespace(String uri)
Set the default function namespace. |
void |
setInheritNamespaces(boolean inherit)
The method setInheritNamespaces |
void |
setModule(String namespaceURI,
Module module)
|
void |
setModuleLoadPath(String path)
Set the path to a base directory where modules should be loaded from. |
void |
setOrderEmptyGreatest(boolean order)
The method setOrderEmptyGreatest |
void |
setPreserveNamespaces(boolean preserve)
The method setPreserveNamespaces |
void |
setProtectedDocs(LockedDocumentMap map)
|
void |
setRootExpression(Expression expr)
Called from the XQuery compiler to set the root expression for this context. |
void |
setShared(boolean shared)
|
void |
setSource(XACMLSource source)
|
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 |
setTimeZone(TimeZone newTimeZone)
|
void |
setXQueryContextVar(String name,
Object XQvar)
Set an XQuery Context variable. |
void |
stackEnter(Expression expr)
|
void |
stackLeave(Expression expr)
|
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. |
void |
updateContext(XQueryContext from)
Update the current dynamic context using the properties of another context. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CONFIGURATION_ELEMENT_NAME
public static final String CONFIGURATION_MODULES_ELEMENT_NAME
public static final String ENABLE_QUERY_REWRITING_ATTRIBUTE
public static final String XQUERY_BACKWARD_COMPATIBLE_ATTRIBUTE
public static final String XQUERY_RAISE_ERROR_ON_FAILED_RETRIEVAL_ATTRIBUTE
public static final String CONFIGURATION_MODULE_ELEMENT_NAME
public static final String BUILT_IN_MODULE_URI_ATTRIBUTE
public static final String BUILT_IN_MODULE_CLASS_ATTRIBUTE
public static final String BUILT_IN_MODULE_SOURCE_ATTRIBUTE
public static final String PROPERTY_XQUERY_BACKWARD_COMPATIBLE
public static final String PROPERTY_ENABLE_QUERY_REWRITING
public static final String PROPERTY_XQUERY_RAISE_ERROR_ON_FAILED_RETRIEVAL
public static final boolean XQUERY_RAISE_ERROR_ON_FAILED_RETRIEVAL_DEFAULT
public static final String PROPERTY_BUILT_IN_MODULES
public static final String PROPERTY_STATIC_MODULE_MAP
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 boolean hasParent()
public XQueryContext getRootContext()
public XQueryContext copyContext()
public void updateContext(XQueryContext from)
Eval
.
from
- 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 setSource(XACMLSource source)
public XACMLSource getSource()
public String getSourceKey()
public String getSourceType()
public void declareNamespace(String prefix, String uri) throws XPathException
prefix
- uri
-
XPathException
public void declareNamespaces(Map namespaceMap)
public void removeNamespace(String uri)
uri
- public void declareInScopeNamespace(String prefix, String uri)
prefix
- uri
- public String getInScopeNamespace(String prefix)
public String getInScopePrefix(String uri)
public String getInheritedNamespace(String prefix)
public String getInheritedPrefix(String uri)
public String getURIForPrefix(String prefix)
prefix
-
public String getPrefixForURI(String uri)
uri
-
public String getDefaultFunctionNamespace()
public void setDefaultFunctionNamespace(String uri) throws XPathException
uri
-
XPathException
public String getDefaultElementNamespaceSchema() throws XPathException
XPathException
public void setDefaultElementNamespaceSchema(String uri) throws XPathException
uri
-
XPathException
public String getDefaultElementNamespace() throws XPathException
XPathException
public void setDefaultElementNamespace(String uri, String schema) throws XPathException
uri
- a String
valueschema
- a String
value
XPathException
- if an error occurspublic void setDefaultCollation(String uri) throws XPathException
uri
-
XPathException
public String getDefaultCollation()
public Collator getCollator(String uri) throws XPathException
XPathException
public Collator getDefaultCollator()
public void setStaticallyKnownDocuments(XmldbURI[] docs)
docs
- public void setStaticallyKnownDocuments(DocumentSet set)
public void setCalendar(XMLGregorianCalendar newCalendar)
public void setTimeZone(TimeZone newTimeZone)
public XMLGregorianCalendar getCalendar()
public TimeZone getImplicitTimeZone()
public DocumentSet getStaticallyKnownDocuments() throws XPathException
XPathException
public void setProtectedDocs(LockedDocumentMap map)
public LockedDocumentMap getProtectedDocs()
public boolean inProtectedMode()
public boolean lockDocumentsOnLoad()
public void addLockedDocument(DocumentImpl doc)
public void setShared(boolean shared)
public boolean isShared()
public void addModifiedDoc(DocumentImpl document)
public void reset()
public void reset(boolean keepGlobals)
public boolean stripWhitespace()
public void setStripWhitespace(boolean strip)
public boolean preserveNamespaces()
public void setPreserveNamespaces(boolean preserve)
setPreserveNamespaces
preserve
- a boolean
valuepublic boolean inheritNamespaces()
public void setInheritNamespaces(boolean inherit)
setInheritNamespaces
inherit
- a boolean
valuepublic boolean orderEmptyGreatest()
public void setOrderEmptyGreatest(boolean order)
setOrderEmptyGreatest
order
- a boolean
valuepublic Iterator getModules()
public Iterator getRootModules()
public Iterator getAllModules()
public Module getModule(String namespaceURI)
namespaceURI
-
public Module getRootModule(String namespaceURI)
public void setModule(String namespaceURI, Module module)
public boolean checkModulesValid()
public void analyzeAndOptimizeIfModulesChanged(PathExpr expr) throws XPathException
XPathException
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
-
XPathException
public 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 declareVariable(QName qn, Object value) throws XPathException
XPathException
public Variable resolveVariable(String name) throws XPathException
name
- the qualified name of the variable as string
XPathException
- if the variable is unknownpublic Variable resolveVariable(QName qname) throws XPathException
qname
- the qualified name of the variable
XPathException
- if the variable is unknownpublic boolean isVarDeclared(QName qname)
public Map<QName,Variable> getVariables()
public void setBackwardsCompatibility(boolean backwardsCompatible)
backwardsCompatible
- public boolean isBackwardsCompatible()
public boolean isRaiseErrorOnFailedRetrieval()
public DBBroker getBroker()
public void setBroker(DBBroker broker)
public User getUser()
public MemTreeBuilder getDocumentBuilder()
public MemTreeBuilder getDocumentBuilder(boolean explicitCreation)
public NamePool getSharedNamePool()
public XQueryContext getContext()
public void expressionStart(Expression expr) throws TerminatedException
TerminatedException
public void expressionEnd(Expression expr)
public void stackEnter(Expression expr) throws TerminatedException
TerminatedException
public void stackLeave(Expression expr)
public void proceed() throws TerminatedException
TerminatedException
public void proceed(Expression expr) throws TerminatedException
TerminatedException
public void proceed(Expression expr, MemTreeBuilder builder) throws TerminatedException
TerminatedException
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 boolean isBaseURIDeclared()
isBaseURIDeclared
boolean
valuepublic AnyURIValue getBaseURI() throws XPathException
XPathException
- if an error occurspublic void setContextPosition(int pos)
pos
- public int getContextPosition()
public void pushInScopeNamespaces()
public void pushInScopeNamespaces(boolean inherit)
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 mapModule(String namespace, XmldbURI uri)
public void importModule(String namespaceURI, String prefix, String location) throws XPathException
namespaceURI
- prefix
- location
-
XPathException
public void addForwardReference(FunctionCall call)
call
- public void resolveForwardReferences() throws XPathException
XPathException
public boolean optimizationsEnabled()
public void addOption(String qnameString, String contents) throws XPathException
XPathException
public void addDynamicOption(String qnameString, String contents) throws XPathException
XPathException
public 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 setAttribute(String attribute, Object value)
public Object getAttribute(String attribute)
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
TransactionException
public boolean hasBatchTransaction()
public Txn getBatchTransaction()
public void setBatchTransactionTrigger(DocumentImpl doc)
doc
- The document to trigger forpublic void finishBatchTransaction() throws TransactionException
TransactionException
public void registerUpdateListener(UpdateListener listener)
public void checkOptions(Properties properties) throws XPathException
properties
- the properties object to which serialization parameters will
be added.
XPathException
- if an error occurs while parsing the optionpublic static void loadModuleClasses(Element xquery, Map classMap, Map externalMap) throws DatabaseConfigurationException
Module
.
xquery
- configuration root
DatabaseConfigurationException
public void setDebuggeeJoint(DebuggeeJoint joint)
public DebuggeeJoint getDebuggeeJoint()
public void setDebugMode(boolean isDebugMode)
public boolean isDebugMode()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |