org.jafer.databeans
Class Adaptor

java.lang.Object
  extended by org.jafer.interfaces.Databean
      extended by org.jafer.databeans.Adaptor
All Implemented Interfaces:
java.io.Serializable, Present, Search
Direct Known Subclasses:
QueryAdaptor, RecordAdaptor

public class Adaptor
extends Databean
implements Search, Present

Super class for adaptors, includes methods to set transforms via templates object and specify source and target schemas - configured via server.xml

Version:
1.0
Author:
Antony Corfield; Matthew Dovey; Colin Tatham
See Also:
Serialized Form

Field Summary
private  Databean databean
           
private  java.lang.String sourceSchema
           
private  java.lang.String targetSchema
           
private  javax.xml.transform.Templates template
           
 
Constructor Summary
Adaptor()
           
 
Method Summary
 java.lang.String getCurrentDatabase()
          Get database of current record
 Field getCurrentRecord()
          Get current record
 java.lang.String[] getDatabases()
          Get databases currently searched
 Databean getDatabean()
           
 java.lang.String getElementSpec()
          Get current element specification setting
 int getNumberOfResults()
          Get number of results for last query
 int getNumberOfResults(java.lang.String databaseName)
          Get number of results from the named database for last query
 java.lang.Object getQuery()
          Get the last submitted query
 int getRecordCursor()
          Get the current record position cursor
 java.lang.String getRecordSchema()
          Get currently set record schema
 java.lang.String getResultSetName()
           
 JaferException getSearchException(java.lang.String database)
          If a search fails this method will return the JaferException for the specified database
 JaferException[] getSearchException(java.lang.String[] databases)
          If a search fails this method will return the JaferException for the specified databases
 java.lang.String getSourceSchema()
           
 java.lang.String getTargetSchema()
           
 javax.xml.transform.Templates getTransform()
           
 boolean isCheckRecordFormat()
          Get record schema checking setting
 boolean isParseQuery()
           
 void saveQuery(java.lang.String file)
           
 void setCheckRecordFormat(boolean checkRecordFormat)
          Throw exception is record schema not preferred schema
 void setDatabases(java.lang.String database)
          Set database to search
 void setDatabases(java.lang.String[] databases)
          Set databases to search
 void setDatabean(Databean databean)
           
 void setElementSpec(java.lang.String elementSpec)
          Set element specification for record retrieval
 void setParseQuery(boolean parseQuery)
           
 void setRecordCursor(int nRecord)
          Set the current record cursor
 void setRecordSchema(java.lang.String schema)
          Set current prefered record schema
 void setResultSetName(java.lang.String resultSetName)
           
 void setSourceSchema(java.lang.String sourceSchema)
           
 void setTargetSchema(java.lang.String targetSchema)
           
 void setTransform(javax.xml.transform.Templates template)
           
 int submitQuery(java.lang.Object query)
          Send query (can be in XML form)
 
Methods inherited from class org.jafer.interfaces.Databean
getCacheSupport, getPresentSupport, getScanSupport, getSearchSupport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

databean

private Databean databean

template

private javax.xml.transform.Templates template

sourceSchema

private java.lang.String sourceSchema

targetSchema

private java.lang.String targetSchema
Constructor Detail

Adaptor

public Adaptor()
Method Detail

setTransform

public void setTransform(javax.xml.transform.Templates template)

getTransform

public javax.xml.transform.Templates getTransform()

setSourceSchema

public void setSourceSchema(java.lang.String sourceSchema)

getSourceSchema

public java.lang.String getSourceSchema()

setTargetSchema

public void setTargetSchema(java.lang.String targetSchema)

getTargetSchema

public java.lang.String getTargetSchema()

setDatabean

public void setDatabean(Databean databean)

getDatabean

public Databean getDatabean()

submitQuery

public int submitQuery(java.lang.Object query)
                throws JaferException
Description copied from interface: Search
Send query (can be in XML form)

Specified by:
submitQuery in interface Search
Returns:
number of records found
Throws:
JaferException

getCurrentRecord

public Field getCurrentRecord()
                       throws JaferException
Description copied from interface: Present
Get current record

Specified by:
getCurrentRecord in interface Present
Returns:
record
Throws:
JaferException

