public abstract class BaseDatabaseCollectionReader extends BaseLeoCollectionReader
Modifier and Type | Field and Description |
---|---|
protected DataManager |
dataManager
DataManager that performs the query and returns the results.
|
protected String |
driver
Driver to be used for the database connection.
|
protected List<Object[]> |
mRecordList
List of Records that were returned by the query.
|
protected int |
mRowIndex
Index of the current analyte being processed, -1 if the query has not yet been executed.
|
protected String |
password
Password for this database.
|
protected String |
url
Connection URL for the database to be accessed.
|
protected String |
username
Username for this database.
|
filters, textFilters
Constructor and Description |
---|
BaseDatabaseCollectionReader()
Default constructor used during UIMA initialization.
|
BaseDatabaseCollectionReader(DatabaseConnectionInformation databaseConnectionInformation)
Initialize the connection information from the DatabaseConnectionInformation object.
|
BaseDatabaseCollectionReader(String driver,
String url,
String username,
String password)
Initialize the connection information to the parameters provided.
|
Modifier and Type | Method and Description |
---|---|
protected void |
getData(String query)
Executes the query and saves the results internally to a
List of Object[] to be retrieved when
getNext() is called. |
protected DataManager |
getDataManager()
Get the data manager to run queries with.
|
String |
getDriver()
Get the Driver text string.
|
abstract void |
getNext(org.apache.uima.cas.CAS aCAS) |
String |
getPassword()
Get the database password.
|
abstract org.apache.uima.util.Progress[] |
getProgress()
Gets information about the number of entities and/or amount of data that has been read from
this
CollectionReader , and the total amount that remains (if that information
is available). |
String |
getURL()
Database connection URL.
|
String |
getUsername()
Return the database username.
|
abstract boolean |
hasNext() |
<T extends BaseDatabaseCollectionReader> |
setDriver(String driver)
Set the driver name for this reader.
|
<T extends BaseDatabaseCollectionReader> |
setPassword(String password)
Set the database password.
|
<T extends BaseDatabaseCollectionReader> |
setURL(String url)
Set the driver URL.
|
<T extends BaseDatabaseCollectionReader> |
setUsername(String username)
Set the database username.
|
addFilters, addFilters, close, generateCollectionReaderDescription, getFilters, initialize, produceCollectionReader
destroy, getCasInitializer, getProcessingResourceMetaData, initialize, isConsuming, reconfigure, setCasInitializer, typeSystemInit
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
getCasManager, getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger, setMetaData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
@LeoConfigurationParameter(mandatory=true) protected String driver
@LeoConfigurationParameter(mandatory=true) protected String url
@LeoConfigurationParameter protected String username
@LeoConfigurationParameter protected String password
protected int mRowIndex
protected DataManager dataManager
public BaseDatabaseCollectionReader()
public BaseDatabaseCollectionReader(DatabaseConnectionInformation databaseConnectionInformation)
databaseConnectionInformation
- database connection information to set.public BaseDatabaseCollectionReader(String driver, String url, String username, String password)
driver
- JDBC driver to use.url
- JDBC url for the connection.username
- username for database access.password
- password of the database access user.public String getDriver()
public <T extends BaseDatabaseCollectionReader> T setDriver(String driver)
driver
- driver stringpublic String getURL()
public <T extends BaseDatabaseCollectionReader> T setURL(String url)
url
- driver URL.public String getUsername()
public <T extends BaseDatabaseCollectionReader> T setUsername(String username)
username
- database usernamepublic String getPassword()
public <T extends BaseDatabaseCollectionReader> T setPassword(String password)
password
- database passwordpublic abstract void getNext(org.apache.uima.cas.CAS aCAS) throws org.apache.uima.collection.CollectionException, IOException
getNext
in interface org.apache.uima.collection.CollectionReader
getNext
in class BaseLeoCollectionReader
aCAS
- the CAS to populate with the next document;org.apache.uima.collection.CollectionException
- if there is a problem getting the next and populating the CAS.IOException
public abstract boolean hasNext() throws IOException, org.apache.uima.collection.CollectionException
hasNext
in interface org.apache.uima.collection.base_cpm.BaseCollectionReader
hasNext
in class BaseLeoCollectionReader
IOException
org.apache.uima.collection.CollectionException
public abstract org.apache.uima.util.Progress[] getProgress()
CollectionReader
, and the total amount that remains (if that information
is available).
This method returns an array of Progress
objects so that results can be reported
using different units. For example, the CollectionReader could report progress in terms of the
number of documents that have been read and also in terms of the number of bytes that have been
read. In many cases, it will be sufficient to return just one Progress
object.Progress
objects. Each object may have different units (for
example number of entities or bytes).protected void getData(String query) throws SQLException, ClassNotFoundException, org.apache.uima.collection.CollectionException
List of Object[]
to be retrieved when
getNext()
is called.query
- the sql query to run.ClassNotFoundException
- if the driver cannot be foundSQLException
- if there is an error executing the queryorg.apache.uima.collection.CollectionException
- if there is an error setting the data.protected DataManager getDataManager() throws SQLException, ClassNotFoundException
SQLException
ClassNotFoundException
Copyright © 2018 Department of Veterans Affairs. All Rights Reserved.