org.dbforms.event.datalist.dao
Class DataSourceXML

java.lang.Object
  extended by org.dbforms.event.datalist.dao.AbstractDataSource
      extended by org.dbforms.event.datalist.dao.DataSourceXML

public class DataSourceXML
extends AbstractDataSource

Special implementation of DataSource. This class deals with xml data

Author:
hkk

Constructor Summary
DataSourceXML()
           
 
Method Summary
protected  void close()
          should close all open datasets
 void doUpdate(Connection con, FieldValues fieldValues, String keyValuesStr)
          performs an update into the DataSource
protected  int findStartRow(String startRow)
          maps the startRow to the internal index
protected  Object[] getRow(int currRow)
          should retrieve the row at an special index as an Object[]
protected  boolean hasMore(int i)
          return true if there are more records to fetch then the given record number
protected  void open()
          Will be called to open all datasets
protected  Document read(String url)
          gets the document from the remote system.
 void setSelect(FieldValue[] filterConstraint, FieldValue[] orderConstraint, String sqlFilter, FieldValue[] sqlFilterParams)
          Set the filterConstraint and orderConstraint used to build the SQL Select condition.
protected  int size()
          Must return the size of the whole resultset with all data fetch
protected  void write(String url, Element root)
          saves the document to the remote system.
 
Methods inherited from class org.dbforms.event.datalist.dao.AbstractDataSource
deleteBlobFilesFromDisk, doDelete, doInsert, doUpdate, getCurrent, getFirst, getLast, getNext, getPrev, getResultSetVector, getTable, saveBlobFilesToDisk, setConnection, setSelect, setTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSourceXML

public DataSourceXML()
Method Detail

setSelect

public void setSelect(FieldValue[] filterConstraint,
                      FieldValue[] orderConstraint,
                      String sqlFilter,
                      FieldValue[] sqlFilterParams)
Set the filterConstraint and orderConstraint used to build the SQL Select condition.

Specified by:
setSelect in class AbstractDataSource
Parameters:
filterConstraint - FieldValue array used to build a cumulation of rules for filtering fields.
orderConstraint - FieldValue array used to build a cumulation of rules for ordering (sorting) and restricting fields.
sqlFilter - sql condition to add to where clause
sqlFilterParams - list of FieldValues to fill the sqlFilter with

doUpdate

public void doUpdate(Connection con,
                     FieldValues fieldValues,
                     String keyValuesStr)
              throws SQLException
performs an update into the DataSource

Parameters:
con - DOCUMENT ME!
fieldValues - FieldValues to update
keyValuesStr - keyValueStr to the row to update
key format: FieldID ":" Length ":" Value
example: if key id = 121 and field id=2 then keyValueStr contains "2:3:121"
If the key consists of more than one fields, the key values are seperated through "-"
example: value of field 1=12, value of field 3=1992, then we'll get "1:2:12-3:4:1992"
Throws:
SQLException - if any error occurs

getRow

protected final Object[] getRow(int currRow)
                         throws SQLException
should retrieve the row at an special index as an Object[]

Specified by:
getRow in class AbstractDataSource
Parameters:
currRow - index of row to fetch
Returns:
Object[] of the fetched row
Throws:
SQLException

close

protected final void close()
should close all open datasets

Specified by:
close in class AbstractDataSource

findStartRow

protected final int findStartRow(String startRow)
                          throws SQLException
maps the startRow to the internal index

Specified by:
findStartRow in class AbstractDataSource
Parameters:
startRow - keyValueStr to the row
key format: FieldID ":" Length ":" Value
example: if key id = 121 and field id=2 then keyValueStr contains "2:3:121"
If the key consists of more than one fields, the key values are seperated through "-"
example: value of field 1=12, value of field 3=1992, then we'll get "1:2:12-3:4:1992"
Returns:
the index of the row, 0 as first row if not found
Throws:
SQLException

open

protected final void open()
                   throws SQLException
Will be called to open all datasets

Specified by:
open in class AbstractDataSource
Throws:
SQLException

size

protected final int size()
                  throws SQLException
Must return the size of the whole resultset with all data fetch

Specified by:
size in class AbstractDataSource
Returns:
size of whole resultset
Throws:
SQLException

hasMore

protected boolean hasMore(int i)
                   throws SQLException
return true if there are more records to fetch then the given record number

Specified by:
hasMore in class AbstractDataSource
Parameters:
i - index of last fetched row.
Returns:
true if there are more records to fetch then the given record number
Throws:
SQLException

read

protected Document read(String url)
                 throws Exception
gets the document from the remote system.

Parameters:
url - the uri to query
Returns:
NODE the result
Throws:
Exception - Exception during processing IO

write

protected void write(String url,
                     Element root)
              throws Exception
saves the document to the remote system.

Parameters:
url - DOCUMENT ME!
root - DOCUMENT ME!
Throws:
Exception - Exception during processing IO


Copyright © 2002-2006 DbForms. All Rights Reserved.