All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class asjava.uniobjects.UniFile

java.lang.Object
   |
   +----asjava.uniobjects.UniBase
           |
           +----asjava.uniobjects.UniFile

public class UniFile
extends UniBase
UniFile is used to access to all file operations

Version:
Version 1.0
Author:
David T. Meeks

Variable Index

 o uniFileHandle

Constructor Index

 o UniFile()
Default constructor for this class.
 o UniFile(UniSession, Object, int)

Method Index

 o clearFile()
clears a file, deleting all records contained within it.
 o close()
closes the file.
 o deleteRecord()
deletes the record identified by setRecordID.
 o deleteRecord(Object)
deletes the record identified by aRecordIDObj.
 o deleteRecord(UniDataSet)
deletes the records identified by aDataSet UniDataSet object
 o fileAction(int, UniDataSet, Object, int)
 o getAkInfo(Object)
obtains information concerning the secondary key indexes available for this object.
 o getBlockingStrategy()
returns the current blocking strategy.
 o getFileName()
returns the name of the file this object represents
 o getFileType()
returns the type of file this is.
 o getLockStrategy()
returns the current locking strategy.
 o getRecord()
returns the contents of the record that was last read.
 o getRecordID()
returns the ID of the record that was last read.
 o getReleaseStrategy()
returns the current release strategy.
 o isOpen()
Denotes whether the file is open.
 o isRecordLocked()
determines whether or not a user or session currently holds a lock on a given record ID.
 o isRecordLocked(Object)
determines whether or not a user or session currently holds a lock on a given record ID.
 o iType(Object, Object)
Evalutes the specified I-descriptor and returns the evaluated string.
 o lockFile()
locks this UniVerse file.
 o lockRecord(int)
locks the recordID established with the setRecordIDmethod.
 o lockRecord(Object, int)
locks the recordID established with the aRecordIDObj argument..
 o lockRecord(UniDataSet, int)
locks the recordIDs established with the UniDataSet object argument..
 o open()
Opens the named file.
 o read()
reads the UniVerse record from this file.
 o read(Object)
reads the UniVerse record from this file.
 o read(Object, int)
reads the UniVerse record from this file.
 o read(UniDataSet)
reads the set of UniVerse records passed in via the UniDataSet object.
 o readField(Object, int)
reads the specified field from the UniVerse record identified.
 o readField(Object, int, int)
reads the specified field from the UniVerse record identified.
 o readField(UniDataSet, int)
reads the set of UniVerse records passed in via the UniDataSet object.
 o readField(UniDataSet, Object)
reads the set of UniVerse records passed in via the UniDataSet object.
 o readNamedField(Object)
reads the field identifed by the named field in aFieldNameObj.
 o readNamedField(Object, Object)
reads the field identifed by the named field in aFieldNameObj.
 o readNamedField(UniDataSet, Object)
reads the set of UniVerse records passed in via the UniDataSet object.
 o setBlockingStrategy(int)
set the blocking strategy to the value indicated by the aBlock parameter.
 o setFileName(Object)
set the filename to be opened
 o setLockStrategy(int)
set the locking strategy to the value indicated by the aLock parameter.
 o setRecord(Object)
set the data portion of the record, primarily to be used for subsequent write methods.
 o setRecordID(Object)
set the record ID of the record to be read
 o setReleaseStrategy(int)
set the release strategy to the value indicated by the aRelease parameter.
 o unlockFile()
unlocks the file
 o unlockRecord()
unlocks the recordID established with the setRecordIDmethod.
 o unlockRecord(Object)
unlocks the recordID established with the aRecordIDObj parameter.
 o unlockRecord(UniDataSet)
unlocks the recordIDs established with the UniDataSet object argument..
 o write()
used to write the data specified with the setRecord and setRecordID methods into the file.
 o write(Object, Object)
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file.
 o write(Object, Object, int)
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file.
 o write(UniDataSet)
used to write the data specified with the aDataSet parameters into the file.
 o writeField(int)
used to write the data specified with the setRecord and setRecordID methods into the file, but only the field specified.
 o writeField(Object, Object, int)
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file, but only the field specified.
 o writeField(Object, Object, int, int)
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file, but only the field specified.
 o writeField(UniDataSet, int)
used to write the data specified with the aDataSet parameters into the file.
 o writeField(UniDataSet, Object)
used to write the data specified with the aDataSet parameters into the file.
 o writeNamedField(Object, Object)
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file, but only the name field specified.
 o writeNamedField(Object, Object, Object)
