|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
An XQStaticContext represents default values for various
XQuery Static Context Components. Further it includes the
static XQJ properties for an XQExpression or
XQPreparedExpression object.
The following XQuery Static Context Components are supported through the
XQStaticContext interface:
In addition XQStaticContext includes the static XQJ properties
for an XQExpression or XQPreparedExpression object:
Note that XQStaticContext is a value object, changing attributes in
such object doesn't affect any existing XQExpression or
XQPreparedExpression object.
In order to take effect, the application needs to explicitly change the XQConnection
default values, or specify an XQStaticContext object when creating an
XQExpression or XQPreparedExpression.
XQConnection conn = XQDatasource.getConnection();
// get the default values from the implementation
XQStaticContext cntxt = conn.getStaticContext();
// change the base uri
cntxt.setBaseURI("http://www.foo.com/xml/");
// change the implementation defaults
conn.setStaticContext(cntxt);
// create an XQExpression using the new defaults
XQExpression expr1 = conn.createExpression();
// creat an XQExpression, using BaseURI "file:///root/user/john/"
cntxt.setBaseURI("file:///root/user/john/");
XQExpression expr2 = conn.createExpression(cntxt);
...
| Method Summary | |
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. |
XQCommonHandler |
getCommonHandler()
Retrieves the default common handler used for converting items to and from Java objects. |
int |
getConstructionMode()
Gets the construction mode defined in the static context. |
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. |
int |
getScrollability()
Gets the value of the scrollability property. |
int |
getUpdatability()
Gets the value of the updatability property of this connection. |
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 |
setCommonHandler(XQCommonHandler hdlr)
Sets the default common handler to be used for converting items to and from Java objects. |
void |
setConstructionMode(int mode)
Sets the construction mode in the static context. |
void |
setContextItemStaticType(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. |
void |
setUpdatability(int updatability)
Sets the updatability of the result sequence. |
| Method Detail |
public String[] getNamespacePrefixes()
getNamespaceURI method to look up the namespace URI
corresponding to a specific prefix.
String array containing the namespace prefixes.
Cannot be null.
public String getNamespaceURI(String prefix)
throws XQException
XQException
is thrown if an unknown prefix is specified, i.e. a prefix not returned by the
getInScopeNamespacePrefixes method.
prefix - the prefix for which the namespace URI is sought. Cannot
be null.
null if the prefix is unknown.
XQException - if a null prefix is specified
public void declareNamespace(String prefix,
String uri)
throws XQException
prefix - the prefix for the namespace URIuri - the namespace URI. An empty string
undeclares the specific prefix. Cannot be null.
XQException - if (1) a null prefix, or (2) a null namespace
URI is specifiedpublic String getDefaultElementTypeNamespace()
null.
public void setDefaultElementTypeNamespace(String uri)
throws XQException
uri - the namespace URI of the default element/type namespace,
the empty string to make it unspecified.
Cannot be null.
XQException - if a null uri is specifiedpublic String getDefaultFunctionNamespace()
null
public void setDefaultFunctionNamespace(String uri)
throws XQException
uri - the namespace URI of the default function namespace,
the empty string to make it unspecified.
Cannot be null.
XQException - if a null URI is specifiedpublic XQItemType getContextItemStaticType()
null if unspecified.
nullpublic void setContextItemStaticType(XQItemType contextItemType)
null
to make it unspecified.
contextItemType - the static type of the context item; null if unspecified.public String getDefaultCollation()
null.
public void setDefaultCollation(String uri)
throws XQException
uri - the namespace URI of the default collation.
Cannot be null.
XQException - if a null URI is specifiedpublic int getConstructionMode()
XQConstants.CONSTRUCTION_MODE_PRESERVE,
XQConstants.CONSTRUCTION_MODE_STRIP
public void setConstructionMode(int mode)
throws XQException
mode - construction mode value. One of:
XQConstants.CONSTRUCTION_MODE_PRESERVE,
XQConstants.CONSTRUCTION_MODE_STRIP.
XQException - the specified mode is different from
XQConstants.CONSTRUCTION_MODE_PRESERVE,
XQConstants.CONSTRUCTION_MODE_STRIPpublic int getOrderingMode()
XQConstants.ORDERING_MODE_ORDERED,
XQConstants.ORDERING_MODE_UNORDERED.
public void setOrderingMode(int mode)
throws XQException
mode - ordering mode value. One of:
XQConstants.ORDERING_MODE_ORDERED,
XQConstants.ORDERING_MODE_UNORDERED.
XQException - the specified mode is different from
XQConstants.ORDERING_MODE_ORDERED,
XQConstants.ORDERING_MODE_UNORDEREDpublic int getDefaultOrderForEmptySequences()
XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST,
XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.
public void setDefaultOrderForEmptySequences(int order)
throws XQException
order - the default order for empty sequences. One of:
XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST,
XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.
XQException - the specified order for empty sequences is different from
XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST,
XQConstants.DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEASTpublic int getBoundarySpacePolicy()
XQConstants.BOUNDARY_SPACE_PRESERVE,
XQConstants.BOUNDARY_SPACE_STRIP.
public void setBoundarySpacePolicy(int policy)
throws XQException
policy - boundary space policy. One of:
XQConstants.BOUNDARY_SPACE_PRESERVE,
XQConstants.BOUNDARY_SPACE_STRIP.
XQException - the specified mode is different from
XQConstants.BOUNDARY_SPACE_PRESERVE,
XQConstants.BOUNDARY_SPACE_STRIPpublic int getCopyNamespacesModePreserve()
XQConstants.COPY_NAMESPACES_MODE_PRESERVE,
XQConstants.COPY_NAMESPACES_MODE_NO_PRESERVE.
public void setCopyNamespacesModePreserve(int mode)
throws XQException
mode - ordering mode value. One of:
XQConstants.COPY_NAMESPACES_MODE_PRESERVE,
XQConstants.COPY_NAMESPACES_MODE_NO_PRESERVE.
XQException - the specified mode is different from
XQConstants.COPY_NAMESPACES_MODE_PRESERVE,
XQConstants.COPY_NAMESPACES_MODE_NO_PRESERVEpublic int getCopyNamespacesModeInherit()
XQConstants.COPY_NAMESPACES_MODE_INHERIT,
XQConstants.COPY_NAMESPACES_MODE_NO_INHERIT.
public void setCopyNamespacesModeInherit(int mode)
throws XQException
mode - ordering mode value. One of:
XQConstants.COPY_NAMESPACES_MODE_INHERIT,
XQConstants.COPY_NAMESPACES_MODE_NO_INHERIT.
XQException - the specified mode is different from
XQConstants.COPY_NAMESPACES_MODE_INHERIT,
XQConstants.COPY_NAMESPACES_MODE_NO_INHERITpublic String getBaseURI()
null..
public void setBaseURI(String baseUri)
throws XQException
baseUri - the new baseUri, or empty string to make it undefined.
Cannot be null.
XQException - if a null base uri is specifiedpublic int getBindingMode()
XQConstants.BINDING_MODE_IMMEDIATE,
orXQConstants.BINDING_MODE_DEFERRED.
public void setBindingMode(int bindingMode)
throws XQException
bindingMode - the binding mode. One of:
XQConstants.BINDING_MODE_IMMEDIATE,
orXQConstants.BINDING_MODE_DEFERRED.
XQException - the specified mode is different from
XQConstants.BINDING_MODE_IMMEDIATE,
XQConstants.BINDING_MODE_DEFERREDpublic int getHoldability()
XQConstants.HOLDTYPE_HOLD_CURSORS_OVER_COMMIT,
or XQConstants.HOLDTYPE_CLOSE_CURSORS_AT_COMMIT.
public void setHoldability(int holdability)
throws XQException
holdability - the holdability of the result. One of:
XQConstants.HOLDTYPE_HOLD_CURSORS_OVER_COMMIT,
or XQConstants.HOLDTYPE_CLOSE_CURSORS_AT_COMMIT.
XQException - the specified holdability is different from
XQConstants.HOLDTYPE_HOLD_CURSORS_OVER_COMMIT,
XQConstants.HOLDTYPE_CLOSE_CURSORS_AT_COMMITpublic int getQueryLanguageTypeAndVersion()
XQConstants.LANGTYPE_XQUERY.
XQConstants.LANGTYPE_XQUERY,
or XQConstants.LANGTYPE_XQUERYX
or a negative value indicating a vendor specific
query language type and version.
public void setQueryLanguageTypeAndVersion(int langType)
throws XQException
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.
XQException - the specified langtype is different from
XQConstants.LANGTYPE_XQUERY,
XQConstants.LANGTYPE_XQUERYX and is not negativepublic int getScrollability()
XQConstants.SCROLLTYPE_FORWARD_ONLY, or
XQConstants.SCROLLTYPE_SCROLLABLE.
public void setScrollability(int scrollability)
throws XQException
scrollability - the scrollability of the result. One of:
XQConstants.SCROLLTYPE_FORWARD_ONLY, or
XQConstants.SCROLLTYPE_SCROLLABLE.
XQException - the specified crollability type is different from
XQConstants.SCROLLTYPE_FORWARD_ONLY,
XQConstants.SCROLLTYPE_SCROLLABLEpublic int getUpdatability()
XQConstants.RESULTTYPE_READ_ONLY.
public void setUpdatability(int updatability)
throws XQException
updatability - the type of the result's updatability. One of:
XQConstants.RESULTTYPE_READ_ONLY.
XQException - the specified updatability type is different from
XQConstants.RESULTTYPE_READ_ONLYpublic int getQueryTimeout()
public void setQueryTimeout(int seconds)
throws XQException
seconds - the query execution timeout value in seconds.
A value of 0 indicates no limit
XQException - if the passed in value is negativepublic XQCommonHandler getCommonHandler()
null if the default XQJ mapping is
used.
XQCommonHandler being used.
null in case of the default.
public void setCommonHandler(XQCommonHandler hdlr)
throws XQException
null to use the default XQJ
mapping.
hdlr - the XQCommonHandler to use.
null to use the default.
XQExceptionXQItemAccessor.getObject()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||