com.xml_project.morganaxproc.xquery
Class StaticXQueryContext

java.lang.Object
  extended by com.xml_project.morganaxproc.xquery.StaticXQueryContext

public class StaticXQueryContext
extends Object

The static context of a query (XPath or XQuery).


Nested Class Summary
static class StaticXQueryContext.Modes
          The constructions modes.
static class StaticXQueryContext.OrderingModes
          The ordering modes.
 
Constructor Summary
StaticXQueryContext(com.xml_project.morganaxproc.xquery.configuration.XQueryConfiguration config, com.xml_project.morganaxproc.xquery.CompilerCommons.CompilerMode mode)
          Creates a new static query context.
 
Method Summary
 void addModule(com.xml_project.morganaxproc.xquery.XQueryModule module)
          Adds a module to the static context.
 void declareInscopeVariable(com.xml_project.morganaxproc.xquery.internal.VariableDeclaration decl)
          Declares an inscope variable.
protected  void dumpVariables()
          Dumps.
 XS_AnyURI getBaseURI()
          Returns the baseURI of this query.
 StaticXQueryContext.Modes getBoundarySpacePolicy()
          Returns the Boundary Space Policy.
 com.xml_project.morganaxproc.xquery.configuration.Collation getCollation(String collationURI)
          Returns the collation with the given uri.
 com.xml_project.morganaxproc.xquery.configuration.XQueryConfiguration getConfiguration()
          Return the configuration for this static context.
 StaticXQueryContext.Modes getConstructionMode()
          Returns the construction mode.
 String getDefaultCollation()
          Return the default collation
 String getDefaultElementNamespace()
          Return the default element namespace.
 String getDefaultFunctionNamespace()
          Return the default function namespace.
 boolean getDefaultOrderForEmptySequences()
          Returns the value for empty order declaration.
 String getEncoding()
          Return the used encoding.
 XPathFunction getFunction(QName fnName, int arity)
          Returns the function with the given name and arity from either default library or installed modules.
 boolean getInheritNamespaceInCopy()
          Return the current value for inherit namespace.
 Object getInscopeElementDeclaration(QName name)
          Returns an inscope element declaration.
 Class<? extends XS_AnyType> getInscopeSchemaType(QName name)
          Return an inscope schema type.
 List<com.xml_project.morganaxproc.xquery.internal.VariableDeclaration> getInscopeVariables()
          Returns all declare inscope variables.
 com.xml_project.morganaxproc.xquery.XQueryModule getModule(String namespace)
          Gets a module from the static context.
 StaticXQueryContext.OrderingModes getOrderingMode()
          Return the ordering mode.
 boolean getPreserveNamespaceInCopy()
          Return the current value for preserve namespace.
 com.xml_project.morganaxproc.xquery.internal.NamespaceList getStaticallyKnownNamespaces()
          Returns a list of statically known namespaces.
 void setBaseURI(XS_AnyURI uri)
          Sets the base uri of this query.
 void setBoundarySpacePolicy(StaticXQueryContext.Modes newMode)
          Sets the boundary whitespace policy.
 void setConstructionMode(StaticXQueryContext.Modes newMode)
          Sets the construction mode.
 void setCopyNamespaces(boolean preserve, boolean inherit)
          Sets the policy for namespace when copying elements.
 void setDefaultCollation(String uri)
          Sets the default collation
 void setDefaultFunctionNamespace(String uri)
          Sets the default function namespace.
 void setDefaultOrderForEmptySequences(boolean emptyFirst)
          Sets the rule for sorting with empty sequences.
 void setEncoding(String newEncoding)
          Sets encoding
 void setOrderingMode(StaticXQueryContext.OrderingModes newMode)
          Sets the ordering mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticXQueryContext

public StaticXQueryContext(com.xml_project.morganaxproc.xquery.configuration.XQueryConfiguration config,
                           com.xml_project.morganaxproc.xquery.CompilerCommons.CompilerMode mode)
Creates a new static query context.

Parameters:
config - the configuration.
mode - the compiler mode.
Method Detail

addModule

public void addModule(com.xml_project.morganaxproc.xquery.XQueryModule module)
Adds a module to the static context.

Parameters:
module - the module

getModule

public com.xml_project.morganaxproc.xquery.XQueryModule getModule(String namespace)
Gets a module from the static context.

Parameters:
namespace - the namespace for the module to get.
Returns:
the module or null.

getBaseURI

public XS_AnyURI getBaseURI()
Returns the baseURI of this query.

Returns:
the baseURI.

getBoundarySpacePolicy

public StaticXQueryContext.Modes getBoundarySpacePolicy()
Returns the Boundary Space Policy.

Returns:
the current policy.

getCollation

public com.xml_project.morganaxproc.xquery.configuration.Collation getCollation(String collationURI)
                                                                         throws XPathException
