|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.jafer.interfaces.Databean
|
+--org.jafer.databeans.JDBC
Superclass with behaviour common to subclasses. Specific subclasses configured to make use of specific JDBC drivers should be instantiated.
No caching available, apart from the ResultSet object (which may have a Forward Only cursor).
XML configuration files:
config.xml
Database name, username, password for JDBC driver to use.
Toggle to return results with initial search (piggyback) on/off.
Number of results to return.
List of templates for creating records of different formats, with locations of the files.
Mappings of Use attributes to database tables and columns. (Also prefix/append values to add to SQL query for each.)
Mappings for translation of Relation attribute values to SQL operators.
OAITemplate.xml
Template record conforming to OAI schema. Data from database is inserted in place of
MODSTemplate.xml
Template record conforming to MODS schema. Data from database is inserted in place of
(Column names are taken from the XML record template in use, and are expected to be of the form tableName.columnName.)
query.xsl
| Field Summary | |
private static org.apache.xpath.CachedXPathAPI |
cachedXPath
|
private java.util.Hashtable |
columnNames
|
static java.lang.String |
CONFIG_FILE
|
private org.w3c.dom.Document |
configDocument
|
protected java.sql.Connection |
connection
|
private java.lang.String |
currentDatabase
|
private javax.sql.DataSource |
dataSource
|
private java.lang.String |
defaultRecordSchema
|
protected int |
fetchSize
|
private java.lang.String |
hostName
|
static java.util.logging.Logger |
logger
|
protected int |
nResults
|
private java.util.Hashtable |
paramMap
|
protected java.lang.String |
password
|
private int |
port
|
protected org.w3c.dom.Node |
query
|
static java.lang.String |
QUERY_XSLT
|
private java.lang.String |
queryString
|
private java.net.URL |
queryXSLT
|
private int |
recordCursor
|
private org.w3c.dom.Document |
recordDocument
|
private java.lang.String |
recordSchema
|
private java.util.Hashtable |
recordSchemas
|
private org.w3c.dom.Document |
recordTemplate
|
protected java.sql.ResultSet |
resultSet
|
private java.util.Hashtable |
tableNames
|
protected java.lang.String |
username
|
| Constructor Summary | |
JDBC()
Loads configuration info from config files. |
|
| Method Summary | |
private void |
configure(java.lang.String schema)
Sets current record template according to schema supplied. |
protected abstract void |
configureDataSource()
|
private org.w3c.dom.Element |
createParamNodeSet(java.util.Hashtable table,
java.lang.String elementName)
|
private Field |
createRecord()
|
private java.lang.String |
getAttributeValue(org.w3c.dom.Node node,
java.lang.String attName)
|
protected abstract java.sql.Connection |
getConnection()
Gets a conection from the DataSource in use. |
java.lang.String |
getCurrentDatabase()
Get database of current record |
Field |
getCurrentRecord()
Creates record from data in database, following record template layout. |
java.lang.String[] |
getDatabases()
Returns an array containing the name of the single database that can be searched. |
java.lang.String |
getElementSpec()
Get current element specification setting |
int |
getFetchSize()
|
java.lang.String |
getHost()
Get current Z39.50 host |
private org.w3c.dom.Node |
getNewTemplate()
|
int |
getNumberOfResults()
Get number of results for last query |
int |
getPort()
Get Z39.50 datasource IP Port |
org.w3c.dom.Node |
getQuery()
Get the last submitted query |
protected java.lang.String |
getQueryString()
|
int |
getRecordCursor()
Get the current record position cursor |
java.lang.String |
getRecordSchema()
Get currently set record schema |
java.lang.String |
getResultSetName()
|
java.lang.String |
getSearchProfile()
|
protected java.sql.Statement |
getStatement()
Gets a new Statement, which can be modified in subclasses. |
private void |
getTemplateColumns(org.w3c.dom.Node node)
|
protected java.lang.String |
getXMLConfigValue(java.lang.String name)
|
private void |
initialise()
Loads XML config file, sets available schemas (and default schema). Loads query transform stylesheet. Loads database name, user name and password for JDBC conection from XML config file. |
boolean |
isCheckRecordFormat()
Get record schema checking setting |
boolean |
isParseQuery()
|
protected java.lang.String |
processInsert(java.lang.String columnName)
|
private void |
processNode(org.w3c.dom.Node node)
|
void |
saveQuery(java.lang.String filePath)
|
protected void |
search()
Executes search on database using current query. |
private org.w3c.dom.Node |
selectNode(org.w3c.dom.Node sourceNode,
java.lang.String XPath)
|
void |
setCheckRecordFormat(boolean checkRecordFormat)
Throw exception is record schema not preferred schema |
private void |
setColumnName(java.lang.String name)
|
void |
setDatabases(java.lang.String database)
Method doesn't do anything. |
void |
setDatabases(java.lang.String[] databases)
Method doesn't do anything. |
void |
setElementSpec(java.lang.String elementSpec)
Set element specification for record retrieval |
void |
setFetchSize(int fetchSize)
|
void |
setFetchSize(java.lang.String fetchSize)
|
void |
setHost(java.lang.String hostName)
Z39.50 Host address |
void |
setParseQuery(boolean parseQuery)
|
void |
setPort(int port)
Set Z39.50 datasource IP port |
protected void |
setQueryString(boolean includeResults)
Transforms XML query to SQL string via stylesheet. |
void |
setRecordCursor(int nRecord)
Set the current record cursor |
void |
setRecordSchema(java.lang.String schema)
Sets record format to produce, using schema name. If a template is not available, uses default record format set in config.xml, or last schema set successfully. |
private void |
setRecordSchemas()
|
private void |
setRecordTemplate(java.lang.String schema)
|
void |
setResultSetName(java.lang.String resultSetName)
|
void |
setSearchProfile(java.lang.String searchProfile)
|
private void |
setTableName(java.lang.String name)
|
private void |
setTransformParams()
|
int |
submitQuery(org.w3c.dom.Node query)
Send query in XML form |
| Methods inherited from class org.jafer.interfaces.Databean |
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static java.util.logging.Logger logger
private java.net.URL queryXSLT
private org.w3c.dom.Document configDocument
private org.w3c.dom.Document recordTemplate
private org.w3c.dom.Document recordDocument
private java.util.Hashtable columnNames
private java.util.Hashtable tableNames
private java.util.Hashtable paramMap
private java.util.Hashtable recordSchemas
protected org.w3c.dom.Node query
private javax.sql.DataSource dataSource
protected java.sql.Connection connection
protected java.sql.ResultSet resultSet
private java.lang.String hostName
private java.lang.String currentDatabase
private java.lang.String defaultRecordSchema
private java.lang.String recordSchema
private java.lang.String queryString
protected java.lang.String username
protected java.lang.String password
private int port
private int recordCursor
protected int nResults
protected int fetchSize
private static org.apache.xpath.CachedXPathAPI cachedXPath
public static final java.lang.String CONFIG_FILE
public static final java.lang.String QUERY_XSLT
| Constructor Detail |
public JDBC()
initialise()| Method Detail |
public void setHost(java.lang.String hostName)
Z3950Connection
setHost in interface Z3950ConnectionhostName - Host ip addresspublic java.lang.String getHost()
Z3950Connection
getHost in interface Z3950Connectionpublic void setPort(int port)
Z3950Connection
setPort in interface Z3950Connectionpublic int getPort()
Z3950Connection
getPort in interface Z3950Connection
public void setRecordCursor(int nRecord)
throws JaferException
Present
setRecordCursor in interface PresentnRecord - Record position (starting at 1)
JaferExceptionpublic int getRecordCursor()
Present
getRecordCursor in interface Presentpublic void setCheckRecordFormat(boolean checkRecordFormat)
Present
setCheckRecordFormat in interface PresentcheckRecordFormat - setting of record schema checkingpublic boolean isCheckRecordFormat()
Present
isCheckRecordFormat in interface Presentpublic void setElementSpec(java.lang.String elementSpec)
Present
setElementSpec in interface PresentelementSpec - element specificationpublic java.lang.String getElementSpec()
Present
getElementSpec in interface Presentpublic void setRecordSchema(java.lang.String schema)
setRecordSchema in interface Presentschema - record schemapublic java.lang.String getRecordSchema()
Present
getRecordSchema in interface Present
public Field getCurrentRecord()
throws JaferException
getCurrentRecord in interface PresentJaferExceptionpublic java.lang.String getCurrentDatabase()
Present
getCurrentDatabase in interface Presentpublic void setSearchProfile(java.lang.String searchProfile)
setSearchProfile in interface Searchpublic java.lang.String getSearchProfile()
getSearchProfile in interface Searchpublic void setResultSetName(java.lang.String resultSetName)
setResultSetName in interface Searchpublic java.lang.String getResultSetName()
getResultSetName in interface Searchpublic void setDatabases(java.lang.String database)
config.xml)
setDatabases in interface Searchdatabase - (not used)public void setDatabases(java.lang.String[] databases)
config.xml)
setDatabases in interface Searchdatabases - (not used)public java.lang.String[] getDatabases()
config.xml)
getDatabases in interface Searchpublic void setParseQuery(boolean parseQuery)
setParseQuery in interface Searchpublic boolean isParseQuery()
isParseQuery in interface Search
public int submitQuery(org.w3c.dom.Node query)
throws JaferException
Search
submitQuery in interface SearchJaferException
public void saveQuery(java.lang.String filePath)
throws JaferException
saveQuery in interface SearchJaferExceptionpublic int getNumberOfResults()
Search
getNumberOfResults in interface Searchpublic org.w3c.dom.Node getQuery()
Search
getQuery in interface Searchpublic void setFetchSize(int fetchSize)
public void setFetchSize(java.lang.String fetchSize)
public int getFetchSize()
protected void search()
throws java.sql.SQLException,
JaferException
java.sql.SQLException
JaferException
protected abstract java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Statement getStatement()
throws java.sql.SQLException
java.sql.SQLException
protected void setQueryString(boolean includeResults)
throws JaferException
JaferExceptionprotected java.lang.String getQueryString()
private Field createRecord()
throws java.sql.SQLException,
JaferException
java.sql.SQLException
JaferExceptionprivate org.w3c.dom.Node getNewTemplate()
private void processNode(org.w3c.dom.Node node)
throws java.sql.SQLException,
JaferException
java.sql.SQLException
JaferException
protected java.lang.String processInsert(java.lang.String columnName)
throws java.sql.SQLException,
JaferException
java.sql.SQLException
JaferException
private void initialise()
throws JaferException
JaferExceptionprivate void configure(java.lang.String schema)
protected abstract void configureDataSource()
throws JaferException
JaferException
private void setRecordSchemas()
throws JaferException
JaferExceptionprivate void setRecordTemplate(java.lang.String schema)
private void getTemplateColumns(org.w3c.dom.Node node)
private void setTransformParams()
protected java.lang.String getXMLConfigValue(java.lang.String name)
throws JaferException
JaferExceptionprivate void setColumnName(java.lang.String name)
private void setTableName(java.lang.String name)
private org.w3c.dom.Element createParamNodeSet(java.util.Hashtable table,
java.lang.String elementName)
private org.w3c.dom.Node selectNode(org.w3c.dom.Node sourceNode,
java.lang.String XPath)
throws JaferException
JaferException
private java.lang.String getAttributeValue(org.w3c.dom.Node node,
java.lang.String attName)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||