jremote jbase5.2.1

com.jbase.jremote.io
Class JFileImpl

java.lang.Object
  extended by com.jbase.jremote.io.JFileImpl
All Implemented Interfaces:
JFile

public class JFileImpl
extends Object
implements JFile

The JFile object is used to query, read, and write to jBASE files.

Author:
aphethean
See Also:
open(String fileName)

Constructor Summary
protected JFileImpl()
          This constructor can be used by ObjectReader to create a new object to be populated with deserialized data.
protected JFileImpl(AbstractJRemoteConnection connection, String fileName)
           
protected JFileImpl(String fileName)
           
 
Method Summary
 boolean clear()
          Delete all records from the file.
 boolean close()
          Closes this jBASE file.
 boolean delete(String recordKey)
          Delete a record where the supplied recordKey is the key to the record.
 boolean exists(String recordKey)
          This method returns true if the supplied record id exists.
 JCursor getCursor()
          Returns a cursor to this jBASE file.
 boolean hasLock(String recordKey)
          Check if the specified key holds a lock.
 JDynArray read(String recordKey)
          Read a record where the supplied recordKey is the key to the record.
 JDynArray readU(String recordKey, boolean blockedRead)
          Read a record where the supplied recordKey is the key to the record and locks it for update.
 boolean releaseLock(String recordKey)
          Release the update lock (if held) on the specified key.
 boolean releaseLocks()
          Releases all locks held by this file.
 JSelectList select()
          Returns a select list containing the record keys in this jBASE file.
 boolean write(String recordKey, JDynArray record)
           Write the supplied record to the jBASE file.
 boolean writeU(String recordKey, JDynArray record, boolean blockedWrite)
           Write the supplied record to the jBASE file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JFileImpl

protected JFileImpl(AbstractJRemoteConnection connection,
                    String fileName)

JFileImpl

protected JFileImpl(String fileName)

JFileImpl

protected JFileImpl()
This constructor can be used by ObjectReader to create a new object to be populated with deserialized data.

Method Detail

exists

public boolean exists(String recordKey)
               throws JRemoteException
Description copied from interface: JFile

This method returns true if the supplied record id exists.

Specified by:
exists in interface JFile
Returns:
record exists
Throws:
JRemoteException
See Also:
JFile.exists(java.lang.String)

read

public JDynArray read(String recordKey)
               throws JRecordNotFoundException,
                      JRemoteException
Description copied from interface: JFile

Read a record where the supplied recordKey is the key to the record.

Specified by:
read in interface JFile
Returns:
the record that was read
Throws:
JRecordNotFoundException
JRemoteException
See Also:
JFile.read(java.lang.String)

readU

public JDynArray readU(String recordKey,
                       boolean blockedRead)
                throws JRecordNotFoundException,
                       JRecordLockedException,
                       JRemoteException
Description copied from interface: JFile

Read a record where the supplied recordKey is the key to the record and locks it for update.

Specified by:
readU in interface JFile
Parameters:
recordKey - The record key
blockedRead - Specifies whether this method call should block if the record is locked
Returns:
the record that was read and locked
Throws:
JRecordNotFoundException
JRemoteException
JRecordLockedException
See Also:
JFile.readU(java.lang.String, boolean)

write

public boolean write(String recordKey,
                     JDynArray record)
              throws JRemoteException
Description copied from interface: JFile

Write the supplied record to the jBASE file. If an update lock was held against the supplied key, it will be released after the record has been written.

Specified by:
write in interface JFile
Returns:
Returns true if the record did not exist prior to this write or false if the record was updated.
Throws:
JRemoteException
See Also:
JFile.write(java.lang.String, com.jbase.jremote.JDynArray)

writeU

public boolean writeU(String recordKey,
                      JDynArray record,
                      boolean blockedWrite)
               throws JRecordLockedException,
                      JRemoteException
Description copied from interface: JFile

Write the supplied record to the jBASE file. If an update lock was held against the supplied key, it will NOT be released.

Specified by:
writeU in interface JFile
blockedWrite - Specifies whether this method call should block if the record is already locked
Returns:
Returns true if the record did not exist prior to this write or false if the record was updated.
Throws:
JRemoteException
JRecordLockedException
See Also:
JFile.writeU(java.lang.String, com.jbase.jremote.JDynArray, boolean)

releaseLock

public boolean releaseLock(String recordKey)
                    throws JRemoteException
Description copied from interface: JFile

Release the update lock (if held) on the specified key.

Specified by:
releaseLock in interface JFile
Returns:
Returns true if lock has been released successfully
Throws:
JRemoteException
See Also:
JFile.releaseLock(java.lang.String)

releaseLocks

public boolean releaseLocks()
                     throws JRemoteException
Description copied from interface: JFile

Releases all locks held by this file.

Specified by:
releaseLocks in interface JFile
Returns:
Returns true if locks have been released successfully
Throws:
JRemoteException
See Also:
JFile.releaseLocks()

hasLock

public boolean hasLock(String recordKey)
                throws JRemoteException
Description copied from interface: JFile

Check if the specified key holds a lock.

Specified by:
hasLock in interface JFile
Returns:
Returns true if the record is locked
Throws:
JRemoteException
See Also:
JFile.hasLock(java.lang.String)

delete

public boolean delete(String recordKey)
               throws JRemoteException
Description copied from interface: JFile

Delete a record where the supplied recordKey is the key to the record.

Returns true if the delete was successful or false if the record was not found.
An exception will be thrown if an error occurs whilst deleting the record.

Specified by:
delete in interface JFile
Returns:
delete successful
Throws:
JRemoteException
See Also:
JFile.delete(java.lang.String)

close

public boolean close()
              throws JRemoteException
Description copied from interface: JFile

Closes this jBASE file.

Closing a JFile frees the associate remote system resources. Subsequent actions on this JFile object will reopen the file.

Specified by:
close in interface JFile
Returns:
close successful
Throws:
JRemoteException
See Also:
JFile.close()

select

public JSelectList select()
                   throws JRemoteException
Description copied from interface: JFile

Returns a select list containing the record keys in this jBASE file.

Specified by:
select in interface JFile
Returns:
JSelectList all record keys
Throws:
JRemoteException
See Also:
JFile.select()

getCursor

public JCursor getCursor()
                  throws JRemoteException
Description copied from interface: JFile

Returns a cursor to this jBASE file.

Specified by:
getCursor in interface JFile
Returns:
JCursor cursor
Throws:
JRemoteException
See Also:
JFile.getCursor()

clear

public boolean clear()
              throws JRemoteException
Description copied from interface: JFile

Delete all records from the file.

Returns true if the operation was successful or false if the records could not be deleted.

Specified by:
clear in interface JFile
Returns:
clear successful
Throws:
JRemoteException
See Also:
JFile.clear()

jremote jbase5.2.1

Copyright © 2016 TEMENOS. All Rights Reserved.