dk.vajhoej.isam.remote
Class RemoteIsamSource

java.lang.Object
  extended by dk.vajhoej.isam.remote.RemoteIsamSource
All Implemented Interfaces:
IsamSource

public class RemoteIsamSource
extends java.lang.Object
implements IsamSource

Class EmulatedIsamSource is a remote ISAM source.


Constructor Summary
RemoteIsamSource(java.lang.String hostname, int port)
          Create instance of RemoteIsamSource.
 
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.
static void setVersion(int version)
          Set protocol version to use.
<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

RemoteIsamSource

public RemoteIsamSource(java.lang.String hostname,
                        int port)
                 throws IsamException
Create instance of RemoteIsamSource.

Parameters:
hostname - server hostname
port - server port number
Throws:
IsamException - if problem with ISAM source
Method Detail

setVersion

public static void setVersion(int version)
Set protocol version to use.

Parameters:
version - protocol version

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,
                            RecordException
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
RecordException - if problem converting data

readGT

public <T,TK> IsamResult<T> readGT(java.lang.Class<T> t,
                                   Key<TK> k)
                     throws IsamException,
                            RecordException
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
RecordException - if problem converting data

readLE

public <T,TK> IsamResult<T> readLE(java.lang.Class<T> t,
                                   Key<TK> k)
                     throws IsamException,
                            RecordException
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
RecordException - if problem converting data

readLT

public <T,TK> IsamResult<T> readLT(java.lang.Class<T> t,
                                   Key<TK> k)
                     throws IsamException,
                            RecordException
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
RecordException - if problem converting data