org.xquark.extractor
Class Extractor

java.lang.Object
  |
  +--org.xquark.extractor.Extractor
All Implemented Interfaces:
org.xquark.extractor.common.Constants, XMLDataSource

public class Extractor
extends java.lang.Object
implements XMLDataSource, org.xquark.extractor.common.Constants

Extractor XML/DBC DataSource implementation.


Field Summary
static java.lang.String JNDI_SCHEME
           
 
Fields inherited from interface org.xquark.extractor.common.Constants
CASE_LOWER, CASE_LOWER_TOKEN, CASE_MIXED, CASE_MIXED_TOKEN, CASE_UPPER, CASE_UPPER_TOKEN, ELEMENT_FORM_DEFAULT, EXCLUDES, INCLUDES, LABEL_DATASOURCE, LABEL_SPEC_ALIAS, LABEL_SPEC_CASE, LABEL_SPEC_CATALOG, LABEL_SPEC_COLUMN, LABEL_SPEC_DATABASE_NAME, LABEL_SPEC_DATABASE_VERSION, LABEL_SPEC_DESCRIPTION, LABEL_SPEC_DRIVER, LABEL_SPEC_ELEMENTFORMDEFAULT, LABEL_SPEC_EXCLUDES, LABEL_SPEC_INCLUDES, LABEL_SPEC_JNDI, LABEL_SPEC_NAME, LABEL_SPEC_PASSWORD, LABEL_SPEC_PK_COLUMN, LABEL_SPEC_REGEX, LABEL_SPEC_SCHEMA, LABEL_SPEC_SITE, LABEL_SPEC_SUBST, LABEL_SPEC_SUBST_CHAR, LABEL_SPEC_SUBST_NAMECASE, LABEL_SPEC_SUBST_SUBST, LABEL_SPEC_SUBST_VALUE, LABEL_SPEC_TABLE, LABEL_SPEC_TARGETNAMESPACE, LABEL_SPEC_URL, LABEL_SPEC_USER, LABEL_SPEC_VIEW, LABEL_SPEC_VIEW_NAME, NONE, QUALIFIED, UNQUALIFIED
 
Constructor Summary
Extractor(java.sql.Connection jdbcConnection)
          Deprecated. prevents the use of an external or internal data source.
Extractor(java.sql.Connection jdbcConnection, java.lang.String configURL)
          Deprecated. prevents the use of an external or internal data source.
Extractor(java.sql.Connection jdbcConnection, java.lang.String configURL, java.lang.ClassLoader loader)
          Deprecated. prevents the use of an external or internal data source.
Extractor(javax.sql.DataSource ds)
          Constructor to use with a JDBC data source.
Extractor(javax.sql.DataSource ds, java.io.File configFile)
          Constructor to use with a JDBC data source and an extractor configuration file.
Extractor(javax.sql.DataSource ds, java.lang.String configURL)
          Constructor to use with a JDBC data source and an extractor configuration file URL.
Extractor(java.io.File configFile)
          Constructor to use with an extractor configuration file.
Extractor(java.io.File configFile, java.lang.ClassLoader loader)
          Use this constructor when you need a specific classloader that will be used to load JDBC drivers.
Extractor(java.lang.String URI)
          Constructor to use with a configuration file URL or a JNDI name referencing a JDBC datasource instance.
Extractor(java.lang.String URI, java.lang.ClassLoader loader)
          Use this constructor when you need a specific classloader that will be used to load JDBC drivers.
Extractor(java.lang.String jdbcURL, java.lang.String username, java.lang.String password)
          Construction to use when JDBC connection parameters are available.
Extractor(java.lang.String jdbcURL, java.lang.String username, java.lang.String password, java.lang.ClassLoader loader)
          Use this constructor when you need a specific classloader that will be used to load JDBC drivers.
 
