net.sf.saxon.xqj
Class SaxonXQStaticContext

java.lang.Object
  extended by net.sf.saxon.xqj.SaxonXQStaticContext
All Implemented Interfaces:
javax.xml.xquery.XQStaticContext

public class SaxonXQStaticContext
extends Object
implements javax.xml.xquery.XQStaticContext

Saxon implementation of the XQJ XQStaticContext interface


Constructor Summary
SaxonXQStaticContext(Configuration config)
          Create a SaxonXQStaticContext object, the Saxon implementation of XQStaticContext in XQJ
 
Method Summary
protected  void checkNotNull(Object arg)
           
 void declareNamespace(String prefix, String uri)
          Declares a namespace prefix and associates it with a namespace URI.
 String getBaseURI()
          Gets the Base URI, if set in the static context, else the empty string.
 int getBindingMode()
          Gets the value of the binding mode property.
 int getBoundarySpacePolicy()
          Gets the boundary-space policy defined in the static context.
 int getConstructionMode()
          Gets the construction mode defined in the static context.
 javax.xml.xquery.XQItemType getContextItemStaticType()
          Gets the static type of the context item.
 int getCopyNamespacesModeInherit()
          Gets the inherit part of the copy-namespaces mode defined in the static context.
 int getCopyNamespacesModePreserve()
          Gets the preserve part of the copy-namespaces mode defined in the static context.
 String getDefaultCollation()
          Gets the URI of the default collation.
 String getDefaultElementTypeNamespace()
          Gets the URI of the default element/type namespace, the empty string if not set.
 String getDefaultFunctionNamespace()
          Gets the URI of the default function namespace, the empty string if not set.
 int getDefaultOrderForEmptySequences()
          Gets the default order for empty sequences defined in the static context.
 int getHoldability()
          Gets the value of the holdability property.
 String[] getNamespacePrefixes()
          Returns the prefixes of all the statically known namespaces.
 String getNamespaceURI(String prefix)
          Retrieves the namespace URI associated with a prefix.
 int getOrderingMode()
          Gets the ordering mode defined in the static context.
 int getQueryLanguageTypeAndVersion()
          Gets the value of the language type and version property.
 int getQueryTimeout()
          Retrieves the number of seconds an implementation will wait for a query to execute.
protected  StaticQueryContext getSaxonStaticQueryContext()
          Get a new Saxon StaticQueryContext object holding the information held in this XQStaticContext
 int getScrollability()
          Gets the value of the scrollability property.
 void setBaseURI(String baseUri)
          Sets the Base URI in the static context, specify the empty string to make it undefined.
 void setBindingMode(int bindingMode)
          Sets the binding mode property.
 void setBoundarySpacePolicy(int policy)
          Sets the boundary-space policy in the static context.
 void setConstructionMode(int mode)
          Sets the construction mode in the static context.
 void setContextItemStaticType(javax.xml.xquery.XQItemType contextItemType)
          Sets the static type of the context item, specify null to make it unspecified.
 void setCopyNamespacesModeInherit(int mode)
          Sets the inherit part of the copy-namespaces mode in the static context.
 void setCopyNamespacesModePreserve(int mode)
          Sets the preserve part of the copy-namespaces mode in the static context.
 void setDefaultCollation(String uri)
          Sets the URI of the default collation.
 void setDefaultElementTypeNamespace(String uri)
          Sets the URI of the default element/type namespace, the empty string to make it unspecified.
 void setDefaultFunctionNamespace(String uri)
          Sets the URI of the default function namespace, the empty string to make it unspecified.
 void setDefaultOrderForEmptySequences(int order)
          Sets the default order for empty sequences in the static context.
 void setHoldability(int holdability)
          Sets the holdability property.
 void setOrderingMode(int mode)
          Sets the ordering mode in the static context.
 void setQueryLanguageTypeAndVersion(int langtype)
          Sets the input query language type and version.
 void setQueryTimeout(int seconds)
          Sets the number of seconds an implementation will wait for a query to execute.
 void setScrollability(int scrollability)
          Sets the scrollability of the result sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaxonXQStaticContext

