Package com.basis.plugin
Class FSQLPlugin
java.lang.Object
com.basis.plugin.FSQLPlugin
- All Implemented Interfaces:
com.basis.startup.type.plugin.BBjFilePlugin
This is the interface used to read, write, and get information about open
SQL plugins. Instances are created by the
open method of
the SQLOpenPlugin interface. Methods that a particular plugin
does not want to implement can just throw a BBjException,
usually of type BBjException.CANT.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFSQLPlugin(String p_url, String p_table, String p_file) Constructor called bySQLOpenPlugin. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the file position.intextract(byte[] p_buffer, int p_size, byte[] p_key, int p_keylen, int p_keyNumber, int p_timeout) Extract from the key given.intextract(byte[] p_buffer, int p_size, int p_timeout) Extract from the current position.intextract(byte[] p_buffer, int p_size, int p_keyNumber, int p_timeout) Extract from the current position.intextract(byte[] p_buffer, int p_size, long p_index, int p_timeout) Extract from the index given.byte[]getFIN(int p_index) Base FIN function used by the interpreter to get the FIN byte array.getFINTemplate(int p_index) Get template string for base FIN function.intgetFirstKey(byte[] p_buffer, int p_keylen) Get first key in current key number.longgetIndex()Get current index -- this is not guaranteed to be useful for all file types.intgetKey(byte[] p_buffer, int p_keylen) Get key at the current position.intgetKey(byte[] p_buffer, int p_keylen, int p_keyNumber) Get key at the current position.intGet logical key size (if applicable).intgetLastKey(byte[] p_buffer, int p_keylen) Get last key in current key number.longGet length of the file -- not valid for all file types.intMaximum number of bytes that a user is able to read from the file in a single read.intgetNextKey(byte[] p_buffer, int p_keylen) Get next key at the current position.longGet maximum number of records (if applicable).intgetPreviousKey(byte[] p_buffer, int p_keylen) Get previous key at the current position.longGet the number of records actually in the file.intGet record size (if applicable).byte[]getXFIN(int p_index) Base XFIN function used by the interpreter to get the XFIN byte array.getXFINTemplate(int p_index) Get template string for base XFIN function.booleanIs the plugin file record oriented (i.e.voidlock()Lock the file.intread(byte[] p_buffer, int p_size, byte[] p_key, int p_keylen, int p_keyNumber, boolean p_find, long p_move, int p_timeout) Read from the key given and change the position either forwards or backwards.intread(byte[] p_buffer, int p_size, int p_keyNumber, long p_move, int p_timeout) Read from the current position and change the position either forwards or backwards.intread(byte[] p_buffer, int p_size, long p_move, int p_timeout) Read from the current position and change the position either forwards or backwards.intread(byte[] p_buffer, int p_size, long p_index, long p_move, int p_timeout) Read from the index given and change the position either forwards or backwards.voidremove(byte[] p_key, int p_keylen, boolean p_dom) Remove the record indicated by a key.voidremove(long p_index) Remove the record indicated by an index.voidunlock()Unlock the file.voidwrite(byte[] p_buffer, int p_size, byte[] p_key, int p_keylen, long p_move, boolean p_dom, int p_timeout) Write a record at the position given by a key.voidwrite(byte[] p_buffer, int p_size, long p_move, boolean p_dom, int p_timeout) Write a record at the current position except for multi keyed MKEYED files where the key will be derived from the record.voidwrite(byte[] p_buffer, int p_size, long p_index, long p_move, boolean p_dom, int p_timeout) Write a record at the position given by an index.
-
Constructor Details
-
FSQLPlugin
protected FSQLPlugin(String p_url, String p_table, String p_file) throws com.basis.startup.type.BBjException Constructor called bySQLOpenPlugin.- Parameters:
p_url- JDBC url to use in connection to the database.p_table- Table to interface with.p_file- File that corresponds to the table.- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
-
Method Details
-
isRecordOriented
public boolean isRecordOriented()Is the plugin file record oriented (i.e. records are read)?- Specified by:
isRecordOrientedin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- true if the file is read as records.
-
read
public int read(byte[] p_buffer, int p_size, long p_move, int p_timeout) throws com.basis.startup.type.BBjException Read from the current position and change the position either forwards or backwards.- Specified by:
readin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_move- Number of records (or bytes in STRING file) to move the position after the read. If this is negative the position will be moved backwards.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException
-
read
public int read(byte[] p_buffer, int p_size, int p_keyNumber, long p_move, int p_timeout) throws com.basis.startup.type.BBjException Read from the current position and change the position either forwards or backwards. If the key number given is not the current key number then the current position will be the first key of the specified key number.- Specified by:
readin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_keyNumber- Key number to use for iteration. If the key number is different than the one currently being used the iteration will start at the beginning of the key specified.p_move- Number of records (or bytes in STRING file) to move the position after the read. If this is negative the position will be moved backwards.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException
-
read
public int read(byte[] p_buffer, int p_size, byte[] p_key, int p_keylen, int p_keyNumber, boolean p_find, long p_move, int p_timeout) throws com.basis.startup.type.BBjException Read from the key given and change the position either forwards or backwards. File types without keys will give an error.- Specified by:
readin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_key- Key value to search for on the read.p_keylen- Length of the actual key in the key byte array.p_keyNumber- Number of the key chain to search.p_find- true if the position should not be changed if the key is not found.p_move- Number of records (or bytes in STRING file) to move the position after the read. If this is negative the position will be moved backwards.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException
-
read
public int read(byte[] p_buffer, int p_size, long p_index, long p_move, int p_timeout) throws com.basis.startup.type.BBjException Read from the index given and change the position either forwards or backwards. File types without indexes will give an error.- Specified by:
readin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_index- Index to jump to for the read.p_move- Number of records (or bytes in STRING file) to move the position after the read. If this is negative the position will be moved backwards.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
extract
public int extract(byte[] p_buffer, int p_size, int p_timeout) throws com.basis.startup.type.BBjException Extract from the current position.- Specified by:
extractin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
extract
public int extract(byte[] p_buffer, int p_size, int p_keyNumber, int p_timeout) throws com.basis.startup.type.BBjException Extract from the current position. If the key number given is not the current key number then the current position will be the first key of the specified key number.- Specified by:
extractin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_keyNumber- Key number to use for iteration. If the key number is different than the one currently being used the iteration will start at the beginning of the key specified.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
extract
public int extract(byte[] p_buffer, int p_size, byte[] p_key, int p_keylen, int p_keyNumber, int p_timeout) throws com.basis.startup.type.BBjException Extract from the key given. File types without keys will give an error.- Specified by:
extractin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_key- Key value to search for on the read.p_keylen- Length of the actual key in the key byte array.p_keyNumber- Number of the key chain to search.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
extract
public int extract(byte[] p_buffer, int p_size, long p_index, int p_timeout) throws com.basis.startup.type.BBjException Extract from the index given. File types without indexes will give an error.- Specified by:
extractin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer to fill with the bytes read.p_size- Maximum number of bytes to read into the buffer.p_index- Index to jump to for the read.p_timeout- Timeout value in seconds for the read operation.- Returns:
- Number of bytes actually read.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
write
public void write(byte[] p_buffer, int p_size, long p_move, boolean p_dom, int p_timeout) throws com.basis.startup.type.BBjException Write a record at the current position except for multi keyed MKEYED files where the key will be derived from the record.- Specified by:
writein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Record bytes.p_size- Number of bytes to write from the buffer.p_move- Number of records (or bytes in STRING file) to move the position after the write. If this is negative the position will be moved backwards. The move is relative to the location of the record written.p_dom- true if an error should be given for a duplicate key.p_timeout- Timeout value in seconds for the write operation.- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
write
public void write(byte[] p_buffer, int p_size, byte[] p_key, int p_keylen, long p_move, boolean p_dom, int p_timeout) throws com.basis.startup.type.BBjException Write a record at the position given by a key. File types without keys and multi-keyed MKEYED and XKEYED files will give an error.- Specified by:
writein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Record bytes.p_size- Number of bytes to write from the buffer.p_key- Key to use in writing the record.p_keylen- Length of the actual key in the key byte array.p_move- Number of records (or bytes in STRING file) to move the position after the write. If this is negative the position will be moved backwards. The move is relative to the location of the record written.p_dom- true if an error should be given for a duplicate key.p_timeout- Timeout value in seconds for the write operation.- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
write
public void write(byte[] p_buffer, int p_size, long p_index, long p_move, boolean p_dom, int p_timeout) throws com.basis.startup.type.BBjException Write a record at the position given by an index. File types without indexes will give an error.- Specified by:
writein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Record bytes.p_size- Number of bytes to write from the buffer.p_index- Index to use in writing the record.p_move- Number of records (or bytes in STRING file) to move the position after the write. If this is negative the position will be moved backwards. The move is relative to the location of the record written.p_dom- true if an error should be given for a duplicate key.p_timeout- Timeout value in seconds for the write operation.- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
remove
public void remove(byte[] p_key, int p_keylen, boolean p_dom) throws com.basis.startup.type.BBjException Remove the record indicated by a key. File types without keys will give an error.- Specified by:
removein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_key- Key of the record to remove.p_keylen- Length of the actual key in the key byte array.p_dom- true if an error should be given for a missing key.- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
lock
public void lock() throws com.basis.startup.type.BBjExceptionLock the file.- Specified by:
lockin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
unlock
public void unlock() throws com.basis.startup.type.BBjExceptionUnlock the file.- Specified by:
unlockin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
close
public void close() throws com.basis.startup.type.BBjExceptionClose the file position.- Specified by:
closein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getKey
public int getKey(byte[] p_buffer, int p_keylen) throws com.basis.startup.type.BBjException Get key at the current position.- Specified by:
getKeyin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer in which to place the key.p_keylen- Length of the key buffer provided.- Returns:
- Number of bytes in the key.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getKey
public int getKey(byte[] p_buffer, int p_keylen, int p_keyNumber) throws com.basis.startup.type.BBjException Get key at the current position.- Specified by:
getKeyin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer in which to place the key.p_keylen- Length of the key buffer provided.p_keyNumber- Which key number to get the key for.- Returns:
- Number of bytes in the key.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getFirstKey
public int getFirstKey(byte[] p_buffer, int p_keylen) throws com.basis.startup.type.BBjException Get first key in current key number.- Specified by:
getFirstKeyin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer in which to place the key.p_keylen- Length of key buffer provided.- Returns:
- Number of bytes in the key.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getLastKey
public int getLastKey(byte[] p_buffer, int p_keylen) throws com.basis.startup.type.BBjException Get last key in current key number.- Specified by:
getLastKeyin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer in which to place the key.p_keylen- Length of key buffer provided.- Returns:
- Number of bytes in the key.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getNextKey
public int getNextKey(byte[] p_buffer, int p_keylen) throws com.basis.startup.type.BBjException Get next key at the current position.- Specified by:
getNextKeyin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer in which to place the key.p_keylen- Length of key buffer provided.- Returns:
- Number of bytes in the key.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getPreviousKey
public int getPreviousKey(byte[] p_buffer, int p_keylen) throws com.basis.startup.type.BBjException Get previous key at the current position.- Specified by:
getPreviousKeyin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_buffer- Buffer in which to place the key.p_keylen- Length of key buffer provided.- Returns:
- Number of bytes in the key.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getKeySize
public int getKeySize() throws com.basis.startup.type.BBjExceptionGet logical key size (if applicable).- Specified by:
getKeySizein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- Logical key size for this file -- multi keyed MKEYED files return 0.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getNumberOfRecords
public long getNumberOfRecords() throws com.basis.startup.type.BBjExceptionGet maximum number of records (if applicable).- Specified by:
getNumberOfRecordsin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- Number of records or -1.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getRecordSize
public int getRecordSize() throws com.basis.startup.type.BBjExceptionGet record size (if applicable).- Specified by:
getRecordSizein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- Record size.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getFIN
public byte[] getFIN(int p_index) throws com.basis.startup.type.BBjException Base FIN function used by the interpreter to get the FIN byte array.- Specified by:
getFINin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_index- Index of FIN to retrieve.- Returns:
- FIN byte array as expected by BBx.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getFINTemplate
Get template string for base FIN function.- Specified by:
getFINTemplatein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_index- Index of FIN to get template for.- Returns:
- Template for FIN index requested.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getXFIN
public byte[] getXFIN(int p_index) throws com.basis.startup.type.BBjException Base XFIN function used by the interpreter to get the XFIN byte array.- Specified by:
getXFINin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_index- Index of FIN to retrieve.- Returns:
- XFIN byte array as expected by BBj.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getXFINTemplate
Get template string for base XFIN function.- Specified by:
getXFINTemplatein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_index- Index of XFIN to get template for.- Returns:
- Template for XFIN index requested.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getLength
public long getLength() throws com.basis.startup.type.BBjExceptionGet length of the file -- not valid for all file types.- Specified by:
getLengthin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- Length of the file.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getIndex
public long getIndex() throws com.basis.startup.type.BBjExceptionGet current index -- this is not guaranteed to be useful for all file types.- Specified by:
getIndexin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- Current index.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getMaxReadSize
public int getMaxReadSize() throws com.basis.startup.type.BBjExceptionMaximum number of bytes that a user is able to read from the file in a single read. For record files this is the record size (or maximum record size).- Specified by:
getMaxReadSizein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- Maximum number of bytes that can possibly be read at one time.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
getRecordCount
public long getRecordCount() throws com.basis.startup.type.BBjExceptionGet the number of records actually in the file.- Specified by:
getRecordCountin interfacecom.basis.startup.type.plugin.BBjFilePlugin- Returns:
- The number of records actually in the file if available.
- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-
remove
public void remove(long p_index) throws com.basis.startup.type.BBjException Remove the record indicated by an index.- Specified by:
removein interfacecom.basis.startup.type.plugin.BBjFilePlugin- Parameters:
p_index- Index of the record to remove.- Throws:
com.basis.startup.type.BBjException- If a problem occurs.
-