Method Summary
 void close()
          Closes the extractor and the underlying resources among which the internal JDBC data source except if it was passed at construction time.
 XMLConnection getConnection()
          Creates a new XML/DBC connection instance.
 XMLConnection getConnection(java.lang.String user, java.lang.String password)
          Not implemented by Extractor.
 ExtractorConnection getExtractorConnection()
          Creates a new XML/DBC connection instance for the extractor, avoiding a cast on getConnection() to access Extractor specific features.
 javax.sql.DataSource getJdbcDataSource()
          Returns the internal JDBC data source.
 int getLoginTimeout()
          Get the internal JDBC datasource login timeout.
 java.io.PrintWriter getLogWriter()
          Get the internal JDBC datasource log writer.
 java.lang.String getURL()
          Gets the XML/DBC URL of the Extractor (XML data source).
 java.lang.String getUserName()
          Gets the user name used to log to the Extractor.
 void setLoginTimeout(int seconds)
          Set the internal JDBC datasource login timeout.
 void setLogWriter(java.io.PrintWriter writer)
          Sets the internal JDBC datasource log writer.
 void setUseScrollableResultSets(boolean use)
          To indicate the Extractor that scrollable JDBC result sets must be used.
 boolean useScrollableResultSets()
          Accessor to the "use scrollable result set" option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JNDI_SCHEME

public static final java.lang.String JNDI_SCHEME
See Also:
Constant Field Values
Constructor Detail

Extractor

public Extractor(java.lang.String URI)
          throws XMLDBCException
Constructor to use with a configuration file URL or a JNDI name referencing a JDBC datasource instance. The configuration file is expected to contain JDBC connection parameters or a JNDI name. Choose this last solution if you both need to specify a configuration file and a JNDI name. See the XQuery Language Reference Guide" for more information about configuration files.

Parameters:
URI - either the configuration file URL, or a JNDI reference that MUST be prefixed with the "jndi:" string to be recognized as this.
Throws:
XMLDBCException - API exception

Extractor

public Extractor(java.lang.String URI,
                 java.lang.ClassLoader loader)
          throws XMLDBCException
Use this constructor when you need a specific classloader that will be used to load JDBC drivers.

Parameters:
URI - either a file URL, or a JNDI reference that MUST be prefixed with the "jndi:" string to be recognized as this.
loader - an application-provided class loader that will be used to load JDBC drivers.
Throws:
XMLDBCException - API exception
See Also:
Extractor(String)

Extractor

public Extractor(java.io.File configFile)
          throws XMLDBCException
Constructor to use with an extractor configuration file. See the XQuery Language Reference Guide for more information about configuration files.

Parameters:
configFile - a Java symbolic file.
Throws:
XMLDBCException - API exception

Extractor

public Extractor(java.io.File configFile,
                 java.lang.ClassLoader loader)
          throws XMLDBCException
Use this constructor when you need a specific classloader that will be used to load JDBC drivers.

Parameters:
configFile - a Java symbolic file
loader - an application-provided class loader that will be used to load JDBC drivers.
Throws:
XMLDBCException - API exception
See Also:
Extractor(File)

Extractor

public Extractor(javax.sql.DataSource ds)
          throws XMLDBCException
Constructor to use with a JDBC data source.

Parameters:
ds - a JDBC data source.
Throws:
XMLDBCException - API exception

Extractor

public Extractor(javax.sql.DataSource ds,
                 java.lang.String configURL)
          throws XMLDBCException
Constructor to use with a JDBC data source and an extractor configuration file URL. See the XQuery Language Reference Guide for more information about configuration files.

Parameters:
ds - a JDBC data source.
configURL - the URL of the configuration file.
Throws:
XMLDBCException - API exception

Extractor

public Extractor(javax.sql.DataSource ds,
                 java.io.File configFile)
          throws XMLDBCException
Constructor to use with a JDBC data source and an extractor configuration file. See the XQuery Language Reference Guide for more information about configuration files.

Parameters:
ds - a JDBC data source.
configFile - a Java symbolic file
Throws:
XMLDBCException - API exception

Extractor

public Extractor(java.lang.String jdbcURL,
                 java.lang.String username,
                 java.lang.String password)
          throws XMLDBCException
Construction to use when JDBC connection parameters are available.

Parameters:
jdbcURL - the JDBC URL of the JDBC data source.
username - the login name for the JDBC data source.
password - the password for the login name.
Throws:
XMLDBCException - API exception

Extractor

public Extractor(java.lang.String jdbcURL,
                 java.lang.String username,
                 java.lang.String password,
                 java.lang.ClassLoader loader)
          throws XMLDBCException
Use this constructor when you need a specific classloader that will be used to load JDBC drivers.

Parameters:
jdbcURL - the JDBC URL of the JDBC data source.
username - the login name for the JDBC data source.
password - the password for the login name.
loader - an application-provided class loader that will be used to load JDBC drivers.
Throws:
XMLDBCException - API exception
See Also:
Extractor(String, String, String)