public SaxonXQStaticContext(Configuration config)
Create a SaxonXQStaticContext object, the Saxon implementation of XQStaticContext in XQJ

Parameters:
config - the Saxon configuration
Method Detail

getSaxonStaticQueryContext

protected StaticQueryContext getSaxonStaticQueryContext()
Get a new Saxon StaticQueryContext object holding the information held in this XQStaticContext

Returns:
a newly constructed StaticQueryContext object

declareNamespace

public void declareNamespace(String prefix,
                             String uri)
                      throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Declares a namespace prefix and associates it with a namespace URI. If the namespace URI is the empty string, the prefix is removed from the in-scope namespace definitions.

Specified by:
declareNamespace in interface javax.xml.xquery.XQStaticContext
Parameters:
prefix - the prefix for the namespace URI
uri - the namespace URI. An empty string undeclares the specific prefix. Cannot be null
Throws:
javax.xml.xquery.XQException - if (1) a null prefix, or (2) a null namespace URI is specified

getBaseURI

public String getBaseURI()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the Base URI, if set in the static context, else the empty string.

Specified by:
getBaseURI in interface javax.xml.xquery.XQStaticContext
Returns:
the base URI, if set, else the empty string. Cannot be null..

getBindingMode

public int getBindingMode()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the value of the binding mode property. By default an XQJ implementation operates in immediate binding mode.

Specified by:
getBindingMode in interface javax.xml.xquery.XQStaticContext
Returns:
the binding mode. One of XQConstants.BINDING_MODE_IMMEDIATE, orXQConstants.BINDING_MODE_DEFERRED.

getBoundarySpacePolicy

public int getBoundarySpacePolicy()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the boundary-space policy defined in the static context.

Specified by:
getBoundarySpacePolicy in interface javax.xml.xquery.XQStaticContext
Returns:
the boundary-space policy value. One of: XQConstants.BOUNDARY_SPACE_PRESERVE, XQConstants.BOUNDARY_SPACE_STRIP.

getConstructionMode

public int getConstructionMode()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the construction mode defined in the static context.

Specified by:
getConstructionMode in interface javax.xml.xquery.XQStaticContext
Returns:
construction mode value. One of: XQConstants.CONSTRUCTION_MODE_PRESERVE, XQConstants.CONSTRUCTION_MODE_STRIP

getContextItemStaticType

public javax.xml.xquery.XQItemType getContextItemStaticType()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the static type of the context item. null if unspecified.

Specified by:
getContextItemStaticType in interface javax.xml.xquery.XQStaticContext
Returns:
the static type of the context item, if set, else null

getCopyNamespacesModeInherit

public int getCopyNamespacesModeInherit()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the inherit part of the copy-namespaces mode defined in the static context.

Specified by:
getCopyNamespacesModeInherit in interface javax.xml.xquery.XQStaticContext
Returns:
construction mode value. One of: XQConstants.COPY_NAMESPACES_MODE_INHERIT, XQConstants.COPY_NAMESPACES_MODE_NO_INHERIT.

getCopyNamespacesModePreserve

public int getCopyNamespacesModePreserve()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the preserve part of the copy-namespaces mode defined in the static context.

Specified by:
getCopyNamespacesModePreserve in interface javax.xml.xquery.XQStaticContext
Returns:
construction mode value. One of: XQConstants.COPY_NAMESPACES_MODE_PRESERVE, XQConstants.COPY_NAMESPACES_MODE_NO_PRESERVE.

getDefaultCollation

public String getDefaultCollation()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the URI of the default collation.

Specified by:
getDefaultCollation in interface javax.xml.xquery.XQStaticContext
Returns:
the URI of the default collation. Cannot be null.

getDefaultElementTypeNamespace

public String getDefaultElementTypeNamespace()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the URI of the default element/type namespace, the empty string if not set.

Specified by:
getDefaultElementTypeNamespace in interface javax.xml.xquery.XQStaticContext
Returns:
the URI of the default element/type namespace, if set, else the empty string. Cannot be null

getDefaultFunctionNamespace

public String getDefaultFunctionNamespace()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the URI of the default function namespace, the empty string if not set.

