dk.vajhoej.isam.emulated
Class EmulatedIsamSource

java.lang.Object
  extended by dk.vajhoej.isam.emulated.EmulatedIsamSource
All Implemented Interfaces:
IsamSource

public class EmulatedIsamSource
extends java.lang.Object
implements IsamSource

Class EmulatedIsamSource is emulating an ISAM source by using a relational database.


Constructor Summary
EmulatedIsamSource(java.lang.String driver, java.lang.String conurl, java.lang.String un, java.lang.String pw)
          Create instance of EmulatedIsamSource.
 
Method Summary
 void close()
          Close ISAM source.
<T> void
create(T o)
          Create record in ISAM source.
<T,TK> void
delete(java.lang.Class<T> t, Key<TK> k)
          Delete record from ISAM source.
<T,TK> T
read(java.lang.Class<T> t, Key<TK> k)
          Read record from ISAM source.
<T,TK> IsamResult<T>
readGE(java.lang.Class<T> t, Key<TK> k)
          Find all records greater than or equal key.
<T,TK> IsamResult<T>
readGT(java.lang.Class<T> t, Key<TK> k)
          Read all records greater than key.
<T,TK> IsamResult<T>
readLE(java.lang.Class<T> t, Key<TK> k)
          Read all records less than or equal key.
<T,TK> IsamResult<T>
readLT(java.lang.Class<T> t, Key<TK> k)
          Read all records less than key.
<T> void
update(T o)
          Update record in ISAM source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmulatedIsamSource

public EmulatedIsamSource(java.lang.String driver,
                          java.lang.String conurl,
                          java.lang.String un,
                          java.lang.String pw)
                   throws IsamException
Create instance of EmulatedIsamSource.

Parameters:
driver - JDBC driver class
conurl - JDBC connection URL
un - username used to connect
pw - password used to connect
Throws:
IsamException - if problem with ISAM source
Method Detail

read

public <T,TK> T read(java.lang.Class<T> t,
                     Key<TK> k)
       throws IsamException,
              RecordException
Description copied from interface: IsamSource
Read record from ISAM source.

Specified by:
read in interface IsamSource
Parameters:
t - type to read
k - key of record to read
Returns:
object read
Throws:
IsamException - if problem with ISAM source
RecordException - if problem converting data

create

public <T> void create(T o)
            throws IsamException,
                   RecordException
Description copied from interface: IsamSource
Create record in ISAM source.

Specified by:
create in interface IsamSource
Parameters:
o - object to create
Throws:
IsamException - if problem with ISAM source
RecordException - if problem converting data

update

public <T> void update(T o)
            throws IsamException,
                   RecordException
Description copied from interface: IsamSource
Update record in ISAM source.

Specified by:
update in interface IsamSource
Parameters:
o - object to update
Throws:
IsamException - if problem with ISAM source
RecordException - if problem converting data

delete

public <T,TK> void delete(java.lang.Class<T> t,
                          Key<TK> k)
            throws IsamException,
                   RecordException
Description copied from interface: IsamSource
Delete record from ISAM source.

Specified by:
delete in interface IsamSource
Parameters:
t - type to delete
k - key of record to delete
Throws:
IsamException - if problem with ISAM source
RecordException - if problem converting data

close

public void close()
           throws IsamException
Description copied from interface: IsamSource
Close ISAM source.

Specified by:
close in interface IsamSource
Throws:
IsamException - if problem with ISAM source

readGE

public <T,TK> IsamResult<T> readGE(java.lang.Class<T> t,
                                   Key<TK> k)
                     throws IsamException
Description copied from interface: IsamSource
Find all records greater than or equal key.

Specified by:
readGE in interface IsamSource
Parameters:
t - type to find
k - key to find
Returns:
result
Throws:
IsamException - if problem with ISAM source

readGT

public <T,TK> IsamResult<T> readGT(java.lang.Class<T> t,
                                   Key<TK> k)
                     throws IsamException
Description copied from interface: IsamSource
Read all records greater than key.

Specified by:
readGT in interface IsamSource
Parameters:
t - type to find
k - key to find
Returns:
result
Throws:
IsamException - if problem with ISAM source

readLE

public <T,TK> IsamResult<T> readLE(java.lang.Class<T> t,
                                   Key<TK> k)
                     throws IsamException
Description copied from interface: IsamSource
Read all records less than or equal key. Note that the performance of reading reverse may be very poor in some implementations.

Specified by:
readLE in interface IsamSource
Parameters:
t - type to find
k - key to find
Returns:
result
Throws:
IsamException - if problem with ISAM source

readLT

public <T,TK> IsamResult<T> readLT(java.lang.Class<T> t,
                                   Key<TK> k)
                     throws IsamException
Description copied from interface: IsamSource
Read all records less than key. Note that the performance of reading reverse may be very poor in some implementations.

Specified by:
readLT in interface IsamSource
Parameters:
t - type to find
k - key to find
Returns:
result
Throws:
IsamException - if problem with ISAM source