com.ibm.as400.micro
Class JdbcMeOfflineData

java.lang.Object
  |
  +--com.ibm.as400.micro.JdbcMeOfflineData

public abstract class JdbcMeOfflineData
extends java.lang.Object

An offline data repository that represents a a data store that is generic, regardless of J2ME profile and JVM details.

Note that the index of the first record in a JdbcMeOfflineData object is 0, not 1 as in the MIDP implementation of RecordStore.

For example.

  MIDP - The 'name' is a unique string of up to 32
         unique characters identifying a
         javax.microedition.rms.RecordStore object
         the offline data object returned, then
         encapsulates the RecordStore object.
 
  PALM - The 'name' is effectively just a visual
         key, while the offline data is uniquely
         identified by the 'dbCreator' and the
         'dbType' parameters.
  


Constructor Summary
JdbcMeOfflineData()
           
 
Method Summary
abstract  void addRecord(byte[] rec, int offset, int length)
          Add a record to the offline data store from the specified bytes of the byte array.
abstract  void close()
          Close the offline data store, releasing resources required by the platform specific data store.
static JdbcMeOfflineData create(java.lang.String name, int dbCreator, int dbType)
          Create an offline data repository, destroying the current one if it exists.
abstract  void deleteRecord(int index)
          Delete the record specified from the offline data store.
abstract  byte[] getRecord(int index)
          Get a record from the offline data store.
static JdbcMeOfflineData open(java.lang.String name, int dbCreator, int dbType, boolean createIfNecessary)
          Open or create an offline data repository Various parameters in this method are used or ignored depending on which J2ME profile is currently being used by this implementation.
abstract  void setRecord(int index, byte[] rec, int offset, int length)
          Set the record content to the specified bytes from the byte array.
abstract  int size()
          Get the current number of records in the offline data store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcMeOfflineData

public JdbcMeOfflineData()
Method Detail

create

public static JdbcMeOfflineData create(java.lang.String name,
                                       int dbCreator,
                                       int dbType)
                                throws JdbcMeException
Create an offline data repository, destroying the current one if it exists.
Parameters:
dbName - The name of the offline database.
dbCreator - The unique offline database creator identifier.
dbType - The unique offline database type identifier.
Returns:
The specific JdbcMeOffline implementation.
Throws:
JdbcMeException - If an error occurs.

open

public static JdbcMeOfflineData open(java.lang.String name,
                                     int dbCreator,
                                     int dbType,
                                     boolean createIfNecessary)
                              throws JdbcMeException
Open or create an offline data repository Various parameters in this method are used or ignored depending on which J2ME profile is currently being used by this implementation.
Parameters:
dbName - The name of the offline database.
dbCreator - The unique offline database creator identifier.
dbType - The unique offline database type identifier.
createIfNecessary - Create the database if one has not already been created.
Returns:
The specific JdbcMeOfflineData implementation.
Throws:
JdbcMeException - If an error occurs.

getRecord

public abstract byte[] getRecord(int index)
                          throws JdbcMeException
Get a record from the offline data store.
Parameters:
index - The record to return. The first record is record 0. The last record is this.size()-1;
Returns:
The record.
Throws:
JdbcMeException - If an error occurs.

size

public abstract int size()
                  throws JdbcMeException
Get the current number of records in the offline data store.
Returns:
The number of records.
Throws:
JdbcMeException - If an error occurs.

addRecord

public abstract void addRecord(byte[] rec,
                               int offset,
                               int length)
                        throws JdbcMeException
Add a record to the offline data store from the specified bytes of the byte array. The record is added at the end of the data store.
Parameters:
rec - The byte data.
offset - The offset into the data.
length - The length of the data.
Throws:
JdbcMeException - If an error occurs.

setRecord

public abstract void setRecord(int index,
                               byte[] rec,
                               int offset,
                               int length)
                        throws JdbcMeException
Set the record content to the specified bytes from the byte array.
Parameters:
index - The record to set. The first record is record 0. The last record is this.size()-1;
rec - The byte data.
offset - The offset into the data.
length - The length of the data.
Throws:
JdbcMeException - If an error occurs.

deleteRecord

public abstract void deleteRecord(int index)
                           throws JdbcMeException
Delete the record specified from the offline data store.
Parameters:
index - The record to delete. The first record is record 0. The last record is this.size()-1;
Throws:
JdbcMeException - If an error occurs.

close

public abstract void close()
Close the offline data store, releasing resources required by the platform specific data store.