Specified by:
getDefaultFunctionNamespace in interface javax.xml.xquery.XQStaticContext
Returns:
the URI of the default function namespace, if set, else the empty string. Cannot be null

getDefaultOrderForEmptySequences

public int getDefaultOrderForEmptySequences()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the default order for empty sequences defined in the static context.

Specified by:
getDefaultOrderForEmptySequences in interface javax.xml.xquery.XQStaticContext
Returns:
default order for empty sequences value. One of: XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST, XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.

getNamespacePrefixes

public String[] getNamespacePrefixes()
Description copied from interface: javax.xml.xquery.XQStaticContext
Returns the prefixes of all the statically known namespaces. Use the getNamespaceURI method to look up the namespace URI corresponding to a specific prefix.

Specified by:
getNamespacePrefixes in interface javax.xml.xquery.XQStaticContext
Returns:
String array containing the namespace prefixes. Cannot be null

getNamespaceURI

public String getNamespaceURI(String prefix)
                       throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Retrieves the namespace URI associated with a prefix. An XQException is thrown if an unknown prefix is specified, i.e. a prefix not returned by the getInScopeNamespacePrefixes method.

Specified by:
getNamespaceURI in interface javax.xml.xquery.XQStaticContext
Parameters:
prefix - the prefix for which the namespace URI is sought. Cannot be null
Returns:
the namespace URI. Cannot be null
Throws:
javax.xml.xquery.XQException - if a null prefix is specified or if the prefix is unknown

getOrderingMode

public int getOrderingMode()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the ordering mode defined in the static context.

Specified by:
getOrderingMode in interface javax.xml.xquery.XQStaticContext
Returns:
ordering mode value. One of: XQConstants.ORDERING_MODE_ORDERED, XQConstants.ORDERING_MODE_UNORDERED.

getHoldability

public int getHoldability()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the value of the holdability property.

Specified by:
getHoldability in interface javax.xml.xquery.XQStaticContext
Returns:
the type of a result's holdability. One of: XQConstants.HOLDTYPE_HOLD_CURSORS_OVER_COMMIT, or XQConstants.HOLDTYPE_CLOSE_CURSORS_AT_COMMIT.

getQueryLanguageTypeAndVersion

public int getQueryLanguageTypeAndVersion()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the value of the language type and version property. By default an XQJ implementation's default is XQConstants.LANGTYPE_XQUERY.

Specified by:
getQueryLanguageTypeAndVersion in interface javax.xml.xquery.XQStaticContext
Returns:
the language type and version. One of: XQConstants.LANGTYPE_XQUERY, or XQConstants.LANGTYPE_XQUERYX or a negative value indicating a vendor specific query language type and version.

getQueryTimeout

public int getQueryTimeout()
Description copied from interface: javax.xml.xquery.XQStaticContext
Retrieves the number of seconds an implementation will wait for a query to execute.

Specified by:
getQueryTimeout in interface javax.xml.xquery.XQStaticContext
Returns:
the query execution timeout value in seconds. A value of 0 indicates no limit.

getScrollability

public int getScrollability()
Description copied from interface: javax.xml.xquery.XQStaticContext
Gets the value of the scrollability property. By default query results are forward only.

Specified by:
getScrollability in interface javax.xml.xquery.XQStaticContext
Returns:
the type of a result's scrollability. One of: XQConstants.SCROLLTYPE_FORWARD_ONLY, or XQConstants.SCROLLTYPE_SCROLLABLE.

setBaseURI

public void setBaseURI(String baseUri)
                throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the Base URI in the static context, specify the empty string to make it undefined.

Specified by:
setBaseURI in interface javax.xml.xquery.XQStaticContext
Parameters:
baseUri - the new baseUri, or empty string to make it undefined. Cannot be null.
Throws:
javax.xml.xquery.XQException - if a null base uri is specified

setBindingMode

public void setBindingMode(int bindingMode)
                    throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the binding mode property. By default an XQJ implementation operates in immediate binding mode.