used to write the data specified with the aRecordID and aRecordDataObj parameters into the file, but only the name field specified.
 o writeNamedField(UniDataSet, Object)
used to write the data specified with the aDataSet parameters into the file.

Variables

 o uniFileHandle
 protected int uniFileHandle

Constructors

 o UniFile
 public UniFile() throws UniFileException
Default constructor for this class.

Throws: UniFileException
is thrown if an error occurs
 o UniFile
 public UniFile(UniSession aSession,
                Object aFileName,
                int aDictFlag) throws UniFileException

Methods

 o clearFile
 public void clearFile() throws UniFileException
clears a file, deleting all records contained within it. If a file is locked by another user, the BlockingStrategy, which can be set with the setBlockingStrategy method, determines the behavior

Throws: UniFileException
is thrown is an error occurs
 o close
 public void close() throws UniFileException
closes the file. All file and record locks are released

Throws: UniFileException
is thrown is an error occurs
 o deleteRecord
 public void deleteRecord() throws UniFileException
deletes the record identified by setRecordID.

Throws: UniFileException
is thrown is an error occurs
 o deleteRecord
 public UniDataSet deleteRecord(UniDataSet aDataSet) throws UniFileException
deletes the records identified by aDataSet UniDataSet object

Parameters:
aDataSet - UniDataSet object which identifies which record IDs to be deleted.
Throws: UniFileException
is thrown is an error occurs
 o deleteRecord
 public void deleteRecord(Object aRecordIDObj) throws UniFileException
deletes the record identified by aRecordIDObj.

Parameters:
aRecordIDObj - identifies which record ID is to be deleted.
Throws: UniFileException
is thrown is an error occurs
 o getAkInfo
 public UniDynArray getAkInfo(Object akNameObj) throws UniFileException
obtains information concerning the secondary key indexes available for this object. The return value will vary depending on the type of index, as follows: If akNameObj is passed in as an empty string, then the list of available indices is returned

Parameters:
akNameObj - name of the index to query about
Returns:
the information concerning the given index, or a list of all the indexes available
Throws: UniFileException
is thrown if an error occurs
 o getBlockingStrategy
 public int getBlockingStrategy()
returns the current blocking strategy. The initial value is inherited from the UniSession.setDefaultBlockingStrategy method. Valid values are:

Returns:
integer representing the current blocking strategy for this object
See Also:
setBlockingStrategy
 o getFileName
 public String getFileName()
returns the name of the file this object represents

Returns:
String representing the UniVerse file that was opened
See Also:
setFileName
 o getFileType
 public int getFileType()
returns the type of file this is. The file is either a static hashed (2-18), directory (1 or 19), b-tree (25), or dynamic (30).

Returns:
integer representing the type of UniVerse file that was opened.
 o getLockStrategy
 public int getLockStrategy()
returns the current locking strategy. The initial value is inherited from the UniSession.setDefaultLockStrategy method. Valid values are:

Returns:
integer representing the current locking strategy for this object
See Also:
setLockStrategy
 o getRecord
 public UniString getRecord()
returns the contents of the record that was last read. It is updated every time a read, readField, or readNamedField is performed.

Returns:
UniString representing the data that was last read
See Also:
setRecord, read, readField, readNamedField
 o getRecordID
 public String getRecordID()
returns the ID of the record that was last read. It is updated every time a read, readField, or readNamedField is performed.

Returns:
String representing the ID of the data that was last read
See Also:
setRecordID, read, readField, readNamedField
 o getReleaseStrategy
 public int getReleaseStrategy()
returns the current release strategy. The initial value is inherited from the UniSession.setDefaultReleaseStrategy method. Valid values are:
 o isOpen
 public boolean isOpen()
Denotes whether the file is open. A true value indicates the file is still open for use, a false indicates the file is closed and unavailable until reopened.

Returns:
boolean representing whether the file is opened or closed
 o isRecordLocked
 public boolean isRecordLocked() throws UniFileException
determines whether or not a user or session currently holds a lock on a given record ID.

Returns:
boolean representing whether the record is locked.
Throws: UniFileException
is thrown if an error occurs
 o isRecordLocked
 public boolean isRecordLocked(Object aRecordIDObj) throws UniFileException
determines whether or not a user or session currently holds a lock on a given record ID.

Parameters:
aRecordIDObj - represents the record ID to be checked.
Returns:
boolean representing whether the record is locked.
Throws: UniFileException
is thrown if an error occurs
 o iType
 public UniString iType(Object aRecordIDObj,
                        Object aITypeIDObj) throws UniFileException
Evalutes the specified I-descriptor and returns the evaluated string. It applies no conversion to the data.

