Interface XQConnection2
- All Superinterfaces:
XQConnection,XQDataFactory
XQConnection, based on findings whilst trying to implement
XQJ API v1.0.-
Method Summary
Modifier and TypeMethodDescription<T> TcreateModuleProxy(String namespaceUri, String moduleUri, Class<T> clazz) Creates a Module Proxy, a Java Facade of an XQuery Library Module.<T> TcreateModuleProxy(String namespaceUri, String moduleUri, Class<T> clazz, XQStaticContext properties) Creates a Module Proxy, a Java Facade of an XQuery Library Module.voidinsertItem(String uri, XQItem item, XQInsertOptions options) Inserts an item into the XML DataSource with a given URI.booleanRetrieves whether the connection object is in read-only mode.voidsetReadOnly(boolean readOnly) Puts this connection in read-only mode as a hint to the driver to enable database optimizations.Methods inherited from interface javax.xml.xquery.XQConnection
close, commit, createExpression, createExpression, getAutoCommit, getMetaData, getStaticContext, isClosed, prepareExpression, prepareExpression, prepareExpression, prepareExpression, prepareExpression, prepareExpression, rollback, setAutoCommit, setStaticContextMethods inherited from interface javax.xml.xquery.XQDataFactory
createAtomicType, createAtomicType, createAttributeType, createAttributeType, createCommentType, createDocumentElementType, createDocumentSchemaElementType, createDocumentType, createElementType, createElementType, createItem, createItemFromAtomicValue, createItemFromBoolean, createItemFromByte, createItemFromDocument, createItemFromDocument, createItemFromDocument, createItemFromDocument, createItemFromDocument, createItemFromDouble, createItemFromFloat, createItemFromInt, createItemFromLong, createItemFromNode, createItemFromObject, createItemFromShort, createItemFromString, createItemType, createNodeType, createProcessingInstructionType, createSchemaAttributeType, createSchemaElementType, createSequence, createSequence, createSequenceType, createTextType
-
Method Details
-
createModuleProxy
Creates a Module Proxy, a Java Facade of an XQuery Library Module.Invoking methods on the returned instance will manifest in the implementation calling XQuery functions contained within the specified XQuery Library Module.
Java method parameters are mapped to XQuery function parameters according to the mapping rules outlined in the XQJ2 specification.
The XDM result of calling the XQuery function will be mapped into the Java interface's expected return type for that method, if possible.
Invoking Module Proxy methods will implicitly close any previous result sequences obtained from the connection.
Invoking XQuery Functions from Java in this manner was described in the presentation Building Bridges from Java to XQuery at XML Prague 2012.
- Parameters:
namespaceUri- The Namespace URI of the XQuery Library Module, required parameter.moduleUri- The URI of the XQuery Library Module,nullis permitted.clazz- A regular Java interface class, acting as the Facade for the XQuery Library Module.- Returns:
- An instance of the interface class supplied in the
clazzparameter. - Throws:
XQException
-
createModuleProxy
<T> T createModuleProxy(String namespaceUri, String moduleUri, Class<T> clazz, XQStaticContext properties) throws XQException Creates a Module Proxy, a Java Facade of an XQuery Library Module.Invoking methods on the returned instance will manifest in the implementation calling XQuery functions contained within the specified XQuery Library Module.
Java method parameters are mapped to XQuery function parameters according to the mapping rules outlined in the XQJ2 specification.
The XDM result of calling the XQuery function will be mapped into the Java interface's expected return type for that method, if possible.
Invoking Module Proxy methods will implicitly close any previous result sequences obtained from the connection.
Invoking XQuery Functions from Java in this manner was described in the presentation Building Bridges from Java to XQuery at XML Prague 2012.
- Parameters:
namespaceUri- The Namespace URI of the XQuery Library Module, required parameter.moduleUri- The URI of the XQuery Library Module,nullis permitted.clazz- A regular Java interface class, acting as the Facade for the XQuery Library Module.properties- The static context properties, which the XQuery Module Proxy should run against.- Returns:
- An instance of the interface class supplied in the
clazzparameter. - Throws:
XQException
-
insertItem
Inserts an item into the XML DataSource with a given URI.The item must be a document node.
This method pays respect to the state of the auto-commit attribute.
If auto-commit is set to
false, an item or items will only be committed once the commit method has been invoked.- Parameters:
uri- The absolute URI of the item. Can not benull.item- The item to insert. Must be a document node. Can not benull.options- Gives hints to the implementation regarding how to ingest the item. Can be null.- Throws:
XQException- if any of the following is true- the specified uri or item is
null - the item is not a document node
- the underlying object implementing the interface is closed
- the specified item is closed
- an implementation issue occurred whilst inserting the item
- the specified uri or item is
-
setReadOnly
Puts this connection in read-only mode as a hint to the driver to enable database optimizations.Note: This method cannot be called during a transaction.
- Parameters:
readOnly- true enables read-only mode; false disables it- Throws:
XQException- if any of the following is true- If this connection object is currently in the process of executing a transaction
- the connection object has been closed
- the vendor does not support transactions in the manner requested
- an implementation issue occurred whilst changing the transaction mode
-
isReadOnly
Retrieves whether the connection object is in read-only mode.- Returns:
trueif the connection object is read-only;falseotherwise- Throws:
XQException- if this connection object is closed
-