org.xquark.extractor
Class Extractor

java.lang.Object
  extended byorg.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 a full-featured internal data source.
Extractor(java.sql.Connection jdbcConnection, java.lang.String configURL, java.lang.ClassLoader loader)
          Deprecated. prevents the use of a full-featured 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)
          Constructor to use with an extractor configuration file.
Extractor(java.lang.String configURI)
          Constructor to use with a configuration file URL or a JNDI name referencing a JDBC datasource instance.
Extractor(java.lang.String configURI, java.lang.ClassLoader loader)
          Constructor to use with a configuration file URL or a JNDI name referencing a JDBC datasource instance.
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)
          Construction to use when JDBC connection parameters are available.
 
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 configURI)
          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.

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

Extractor

public Extractor(java.lang.String configURI,
                 java.lang.ClassLoader loader)
          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.

Parameters:
configURI - 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

Extractor

public Extractor(java.io.File configFile)
          throws XMLDBCException
Constructor to use with an extractor configuration file.

Parameters:
configFile - a Java symbolic file
Throws:
XMLDBCException

Extractor

public Extractor(java.io.File configFile,
                 java.lang.ClassLoader loader)
          throws XMLDBCException
Constructor to use with an extractor configuration file.

Parameters:
configFile - a Java symbolic file
loader - an application-provided class loader that will be used to load JDBC drivers.
Throws:
XMLDBCException

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

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.

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

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.

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

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

Extractor

public Extractor(java.lang.String jdbcURL,
                 java.lang.String username,
                 java.lang.String password,
                 java.lang.ClassLoader loader)
          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.
loader - an application-provided class loader that will be used to load JDBC drivers.
Throws:
XMLDBCException

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.

Parameters:
jdbcConnection - a jdbc connection.
Throws:
XMLDBCException

Extractor

public Extractor(java.sql.Connection jdbcConnection,
                 java.lang.String configURL)
          throws XMLDBCException
Deprecated. prevents the use of a full-featured internal data source.

Constructs an Extractor using a single JDBC connection and a configuration file.

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

Extractor

public Extractor(java.sql.Connection jdbcConnection,
                 java.lang.String configURL,
                 java.lang.ClassLoader loader)
          throws XMLDBCException
Deprecated. prevents the use of a full-featured internal data source.

Constructs an Extractor using a single JDBC connection and a configuration file.

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
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

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

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

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.


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.