Parameters:
aRecordIDObj - record ID of the record supplied as data to the Itype facility
aITypeIDObj - record ID of the Idescriptor record to be evaluated
Returns:
UniString representing the evaluated string
Throws: UniFileException
is thrown if an error occurs
 o lockFile
 public void lockFile() throws UniFileException
locks this UniVerse file. If another user currently owns a lock, it will throw a UniFileException

Throws: UniFileException
is thrown if an error is detected
 o lockRecord
 public void lockRecord(int aLockFlag) throws UniFileException
locks the recordID established with the setRecordIDmethod. This method is used to override the current locking strategy

Parameters:
aLockFlag - Type of lock to set. Valid values are:
  • EXCLUSIVE_UPDATE (1) - Sets a READU lock
  • SHARED_READ (2) - Sets a READL lock
Throws: UniFileException
is thrown if an error is detected
 o lockRecord
 public void lockRecord(Object aRecordIDObj,
                        int aLockFlag) throws UniFileException
locks the recordID established with the aRecordIDObj argument.. This method is used to override the current locking strategy

Parameters:
aRecordIDObj - String denoting which record ID to lock
aLockFlag - Type of lock to set. Valid values are:
  • EXCLUSIVE_UPDATE (1) - Sets a READU lock
  • SHARED_READ (2) - Sets a READL lock
Throws: UniFileException
is thrown if an error is detected
 o lockRecord
 public UniDataSet lockRecord(UniDataSet aDataSet,
                              int aLockFlag) throws UniFileException
locks the recordIDs established with the UniDataSet object argument.. This method is used to override the current locking strategy

Parameters:
aDataSet - UniDataSet denoting which record IDs to lock
aLockFlag - Type of lock to set. Valid values are:
  • EXCLUSIVE_UPDATE (1) - Sets a READU lock
  • SHARED_READ (2) - Sets a READL lock
Returns:
UniDataSet object denoting which records were successfully locked
Throws: UniFileException
is thrown if an error is detected
 o open
 public void open() throws UniFileException
Opens the named file. If it cannot be opened, a UniFileException will be thrown

Throws: UniFileException
is thrown if an error occurs
 o read
 public UniString read() throws UniFileException
reads the UniVerse record from this file. It uses the record ID established via the setRecordID method.

Returns:
UniString representing the data read
Throws: UniFileException
will be thrown if an error occurs
See Also:
setRecordID
 o read
 public UniDataSet read(UniDataSet aRowSet) throws UniFileException
reads the set of UniVerse records passed in via the UniDataSet object. This UniDataSet object should contain the list of record IDs to be read from this file.

Parameters:
aRowSet - list of record IDs to be read from this file
Returns:
UniDataSet representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o read
 public UniString read(Object aRecordIDObj) throws UniFileException
reads the UniVerse record from this file. It uses the record ID established via the aRecordIDObj argument that is passed in.

Parameters:
aRecordIDObj - record ID to be read from the file
Returns:
UniString representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o read
 public UniString read(Object aRecordIDObj,
                       int aLockFlag) throws UniFileException
reads the UniVerse record from this file. It uses the record ID established via the aRecordIDObj argument that is passed in. It will also lock the record according to the aLockFlag argument that is passed in.

Parameters:
aRecordIDObj - record ID to be read from the file
aLockFlag - is the type of lock that is to be set. See setLockStrategy for details on valid values
Returns:
UniString representing the data read
Throws: UniFileException
will be thrown if an error occurs
See Also:
setLockStrategy
 o readField
 public UniString readField(Object aRecordIDObj,
                            int aFieldNumber) throws UniFileException
reads the specified field from the UniVerse record identified. It uses the record ID established via the aRecordIDObj argument that is passed in. It will return only the field number specified in aFieldNumber

Parameters:
aRecordIDObj - record ID to be read from the file
aFieldNumber - integer representing which field is to be read
Returns:
UniString representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o readField
 public UniString readField(Object aRecordIDObj,
                            int aFieldNumber,
                            int aLockFlag) throws UniFileException
reads the specified field from the UniVerse record identified. It uses the record ID established via the aRecordIDObj argument that is passed in. It will return only the field number specified in aFieldNumber. It will set a lock on the record based on the value of aLockFlag

Parameters:
aRecordIDObj - record ID to be read from the file
aFieldNumber - integer representing which field is to be read
aLockFlag - type of lock to be set on the record
Returns:
UniString representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o readField
 public UniDataSet readField(UniDataSet aRowSet,
                             int aFieldNumber) throws UniFileException