Specified by:
setBindingMode in interface javax.xml.xquery.XQStaticContext
Parameters:
bindingMode - the binding mode. One of: XQConstants.BINDING_MODE_IMMEDIATE, orXQConstants.BINDING_MODE_DEFERRED.
Throws:
javax.xml.xquery.XQException - the specified mode is different from XQConstants.BINDING_MODE_IMMEDIATE, XQConstants.BINDING_MODE_DEFERRED

setBoundarySpacePolicy

public void setBoundarySpacePolicy(int policy)
                            throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the boundary-space policy in the static context.

Specified by:
setBoundarySpacePolicy in interface javax.xml.xquery.XQStaticContext
Parameters:
policy - boundary space policy. One of: XQConstants.BOUNDARY_SPACE_PRESERVE, XQConstants.BOUNDARY_SPACE_STRIP.
Throws:
javax.xml.xquery.XQException - the specified mode is different from XQConstants.BOUNDARY_SPACE_PRESERVE, XQConstants.BOUNDARY_SPACE_STRIP

setConstructionMode

public void setConstructionMode(int mode)
                         throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the construction mode in the static context.

Specified by:
setConstructionMode in interface javax.xml.xquery.XQStaticContext
Parameters:
mode - construction mode value. One of: XQConstants.CONSTRUCTION_MODE_PRESERVE, XQConstants.CONSTRUCTION_MODE_STRIP.
Throws:
javax.xml.xquery.XQException - the specified mode is different from XQConstants.CONSTRUCTION_MODE_PRESERVE, XQConstants.CONSTRUCTION_MODE_STRIP

setContextItemStaticType

public void setContextItemStaticType(javax.xml.xquery.XQItemType contextItemType)
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the static type of the context item, specify null to make it unspecified.

Specified by:
setContextItemStaticType in interface javax.xml.xquery.XQStaticContext
Parameters:
contextItemType - the static type of the context item; null if unspecified.

setCopyNamespacesModeInherit

public void setCopyNamespacesModeInherit(int mode)
                                  throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the inherit part of the copy-namespaces mode in the static context.

Specified by:
setCopyNamespacesModeInherit in interface javax.xml.xquery.XQStaticContext
Parameters:
mode - ordering mode value. One of: XQConstants.COPY_NAMESPACES_MODE_INHERIT, XQConstants.COPY_NAMESPACES_MODE_NO_INHERIT.
Throws:
javax.xml.xquery.XQException - the specified mode is different from XQConstants.COPY_NAMESPACES_MODE_INHERIT, XQConstants.COPY_NAMESPACES_MODE_NO_INHERIT

setCopyNamespacesModePreserve

public void setCopyNamespacesModePreserve(int mode)
                                   throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the preserve part of the copy-namespaces mode in the static context.

Specified by:
setCopyNamespacesModePreserve in interface javax.xml.xquery.XQStaticContext
Parameters:
mode - ordering mode value. One of: XQConstants.COPY_NAMESPACES_MODE_PRESERVE, XQConstants.COPY_NAMESPACES_MODE_NO_PRESERVE.
Throws:
javax.xml.xquery.XQException - the specified mode is different from XQConstants.COPY_NAMESPACES_MODE_PRESERVE, XQConstants.COPY_NAMESPACES_MODE_NO_PRESERVE

setDefaultCollation

public void setDefaultCollation(String uri)
                         throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the URI of the default collation.

Specified by:
setDefaultCollation in interface javax.xml.xquery.XQStaticContext
Parameters:
uri - the namespace URI of the default collation. Cannot be null.
Throws:
javax.xml.xquery.XQException - if a null URI is specified

setDefaultElementTypeNamespace

public void setDefaultElementTypeNamespace(String uri)
                                    throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the URI of the default element/type namespace, the empty string to make it unspecified.

Specified by:
setDefaultElementTypeNamespace in interface javax.xml.xquery.XQStaticContext
Parameters:
uri - the namespace URI of the default element/type namespace, the empty string to make it unspecified. Cannot be null.
Throws:
javax.xml.xquery.XQException - if a null uri is specified

setDefaultFunctionNamespace

public void setDefaultFunctionNamespace(String uri)
                                 throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the URI of the default function namespace, the empty string to make it unspecified.