Extractor

public Extractor(java.sql.Connection jdbcConnection)
          throws XMLDBCException
Deprecated. prevents the use of an external or internal data source.

Constructs an Extractor using a single JDBC connection. This connection should not be used while the XQBridge object is active.

Parameters:
jdbcConnection - a jdbc connection.
Throws:
XMLDBCException - API exception

Extractor

public Extractor(java.sql.Connection jdbcConnection,
                 java.lang.String configURL)
          throws XMLDBCException
Deprecated. prevents the use of an external or internal data source.

Constructs an Extractor using a single JDBC connection and a configuration file. The connection should not be used while the XQBridge object is active.

Parameters:
jdbcConnection - a jdbc connection.
configURL - the URL of the configuration file.
Throws:
XMLDBCException - API exception

Extractor

public Extractor(java.sql.Connection jdbcConnection,
                 java.lang.String configURL,
                 java.lang.ClassLoader loader)
          throws XMLDBCException
Deprecated. prevents the use of an external or internal data source.

Use this constructor when you need a specific classloader that will be used to load JDBC drivers.

Parameters:
jdbcConnection - a jdbc connection.
configURL - the URL of the configuration file.
loader - an application-provided class loader that will be used to load JDBC drivers.
Throws:
XMLDBCException - API exception
See Also:
Extractor(Connection, String)
Method Detail

setLogWriter

public void setLogWriter(java.io.PrintWriter writer)
Sets the internal JDBC datasource log writer.

Specified by:
setLogWriter in interface XMLDataSource
Parameters:
writer -

getLogWriter

public java.io.PrintWriter getLogWriter()
Get the internal JDBC datasource log writer.

Specified by:
getLogWriter in interface XMLDataSource
Returns:
java.io.PrintWriter

setLoginTimeout

public void setLoginTimeout(int seconds)
Set the internal JDBC datasource login timeout.

Specified by:
setLoginTimeout in interface XMLDataSource
Parameters:
seconds - the login timeout in seconds.

getLoginTimeout

public int getLoginTimeout()
Get the internal JDBC datasource login timeout.

Specified by:
getLoginTimeout in interface XMLDataSource
Returns:
the login timeout in seconds.

close

public void close()
           throws XMLDBCException
Closes the extractor and the underlying resources among which the internal JDBC data source except if it was passed at construction time.

Throws:
XMLDBCException - API exception

getJdbcDataSource

public javax.sql.DataSource getJdbcDataSource()
Returns the internal JDBC data source.

Returns:
the internal JDBC source.

getConnection

public XMLConnection getConnection()
                            throws XMLDBCException
Creates a new XML/DBC connection instance.

Specified by:
getConnection in interface XMLDataSource
Returns:
an XMLConnection to the XML/SQL datasource.
Throws:
XMLDBCException - API exception

getExtractorConnection

public ExtractorConnection getExtractorConnection()
                                           throws XMLDBCException
Creates a new XML/DBC connection instance for the extractor, avoiding a cast on getConnection() to access Extractor specific features.

Returns:
an ExtractorConnection
Throws:
XMLDBCException - API exception

getConnection

public XMLConnection getConnection(java.lang.String user,
                                   java.lang.String password)
                            throws XMLDBCException
Not implemented by Extractor.

Specified by:
getConnection in interface XMLDataSource
Parameters:
user - the data source registered user
password - the user's password
Returns:
an XMLConnection object that represents a connection to the data source
Throws:
XMLDBCException - If a data source access error occurs
See Also:
XMLDataSource.getConnection(java.lang.String, java.lang.String)

useScrollableResultSets

public boolean useScrollableResultSets()
Accessor to the "use scrollable result set" option.

Returns:
true, if the extractor must use scrollable JDBC result sets.

setUseScrollableResultSets

public void setUseScrollableResultSets(boolean use)
To indicate the Extractor that scrollable JDBC result sets must be used.

Parameters:
use - a boolean.

getUserName

public java.lang.String getUserName()
Gets the user name used to log to the Extractor.

Returns:
a string

getURL

public java.lang.String getURL()
Gets the XML/DBC URL of the Extractor (XML data source).

Returns:
generally the JDBC URL prefixed with "xdbc:xquark:extractor:".


Copyright © 2004 Université de Versailles Saint-Quentin, XQuark Group. All rights reserved.