reads the set of UniVerse records passed in via the UniDataSet object. This UniDataSet object should contain the list of record IDs to be read from this file.

Parameters:
aRowSet - list of record IDs to be read from this file
Returns:
UniDataSet representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o readField
 public UniDataSet readField(UniDataSet aRowSet,
                             Object aFieldNumber) throws UniFileException
reads the set of UniVerse records passed in via the UniDataSet object. This UniDataSet object should contain the list of record IDs to be read from this file.

Parameters:
aRowSet - list of record IDs to be read from this file
Returns:
UniDataSet representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o readNamedField
 public UniString readNamedField(Object aFieldNameObj) throws UniFileException
reads the field identifed by the named field in aFieldNameObj. It does this by extracting the physical field number from the dictionary associated with this file, and then performs a readField on that field. It will use the record ID established via the setRecordID as the record to be read

Parameters:
aFieldNameObj - name of the field in the dictionary to use as the field number
Returns:
UniString representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o readNamedField
 public UniString readNamedField(Object aRecordIDObj,
                                 Object aFieldNameObj) throws UniFileException
reads the field identifed by the named field in aFieldNameObj. It does this by extracting the physical field number from the dictionary associated with this file, and then performs a readField on that field.

Parameters:
aRecordIDObj - record ID to be read
aFieldNameObj - name of the field in the dictionary to use as the field number
Returns:
UniString representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o readNamedField
 public UniDataSet readNamedField(UniDataSet aRowSet,
                                  Object aFieldNameObj) throws UniFileException
reads the set of UniVerse records passed in via the UniDataSet object. This UniDataSet object should contain the list of record IDs to be read from this file.

Parameters:
aRowSet - list of record IDs to be read from this file
aFieldNameObj - name of the field in the dictionary to use as the field number
Returns:
UniDataSet representing the data read
Throws: UniFileException
will be thrown if an error occurs
 o setBlockingStrategy
 public void setBlockingStrategy(int aBlock) throws UniFileException
set the blocking strategy to the value indicated by the aBlock parameter.

Parameters:
aBlock - integer representing the blocking strategy to be used
Throws: UniFileException
is thrown if an invalid blocking strategy is set
See Also:
getBlockingStrategy
 o setFileName
 public void setFileName(Object aFileNameObj)
set the filename to be opened

Parameters:
aFileNameObj - name of the UniVerse file to be opened
See Also:
getFileName
 o setLockStrategy
 public void setLockStrategy(int aLock) throws UniFileException
set the locking strategy to the value indicated by the aLock parameter.

Parameters:
aLock - integer representing the locking strategy to be used
Throws: UniFileException
is thrown if an invalid blocking strategy is set
See Also:
getLockStrategy
 o setRecord
 public void setRecord(Object aStringObj)
set the data portion of the record, primarily to be used for subsequent write methods.

Parameters:
aStringObj - data portion of the record
See Also:
getRecord, write
 o setRecordID
 public void setRecordID(Object aStringObj) throws UniFileException
set the record ID of the record to be read

Parameters:
aStringObj - String representing the record ID to be read from the file
Throws: UniFileException
is thrown if an error occurs
See Also:
getRecordID
 o setReleaseStrategy
 public void setReleaseStrategy(int aRelease)
set the release strategy to the value indicated by the aRelease parameter.

Parameters:
aRelease - integer representing the release strategy to be used
See Also:
getReleaseStrategy
 o unlockFile
 public void unlockFile() throws UniFileException
unlocks the file

Throws: UniFileException
is thrown if an error is detected
See Also:
lockFile
 o unlockRecord
 public void unlockRecord() throws UniFileException
unlocks the recordID established with the setRecordIDmethod.

Throws: UniFileException
is thrown if an error is detected
See Also:
setRecordID
 o unlockRecord
 public void unlockRecord(UniDataSet aDataSet) throws UniFileException
unlocks the recordIDs established with the UniDataSet object argument..

Parameters:
aDataSet - UniDataSet denoting which record IDs to lock
Throws: UniFileException
is thrown if an error is detected
 o unlockRecord
 public void unlockRecord(Object aRecordIDObj) throws UniFileException
unlocks the recordID established with the aRecordIDObj parameter.

Parameters:
aRecordIDObj - record id to be unlocked
Throws: UniFileException
is thrown if an error is detected
See Also:
setRecordID
 o write
 public void write() throws UniFileException