setRecordCursor

public void setRecordCursor(int nRecord)
                     throws JaferException
Description copied from interface: Present
Set the current record cursor

Specified by:
setRecordCursor in interface Present
Parameters:
nRecord - Record position (starting at 1)
Throws:
JaferException

getRecordCursor

public int getRecordCursor()
Description copied from interface: Present
Get the current record position cursor

Specified by:
getRecordCursor in interface Present
Returns:
get record position

setCheckRecordFormat

public void setCheckRecordFormat(boolean checkRecordFormat)
Description copied from interface: Present
Throw exception is record schema not preferred schema

Specified by:
setCheckRecordFormat in interface Present
Parameters:
checkRecordFormat - setting of record schema checking

isCheckRecordFormat

public boolean isCheckRecordFormat()
Description copied from interface: Present
Get record schema checking setting

Specified by:
isCheckRecordFormat in interface Present
Returns:
record checking setting

setElementSpec

public void setElementSpec(java.lang.String elementSpec)
Description copied from interface: Present
Set element specification for record retrieval

Specified by:
setElementSpec in interface Present
Parameters:
elementSpec - element specification

getElementSpec

public java.lang.String getElementSpec()
Description copied from interface: Present
Get current element specification setting

Specified by:
getElementSpec in interface Present
Returns:
element specification

setRecordSchema

public void setRecordSchema(java.lang.String schema)
Description copied from interface: Present
Set current prefered record schema

Specified by:
setRecordSchema in interface Present
Parameters:
schema - record schema

getRecordSchema

public java.lang.String getRecordSchema()
Description copied from interface: Present
Get currently set record schema

Specified by:
getRecordSchema in interface Present
Returns:
record schema

getCurrentDatabase

public java.lang.String getCurrentDatabase()
                                    throws JaferException
Description copied from interface: Present
Get database of current record

Specified by:
getCurrentDatabase in interface Present
Returns:
database
Throws:
JaferException

setResultSetName

public void setResultSetName(java.lang.String resultSetName)
Specified by:
setResultSetName in interface Search

getResultSetName

public java.lang.String getResultSetName()
Specified by:
getResultSetName in interface Search

setDatabases

public void setDatabases(java.lang.String database)
Description copied from interface: Search
Set database to search

Specified by:
setDatabases in interface Search
Parameters:
database - database

setDatabases

public void setDatabases(java.lang.String[] databases)
Description copied from interface: Search
Set databases to search

Specified by:
setDatabases in interface Search
Parameters:
databases - databases

getDatabases

public java.lang.String[] getDatabases()
Description copied from interface: Search
Get databases currently searched

Specified by:
getDatabases in interface Search
Returns:
databases

setParseQuery

public void setParseQuery(boolean parseQuery)
Specified by:
setParseQuery in interface Search

isParseQuery

public boolean isParseQuery()
Specified by:
isParseQuery in interface Search

saveQuery

public void saveQuery(java.lang.String file)
               throws JaferException
Specified by:
saveQuery in interface Search
Throws:
JaferException

getNumberOfResults

public int getNumberOfResults()
Description copied from interface: Search
Get number of results for last query

Specified by:
getNumberOfResults in interface Search
Returns:
number of results

getNumberOfResults

public int getNumberOfResults(java.lang.String databaseName)
Description copied from interface: Search
Get number of results from the named database for last query

Specified by:
getNumberOfResults in interface Search
Returns:
number of results

getQuery

public java.lang.Object getQuery()
Description copied from interface: Search
Get the last submitted query

Specified by:
getQuery in interface Search
Returns:
query

getSearchException

public JaferException getSearchException(java.lang.String database)
                                  throws JaferException
Description copied from interface: Search
If a search fails this method will return the JaferException for the specified database

Specified by:
getSearchException in interface Search
Parameters:
database - The name of the database to check
Returns:
null if no errors were found
Throws:
JaferException

getSearchException

public JaferException[] getSearchException(java.lang.String[] databases)
                                    throws JaferException
Description copied from interface: Search
If a search fails this method will return the JaferException for the specified databases

Specified by:
getSearchException in interface Search
Parameters:
databases - The databases to search
Returns:
An empty array if no errors were found
Throws:
JaferException