Specified by:
setDefaultFunctionNamespace in interface javax.xml.xquery.XQStaticContext
Parameters:
uri - the namespace URI of the default function namespace, the empty string to make it unspecified. Cannot be null.
Throws:
javax.xml.xquery.XQException - if a null URI is specified

setDefaultOrderForEmptySequences

public void setDefaultOrderForEmptySequences(int order)
                                      throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the default order for empty sequences in the static context.

Specified by:
setDefaultOrderForEmptySequences in interface javax.xml.xquery.XQStaticContext
Parameters:
order - the default order for empty sequences. One of: XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST, XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.
Throws:
javax.xml.xquery.XQException - the specified order for empty sequences is different from XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST, XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST

setOrderingMode

public void setOrderingMode(int mode)
                     throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the ordering mode in the static context.

Specified by:
setOrderingMode in interface javax.xml.xquery.XQStaticContext
Parameters:
mode - ordering mode value. One of: XQConstants.ORDERING_MODE_ORDERED, XQConstants.ORDERING_MODE_UNORDERED.
Throws:
javax.xml.xquery.XQException - the specified mode is different from XQConstants.ORDERING_MODE_ORDERED, XQConstants.ORDERING_MODE_UNORDERED

setQueryTimeout

public void setQueryTimeout(int seconds)
                     throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the number of seconds an implementation will wait for a query to execute. If the implementation does not support query timeout it can ignore the specified timeout value. It the limit is exceeded, the behavor of the query is the same as an execution of a cancel by another thread.

Specified by:
setQueryTimeout in interface javax.xml.xquery.XQStaticContext
Parameters:
seconds - the query execution timeout value in seconds. A value of 0 indicates no limit
Throws:
javax.xml.xquery.XQException - if the passed in value is negative

setHoldability

public void setHoldability(int holdability)
                    throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the holdability property.

Specified by:
setHoldability in interface javax.xml.xquery.XQStaticContext
Parameters:
holdability - the holdability of the result. One of: XQConstants.HOLDTYPE_HOLD_CURSORS_OVER_COMMIT, or XQConstants.HOLDTYPE_CLOSE_CURSORS_AT_COMMIT.
Throws:
javax.xml.xquery.XQException - the specified holdability is different from XQConstants.HOLDTYPE_HOLD_CURSORS_OVER_COMMIT, XQConstants.HOLDTYPE_CLOSE_CURSORS_AT_COMMIT

setQueryLanguageTypeAndVersion

public void setQueryLanguageTypeAndVersion(int langtype)
                                    throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the input query language type and version. When this is set to a particular language type and version, then the query is assumed to be in that language and version.

Specified by:
setQueryLanguageTypeAndVersion in interface javax.xml.xquery.XQStaticContext
Parameters:
langtype - the query language type and version of the inputs. One of: XQConstants.LANGTYPE_XQUERY (default), or XQConstants.LANGTYPE_XQUERYX. A negative number indicates a vendor specific query language type and version.
Throws:
javax.xml.xquery.XQException - the specified langtype is different from XQConstants.LANGTYPE_XQUERY, XQConstants.LANGTYPE_XQUERYX and is not negative

setScrollability

public void setScrollability(int scrollability)
                      throws javax.xml.xquery.XQException
Description copied from interface: javax.xml.xquery.XQStaticContext
Sets the scrollability of the result sequence. By default query results are forward only.

Specified by:
setScrollability in interface javax.xml.xquery.XQStaticContext
Parameters:
scrollability - the scrollability of the result. One of: XQConstants.SCROLLTYPE_FORWARD_ONLY, or XQConstants.SCROLLTYPE_SCROLLABLE.
Throws:
javax.xml.xquery.XQException - the specified crollability type is different from XQConstants.SCROLLTYPE_FORWARD_ONLY, XQConstants.SCROLLTYPE_SCROLLABLE

checkNotNull

protected void checkNotNull(Object arg)
                     throws javax.xml.xquery.XQException
Throws:
javax.xml.xquery.XQException


Copyright (c) Saxonica Limited. All rights reserved.