used to write the data specified with the setRecord and setRecordID methods into the file. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Throws: UniFileException
is thrown if an error occurs
See Also:
setRecord, setRecordID, status
 o write
 public void write(Object aRecordIDObj,
                   Object aRecordDataObj) throws UniFileException
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aRecordIDObj - record ID that is to be written
aRecordDataOBJ - record data that is to be written
Throws: UniFileException
is thrown if an error occurs
See Also:
setRecord, setRecordID, status
 o write
 public void write(Object aRecordIDObj,
                   Object aRecordDataObj,
                   int aLockFlag) throws UniFileException
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked. You can use this version to also specify the kind of locking to be used during the write operation

Parameters:
aRecordIDObj - record ID that is to be written
aRecordDataOBJ - record data that is to be written
aLockFlag - type of lock to be set
Throws: UniFileException
is thrown if an error occurs
See Also:
setRecord, setRecordID, status
 o write
 public UniDataSet write(UniDataSet aDataSet) throws UniFileException
used to write the data specified with the aDataSet parameters into the file. After completion, the returned UniDataSet object can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aDataSet - UniDataSet object representing the data that is to be written
Throws: UniFileException
is thrown if an error occurs
 o writeField
 public void writeField(int uniFieldNumber) throws UniFileException
used to write the data specified with the setRecord and setRecordID methods into the file, but only the field specified. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
uniFieldNumber - field to be written
Throws: UniFileException
is thrown if an error occurs
See Also:
setRecord, setRecordID, status
 o writeField
 public UniDataSet writeField(UniDataSet aDataSet,
                              int uniFieldNumber) throws UniFileException
used to write the data specified with the aDataSet parameters into the file. After completion, the returned UniDataSet object can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aDataSet - UniDataSet object representing the data that is to be written
uniFieldNumber - field to be written
Throws: UniFileException
is thrown if an error occurs
 o writeField
 public UniDataSet writeField(UniDataSet aDataSet,
                              Object uniFieldName) throws UniFileException
used to write the data specified with the aDataSet parameters into the file. After completion, the returned UniDataSet object can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aDataSet - UniDataSet object representing the data that is to be written
uniFieldNumber - field to be written
Throws: UniFileException
is thrown if an error occurs
 o writeField
 public void writeField(Object aRecordIDObj,
                        Object aRecordDataObj,
                        int aFieldNumber) throws UniFileException
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file, but only the field specified. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aRecordIDObj - record ID to be written
aRecordDataObj - data to be written
aFieldNumber - field within the record to be written
Throws: UniFileException
is thrown if an error occurs
See Also:
status
 o writeField
 public void writeField(Object aRecordIDObj,
                        Object aRecordDataObj,
                        int aFieldNumber,
                        int aLockFlag) throws UniFileException
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file, but only the field specified. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked. You can also specify the specific locking to be used via the aLockFlag parameter

Parameters:
aRecordIDObj - record ID to be written
aRecordDataObj - data to be written
aFieldNumber - field within the record to be written
aLockFlag - integer representing the type of lock to be set.
Throws: UniFileException
is thrown if an error occurs
See Also:
status
 o writeNamedField
 public void writeNamedField(Object aFieldName,
                             Object aString) throws UniFileException
used to write the data specified with the aRecordIDObj and aRecordDataObj parameters into the file, but only the name field specified. The Named Field is extracted from the files Dictionary. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aFieldName - name of the field that is to be written
aString - data to be written to that field
Throws: UniFileException
is thrown if an error occurs
See Also:
status
 o writeNamedField
 public void writeNamedField(Object aRecordID,
                             Object aFieldName,
                             Object aString) throws UniFileException
used to write the data specified with the aRecordID and aRecordDataObj parameters into the file, but only the name field specified. The Named Field is extracted from the files Dictionary. After completion, the status method can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aRecordID - record ID that is to be written
aFieldName - name of the field that is to be written
aString - data to be written to that field
Throws: UniFileException
is thrown if an error occurs
See Also:
status
 o writeNamedField
 public UniDataSet writeNamedField(UniDataSet aDataSet,
                                   Object aFieldName) throws UniFileException
used to write the data specified with the aDataSet parameters into the file. After completion, the returned UniDataSet object can be used to determine the results of the operation. A 0 indicates the record was locked, a -2 indicates it was not locked

Parameters:
aDataSet - UniDataSet object representing the data that is to be written
uniFieldNumber - field to be written
Throws: UniFileException
is thrown if an error occurs
 o fileAction
 protected UniDataSet fileAction(int actionRequested,
                                 UniDataSet dataSet,
                                 Object fieldList,
                                 int lockType) throws UniFileException

All Packages  Class Hierarchy  This Package  Previous  Next  Index