|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface represents a connection with a specific XML data source.
Within the context of an XMLConnection, XQuery or XPath statements are executed
and XML results are returned.
This interface is used by both read-only connections and storage connections,
which require access to a larger set of interfaces, such as interfaces representing
XML collections and documents. Classes providing read-only access to XML data sources
can avoid implementing the optional interfaces for XML storage management, by deriving
from the abstract class DefautReadOnlyXMLConnection.
Field Summary | |
static short |
TRANSACTION_NONE
Indicates that transactions are not supported. |
static short |
TRANSACTION_READ_COMMITTED
Indicates that transactions are supported and dirty reads are prevented but non-repeatable reads and phantom reads can occur. |
static short |
TRANSACTION_READ_UNCOMMITTED
Indicates that transactions are supported but dirty reads, non-repeatable reads and phantom reads can occur. |
static short |
TRANSACTION_REPEATABLE_READ
Indicates that transactions are supported, dirty reads and non-repeatable reads are prevented but phantom reads can occur. |
static short |
TRANSACTION_SERIALIZABLE
Indicates that transactions are supported but and dirty reads, non-repeatable reads and phantom reads are prevented. |
static short |
XPATH_STRING_TYPE
Defines type for queries: XPath in a String. |
static short |
XQUERY_STRING_TYPE
Defines type for queries: XQuery in a String. |
Method Summary | |
void |
close()
To close the current data source connection. |
void |
commit()
Makes all changes made since the previous commit/rollback permanent and releases any data source locks currently held by the Connection. |
XMLCollection |
createCollection(java.lang.String name,
java.lang.String description,
Configurable config)
Creates a new XML collection. |
Configurable |
createCollectionConfig()
Creates a new XML Collection configuration for set features and properties before create a XML Collection. |
XMLStatement |
createStatement()
Creates a statement object for sending XQuery (query type by default) statements to the data source. |
XMLStatement |
createStatement(short queryType)
Creates a statement object for sending XQuery or XPath (according to the specified type) statements to the data source. |
int |
deleteAllCollections()
Deletes all XML collections of this connection. |
void |
deleteCollection(java.lang.String name)
Deletes an XML collection by its name. |
boolean |
getAutoCommit()
To know the current auto-commit state. |
XMLCollection |
getCollection(java.lang.String name)
Creates an XMLcollection object featuring the XML documents collection. |
XMLDataSourceMetaData |
getMetaData()
Gets the metadata regarding this connection's data source. |
XMLDataSourceMetaData |
getMetaData(boolean refresh)
Gets the metadata regarding this connection's data source. |
short |
getTransactionIsolation()
Gets this Connection's current transaction isolation level. |
java.lang.String |
getURL()
To get the current URL of this connection. |
java.lang.String |
getUserName()
To get the current user name. |
boolean |
isClosed()
To know the connection state (opened or closed). |
boolean |
isReadOnly()
To know the read/write mode of the current connection. |
PreparedXMLStatement |
prepareStatement(java.lang.String query)
Creates a prepared statement object for sending parameterized XQuery (query type by default) statements to the data source. |
void |
renameCollection(java.lang.String oldname,
java.lang.String newname)
Renames an XML collection by its name. |
void |
rollback()
Drops all changes made since the previous commit/rollback and releases any data source locks currently held by this Connection. |
void |
setAutoCommit(boolean autoCommitMode)
Sets this connection's auto-commit mode. |
void |
setBaseURI(java.lang.String baseURI)
Sets the base URI for documents. |
void |
setReadOnly(boolean readOnlyMode)
To change the read/write mode of the connection. |
void |
setTransactionIsolation(short level)
Attempts to change the transaction isolation level to the one given. |
Field Detail |
public static final short TRANSACTION_NONE
public static final short TRANSACTION_READ_UNCOMMITTED
public static final short TRANSACTION_READ_COMMITTED
public static final short TRANSACTION_REPEATABLE_READ
public static final short TRANSACTION_SERIALIZABLE
public static final short XQUERY_STRING_TYPE
public static final short XPATH_STRING_TYPE
Method Detail |
public void close() throws XMLDBCException
XMLDBCException
- if a data source access error occurs.public boolean isClosed() throws XMLDBCException
XMLDBCException
- if a data source access error occurs.public boolean isReadOnly() throws XMLDBCException
XMLDBCException
- if a data source access error occurs.public void setReadOnly(boolean readOnlyMode) throws XMLDBCException, XMLDBCNotSupportedException
readOnlyMode
- if true, the connection will pass in read-only mode, else in read/write mode.
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source is read-only and the parameter is false.public XMLDataSourceMetaData getMetaData() throws XMLDBCException
getMetaData(boolean)
to enforce refresh.
XMLDBCException
- if a data source access error occurs.public XMLDataSourceMetaData getMetaData(boolean refresh) throws XMLDBCException
refresh
- if true, reload metadata.
XMLDBCException
- if a data source access error occurs.public java.lang.String getUserName() throws XMLDBCException
XMLDBCException
- if a data source access error occurs.public java.lang.String getURL() throws XMLDBCException
XMLDBCException
- if a data source access error occurs.public XMLStatement createStatement() throws XMLDBCException
XMLDBCException
- if a data source access error occurs.public XMLStatement createStatement(short queryType) throws XMLDBCException
queryType
- the type of query for this statement (see constants in this interface).
XMLDBCException
- if a data source access error occurs.public PreparedXMLStatement prepareStatement(java.lang.String query) throws XMLDBCException, XMLDBCNotSupportedException
query
- a parameterized XQuery.
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the method is not supported.public Configurable createCollectionConfig() throws XMLDBCException, XMLDBCNotSupportedException
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support this operation (typically, when the data source is read-only)public XMLCollection createCollection(java.lang.String name, java.lang.String description, Configurable config) throws XMLDBCException, XMLDBCNotSupportedException
name
- the unique name of the new XML collection.description
- the description of the new XML collection (optional).config
- a XML collection configuration. If null, the XML collection will be created with default configuration.
XMLDBCException
- if a data source access error occurs or if the XML collection name already exists.
XMLDBCNotSupportedException
- if the data source does not support this operation (typically, when the data source is read-only)public void deleteCollection(java.lang.String name) throws XMLDBCException, XMLDBCNotSupportedException
name
- the unique name of an existing XML collection.
XMLDBCException
- if a data source access error occurs or if the XML collection does not exist.
XMLDBCNotSupportedException
- if the data source does not support this operation (typically, when the data source is read-only)public void renameCollection(java.lang.String oldname, java.lang.String newname) throws XMLDBCException, XMLDBCNotSupportedException
oldname
- the unique name of an existing XML collection.newname
- the new unique name of an existing XML collection.
XMLDBCException
- if a data source access error errors, if the collection does not exist, or if the new name is not unique.
XMLDBCNotSupportedException
- if the data source does not support this operation (typically, when the data source is read-only)public int deleteAllCollections() throws XMLDBCException, XMLDBCNotSupportedException
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support this operation (typically, when the data source is read-only)public XMLCollection getCollection(java.lang.String name) throws XMLDBCException, XMLDBCNotSupportedException
The returned object may hold resources and should be closed after use.
name
- a name of an XML documents collection.
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support this operation (typically, when the data source is read-only)public void commit() throws XMLDBCException, XMLDBCNotSupportedException
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support transactionspublic void setAutoCommit(boolean autoCommitMode) throws XMLDBCException, XMLDBCNotSupportedException
autoCommitMode
- if true, the connection will pass in auto-commit mode, else in manual commit mode.
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support transactionspublic boolean getAutoCommit() throws XMLDBCException, XMLDBCNotSupportedException
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support transactionspublic void rollback() throws XMLDBCException, XMLDBCNotSupportedException
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support transactionspublic short getTransactionIsolation() throws XMLDBCException, XMLDBCNotSupportedException
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support transactionspublic void setTransactionIsolation(short level) throws XMLDBCException, XMLDBCNotSupportedException
level
- one of the TRANSACTION_* (see field summary) isolation values with the exception of
TRANSACTION_NONE; some data sources may not support other values.
XMLDBCException
- if a data source access error occurs.
XMLDBCNotSupportedException
- if the data source does not support transactionspublic void setBaseURI(java.lang.String baseURI)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |