com.xml_project.morganaxquery
Class DynamicXQueryContext

java.lang.Object
  extended by com.xml_project.morganaxquery.DynamicXQueryContext

public class DynamicXQueryContext
extends java.lang.Object

The dynamic context of a query (XPath and XQuery)


Nested Class Summary
 class DynamicXQueryContext.VariableScope
           
 
Constructor Summary
protected DynamicXQueryContext(StaticXQueryContext staticContext, com.xml_project.morganaxquery.configuration.XQueryConfiguration config, XdmItem contextItem, long pos, long size)
          Creates a new dynamic query context
 
Method Summary
 void clearVariableScope()
           
 void closeTrace()
           
 DynamicXQueryContext createDynamicContext(XdmItem item, long pos, long length)
           
 void dumpVariableScope()
           
 void evaluateInscopeVariables(java.util.List<java.util.List<com.xml_project.morganaxquery.internal.VariableDeclaration>> declarations)
           
 com.xml_project.morganaxquery.configuration.XQueryConfiguration getConfiguration()
          Returns the configuration settings of this query.
 java.util.Stack<ModelNode> getConstructionStack()
           
 XdmItem getContextItem()
          Returns the context item, if any.
 long getContextPosition()
          Returns the current context position.
 long getContextSize()
          Return the size of the current context.
 XS_DateTime getCurrentDateTime()
          Returns the current dateTime.
 com.xml_project.morganaxpath.nodes.XQueryNodeModel getCurrentNodeModel()
           
 com.xml_project.morganaxpath.local.FallbackLocalizer getFallbackLocalizer()
           
 XS_dayTimeDuration getImplicitTimezone()
          Return the implicit time zone of the query.
 com.xml_project.morganaxpath.local.Localizer getLocalizer(java.lang.String language)
          Return the localizer for the given language or null
 XdmSequence getResolvedCollection(java.lang.String href)
          Returns a collection from the resolved collections.
 ModelNode getResolvedDocument(java.lang.String href)
          Returns a document from the list of resolved documents.
 java.lang.String getResolvedText(java.lang.String href)
           
 StaticXQueryContext getStaticContext()
          Returns the static context of this query (XPath and XQuery).
protected  int getVariableScopes()
           
 XdmSequence getVariableValue(javax.xml.namespace.QName name)
           
 void newVariableScope()
           
 void restoreVariableScope(DynamicXQueryContext.VariableScope scope)
           
 void setCurrentNodeModel(com.xml_project.morganaxpath.nodes.XQueryNodeModel model)
           
 void setResolvedCollection(java.lang.String href, XdmSequence collection)
          Adds a collection to the list of resolved (=known) collections.
 void setResolvedDocument(java.lang.String href, ModelNode node)
          Adds a document to the list of resolved (=known) documents.
 void setResolvedText(java.lang.String href, java.lang.String text)
           
 void setVariable(javax.xml.namespace.QName name, XdmSequence value)
           
 DynamicXQueryContext.VariableScope switchVariableScope()
           
 void trace(java.lang.String sequence, java.lang.String label)
          Method Interface for fn:trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicXQueryContext

protected DynamicXQueryContext(StaticXQueryContext staticContext,
                               com.xml_project.morganaxquery.configuration.XQueryConfiguration config,
                               XdmItem contextItem,
                               long pos,
                               long size)
                        throws XPathException
Creates a new dynamic query context

Parameters:
staticContext -
contextItem -
pos -
size -
Throws:
XPathException
Method Detail

getImplicitTimezone

public XS_dayTimeDuration getImplicitTimezone()
Return the implicit time zone of the query.

Returns:
the implicit time zone.

getCurrentDateTime

public XS_DateTime getCurrentDateTime()
Returns the current dateTime.

Returns:
the current dateTime.

getLocalizer

public com.xml_project.morganaxpath.local.Localizer getLocalizer(java.lang.String language)
Return the localizer for the given language or null

Parameters:
language - a language as in xs:lanuage
Returns:
the localizer or null

getFallbackLocalizer

public com.xml_project.morganaxpath.local.FallbackLocalizer getFallbackLocalizer()
Returns:
the localizer used as fallback.

getStaticContext

public StaticXQueryContext getStaticContext()
Returns the static context of this query (XPath and XQuery).

Returns:
the static context.

getConfiguration

public com.xml_project.morganaxquery.configuration.XQueryConfiguration getConfiguration()
Returns the configuration settings of this query.

Returns:
the configuration settings.

getConstructionStack

public java.util.Stack<ModelNode> getConstructionStack()

getVariableScopes

protected int getVariableScopes()

newVariableScope

public void newVariableScope()

clearVariableScope

public void clearVariableScope()

switchVariableScope

public DynamicXQueryContext.VariableScope switchVariableScope()

restoreVariableScope

public void restoreVariableScope(DynamicXQueryContext.VariableScope scope)

setResolvedCollection

public void setResolvedCollection(java.lang.String href,
                                  XdmSequence collection)
Adds a collection to the list of resolved (=known) collections.

Parameters:
href - uri for this collection.
collection - the collection.

getResolvedCollection

public XdmSequence getResolvedCollection(java.lang.String href)
Returns a collection from the resolved collections.

Parameters:
href - uri of the collection.
Returns:
the collection or null.

setResolvedDocument

public void setResolvedDocument(java.lang.String href,
                                ModelNode node)
Adds a document to the list of resolved (=known) documents.

Parameters:
href - the uri for this document.
node - the document.

getResolvedDocument

public ModelNode getResolvedDocument(java.lang.String href)
Returns a document from the list of resolved documents.

Parameters:
href - the uri of the document.
Returns:
the document or null.

setResolvedText

public void setResolvedText(java.lang.String href,
                            java.lang.String text)

getResolvedText

public java.lang.String getResolvedText(java.lang.String href)

setVariable

public void setVariable(javax.xml.namespace.QName name,
                        XdmSequence value)
                 throws XPathException
Throws:
XPathException

dumpVariableScope

public void dumpVariableScope()

getVariableValue

public XdmSequence getVariableValue(javax.xml.namespace.QName name)

getCurrentNodeModel

public com.xml_project.morganaxpath.nodes.XQueryNodeModel getCurrentNodeModel()

setCurrentNodeModel

public void setCurrentNodeModel(com.xml_project.morganaxpath.nodes.XQueryNodeModel model)

getContextItem

public XdmItem getContextItem()
Returns the context item, if any.

Returns:
the context item or null.

getContextPosition

public long getContextPosition()
Returns the current context position.

Returns:
the current context position.

getContextSize

public long getContextSize()
Return the size of the current context.

Returns:
the size of the current context.

createDynamicContext

public DynamicXQueryContext createDynamicContext(XdmItem item,
                                                 long pos,
                                                 long length)
                                          throws XPathException
Throws:
XPathException

evaluateInscopeVariables

public void evaluateInscopeVariables(java.util.List<java.util.List<com.xml_project.morganaxquery.internal.VariableDeclaration>> declarations)
                              throws XPathException
Parameters:
declarations -
Throws:
XPathException

trace

public void trace(java.lang.String sequence,
                  java.lang.String label)
Method Interface for fn:trace

Parameters:
sequence -
label -

closeTrace

public void closeTrace()