Returns the collation with the given uri.

Parameters:
collationURI - the uri of the collaction to return.
Returns:
the collation.
Throws:
XPathException - thrown, if the uri is defective or the collation is not supported.

getConfiguration

public com.xml_project.morganaxproc.xquery.configuration.XQueryConfiguration getConfiguration()
Return the configuration for this static context.

Returns:
the configuration.

getDefaultOrderForEmptySequences

public boolean getDefaultOrderForEmptySequences()
Returns the value for empty order declaration.

Returns:
the value for empty order declaration.

getDefaultCollation

public String getDefaultCollation()
Return the default collation

Returns:
the default collation.

getDefaultElementNamespace

public String getDefaultElementNamespace()
Return the default element namespace.

Returns:
the default element namespace.

getDefaultFunctionNamespace

public String getDefaultFunctionNamespace()
Return the default function namespace.

Returns:
the default function namespace

getStaticallyKnownNamespaces

public com.xml_project.morganaxproc.xquery.internal.NamespaceList getStaticallyKnownNamespaces()
Returns a list of statically known namespaces.

Returns:
the statically known namespaces.

getEncoding

public String getEncoding()
Return the used encoding.

Returns:
the used encoding.

getConstructionMode

public StaticXQueryContext.Modes getConstructionMode()
Returns the construction mode.

Returns:
the construction mode.

getOrderingMode

public StaticXQueryContext.OrderingModes getOrderingMode()
Return the ordering mode.

Returns:
the ordering mode.

setBaseURI

public void setBaseURI(XS_AnyURI uri)
                throws XPathException
Sets the base uri of this query.

Parameters:
uri - the base uri.
Throws:
XPathException

setBoundarySpacePolicy

public void setBoundarySpacePolicy(StaticXQueryContext.Modes newMode)
Sets the boundary whitespace policy.

Parameters:
newMode - the boundary whitespace policy.

setConstructionMode

public void setConstructionMode(StaticXQueryContext.Modes newMode)
Sets the construction mode.

Parameters:
newMode - the construction mode to use.

getInscopeSchemaType

public Class<? extends XS_AnyType> getInscopeSchemaType(QName name)
Return an inscope schema type.

Parameters:
name - the inscope schema type.
Returns:
the inscope schema type with the given name.

getInscopeElementDeclaration

public Object getInscopeElementDeclaration(QName name)
Returns an inscope element declaration.

Parameters:
name - the name of the inscope element declation.
Returns:
null, because not supported.

getPreserveNamespaceInCopy

public boolean getPreserveNamespaceInCopy()
Return the current value for preserve namespace.

Returns:
the current value for preserve namespace.

getInheritNamespaceInCopy

public boolean getInheritNamespaceInCopy()
Return the current value for inherit namespace.

Returns:
the current value for inherit namespace.

setDefaultCollation

public void setDefaultCollation(String uri)
                         throws XPathException
Sets the default collation

Parameters:
uri - the uri of the default collation.
Throws:
XPathException - thrown, if the uri is defective or the collation is unknown/unsupported.

setCopyNamespaces

public void setCopyNamespaces(boolean preserve,
                              boolean inherit)
Sets the policy for namespace when copying elements.

Parameters:
preserve - value for preserve.
inherit - value for inherit.

setDefaultFunctionNamespace

public void setDefaultFunctionNamespace(String uri)
                                 throws XPathException
Sets the default function namespace.

Parameters:
uri - the uri of the default function namespace.
Throws:
XPathException - thrown, if the uri is not allowed as default function namespace.

setDefaultOrderForEmptySequences

public void setDefaultOrderForEmptySequences(boolean emptyFirst)
Sets the rule for sorting with empty sequences.

Parameters:
emptyFirst - the new rule.

setEncoding

public void setEncoding(String newEncoding)
Sets encoding

Parameters:
newEncoding - the encoding to use.

getFunction

public XPathFunction getFunction(QName fnName,
                                 int arity)
                          throws XPathException
Returns the function with the given name and arity from either default library or installed modules.

Parameters:
fnName - the name of the function.
arity - the arity of the function.
Returns:
the function or null.
Throws:
XPathException - thrown, if the function can not be found in the default library, but should be there.

setOrderingMode

public void setOrderingMode(StaticXQueryContext.OrderingModes newMode)
Sets the ordering mode.

Parameters:
newMode - the new ordering mode to use.

declareInscopeVariable

public void declareInscopeVariable(com.xml_project.morganaxproc.xquery.internal.VariableDeclaration decl)
Declares an inscope variable.

Parameters:
decl - the declaration.

getInscopeVariables

public List<com.xml_project.morganaxproc.xquery.internal.VariableDeclaration> getInscopeVariables()
Returns all declare inscope variables.

Returns:
the declared variabled.

dumpVariables

protected void dumpVariables()
Dumps.