Package com.softwaremining.files
Class IndexedFileSingleProcess
java.lang.Object
com.softwaremining.wrappers.CBLBean
com.softwaremining.wrappers.AbstractBasePersistence
com.softwaremining.files.IndexedFileSingleProcess
- All Implemented Interfaces:
IPersistence
,AbstractDataObject
,ICBLBeanNGroup
,ICBLContainer
,IFieldContainer
,ISMBean
,ISMDataType
- Direct Known Subclasses:
CicsIndexedFile
,IndexedFile
-
Field Summary
Fields inherited from class com.softwaremining.wrappers.AbstractBasePersistence
fileName, ownerClassName, status
Fields inherited from class com.softwaremining.wrappers.CBLBean
EBCDIC_JIT_PD_SUPPORT_FOR_SEQ_FILES, INDEX_FOR_NON_ARRAY_VERSION_OF_FIELD, INDEX_ZERO, log, tmp_lengthofAssignedValue, totalRuntime_allocate, totalRuntime_calcFieldOffsets, totalRuntime_getMemoryPosition, totalRuntime_setFieldFormatted
Fields inherited from interface com.softwaremining.sql.IPersistence
ACCESS_MODE_DYNAMIC, ACCESS_MODE_RANDOM, ACCESS_MODE_SEQUENTIAL, ASCENDING_RECORD_KEY, CONDITION_TYPE_EQUALS, CONDITION_TYPE_GREATER, CONDITION_TYPE_GREATER_OR_EQUALS, CONDITION_TYPE_IGNORE, CONDITION_TYPE_IGNORE_FOR_SQL_LIKE, CONDITION_TYPE_LESS, CONDITION_TYPE_LESS_OR_EQUALS, CONDITION_TYPE_LIKE, CONDITION_TYPE_NO_CONDITION, CONDITION_TYPE_NOT_ASSIGNED, DESCENDING_RECORD_KEY, OPEN_MODE_EXTEND, OPEN_MODE_I_O, OPEN_MODE_INPUT, OPEN_MODE_NOT_OPENED, OPEN_MODE_OUTPUT, STATUS_AT_END, STATUS_DUP_KEY, STATUS_FAILED_CLOSING, STATUS_INCORRECT_READ_OF_UNOPENED_FILE, STATUS_INCORRECT_RECORDSIZE_REWRITE, STATUS_INSERT_ERR_INAPPROPRIATE_FILE, STATUS_INSERT_ERR_INVALID_KEY, STATUS_LOCK, STATUS_NOT_FOUND, STATUS_REWRITE_WITHOUT_READ, STATUS_SM_FAIL_UNKOWN_REASON, STATUS_SM_NOT_ASSIGNED, STATUS_SUCCESS, UNCERTAIN_OF_RETURN_VALUE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assignAlternateKey
(AbstractCBLField alternateKey) Sets the alternate field for indexing records in the file.void
assignAlternateKey
(AbstractCBLField alternateKey, boolean allowDuplicates) Sets the alternate field for indexing records in the file.void
assignDelegateDAO
(IndexedFileSingleProcess delegateDAO) This method does not do anything for IndexedFiles.void
assignLock
(boolean on) Locks or unlocks the file for Reading/writing access.void
assignOptimiseForDeleteOperation
(boolean optimiseForDeleteOperation) void
assignRecordKey
(AbstractCBLField recordKey) Sets the field for indexing records in the file.void
assignRecordKey
(AbstractCBLField recordKey, boolean allowDuplicates) Sets the field for indexing records in the file.void
assignRecordsAreFixedLength
(boolean fixedLengthRecord) Deprecated.void
assignSQLTableName
(String tableName) This method does nothing! It is provided to simply moving between ISQLBean and Indexed file architecturevoid
assignUseRecSeqDataFiles
(boolean useRecSeqDataFiles) Used to indicate whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-Sequentialint
clear()
Clears all the indexed records.int
close()
Closes the file and writes all the indexed records to the specified file if open mode allows writing.boolean
Deletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.int
Deletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.void
dispose()
~IndexedFileSingleProcess() { dispose(false); }protected void
dispose
(boolean disposing) void
flush()
protected String
static final String
Set-up the Input/Output directory for creation of sequential files.Returns the index field.int
Indexes and inserts the current record into memory table.boolean
protected boolean
this method is designed to be overwritten by IndexedFilesboolean
indicates whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-Sequentialint
Reads the next record into memory.int
open
(int openMode) Opens the specified file for Reading/writing records.int
openCics
(int openMode) int
Reads the prev record into memory.int
Reads the next record into memory if access mode is SEQUENTIAL otherwise, it tries to find a record with key value.void
int
for internal use onlyint
seek
(AbstractCBLField key, int conditionType) Go to the record identified by key Condition type is one of : ACMBasePersistence.CONDITION_TYPE_NO_CONDITION = 0; ACMBasePersistence.CONDITION_TYPE_EQUALS = 1; ACMBasePersistence.CONDITION_TYPE_GREATER = 2; ACMBasePersistence.CONDITION_TYPE_LESS = 3; ACMBasePersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; ACMBasePersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;int
seekRecord
(AbstractCBLField searchKey) Implements the COBOL START command related to IndexedFileSingleProcess, searching for keys matching the condition CONDITION_TYPE_GREATER_OR_EQUALSint
seekRecord
(ISMObject searchKey, int conditionType) Implements the COBOL START command related to IndexedFileSingleProcess.void
setAlternateKey
(AbstractCBLField[] alternateKeys) Sets the alternate fields for indexing records in the file.void
setAlternateKey
(AbstractCBLField[] alternateKeys, boolean allowDuplicates) Sets the alternate fields for indexing records in the file.int
updates the record with specified keyValue to current values.Methods inherited from class com.softwaremining.wrappers.AbstractBasePersistence
assignAccessMode, assignFileName, assignStatus, assignStatus, assignStatusAsPrimitive, assignStatusValue, assignStatusValue, assignTableName, delete, insert, next, prev, read, readRow, retrieveAccessMode, retrieveFileName, retrieveFileName, retrieveFirstLevelEntry, retrieveSessionId, retrieveStatusField, retrieveStatusValue, update
Methods inherited from class com.softwaremining.wrappers.CBLBean
addCorrespondingValue, addCorrespondingValue, allocate, assignAddressTo, assignAddressTo, assignBean, assignBytesEncoded, assignCachedInitializationValue, assignCorrespondingValue, assignCorrespondingValue, assignDefaultValue, assignDependingField, assignEbcdicBytes, assignEbcdicJIT_PdSupportForSequentialFiles, assignEncodedValue, assignExemptFromMemRelease, assignExternal, assignHighValues, assignInternalVars, assignLowValues, assignRawEbcdicBytes, assignRecordSize, assignRedefines, assignRedefines, assignSessionId, assignStringFormatted, assignSubstring, assignSubstring, assignToAddressOf, assignToAddressOf, assignToAddressOf, assignToAddressOf, assignToAllFields, assignValue, assignValue, assignValue, assignValue, assignValue, assignValue, assignValue, calculateStorageSize, containsPointers, equals, equals, equals, equals, equalsRightTrimmed, fieldsCount, fill, fill, fill, fill, fill, getValue, hasPackedDecimalFields, initDefaultValues, initialize, initialize, isExemptFromMemRelease, isFilled, isFilled, isFilled, isFilled, isGreaterThan, isGreaterThan, isGreaterThan, isHighValues, isInvolvedInDependency, isInvolvedInExternalDependency, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessThan, isLessThan, isLessThan, isLessThan, isLessThan, isLowValues, isRedefinedByAnotherClass, isResourceAlreadyReleased, lengthOf, printFieldPosition, printFieldValues, printOrderedFieldPosition, PrintOrderedFieldPositionsAndValue, releaseResources, releaseResources, resetCachedValues, resetCompressedFieldList, resetStructure, resize, retrieveActualLength, retrieveAsInt, retrieveAsString, retrieveCachedInitializationValue, retrieveCompressedFields, retrieveDependedFieldsList, retrieveEbcdicBytes, retrieveEbcdicValue, retrieveEncodedValue, retrieveField, retrieveField, retrieveFieldAtMemoryPosition, retrieveFieldFormatted, retrieveFields, retrieveIsTargetOfPointers, retrievePrimitiveFields, retrieveRawEbcdicBytes, retrieveSQLObject, retrieveStorageCellSize, retrieveStorageChars, retrieveSubstring, retrieveSubstring, retrieveTopLevelField, retrieveValue, retrieveValue, setValue, stringValue, subtractCorrespondingValue, subtractCorrespondingValue, toString
-
Field Details
-
_CurrentIndex
protected int _CurrentIndex
-
-
Constructor Details
-
IndexedFileSingleProcess
public IndexedFileSingleProcess() -
IndexedFileSingleProcess
-
IndexedFileSingleProcess
-
-
Method Details
-
dispose
public void dispose()~IndexedFileSingleProcess() { dispose(false); } -
dispose
protected void dispose(boolean disposing) -
IsFileopen
public boolean IsFileopen() -
retrieveOpenMode
public int retrieveOpenMode()- Specified by:
retrieveOpenMode
in classAbstractBasePersistence
-
assignOptimiseForDeleteOperation
public void assignOptimiseForDeleteOperation(boolean optimiseForDeleteOperation) -
assignRecordKey
Sets the field for indexing records in the file. The primary key must be unique for each record.- Parameters:
name
- ="recordKey - Key field
-
assignSQLTableName
This method does nothing! It is provided to simply moving between ISQLBean and Indexed file architecture- Parameters:
tableName
-
-
retrieveRecordKey
for internal use only- Returns:
-
assignRecordKey
Sets the field for indexing records in the file. The primary key can be set to allow duplicate records.- Parameters:
recordKey
- - Key fieldallowDuplicates
- - Allow duplicate records or not
-
getRecordKey
Returns the index field. -
assignAlternateKey
Sets the alternate field for indexing records in the file. The defined alternate is treated as not unique.- Parameters:
alternateKey
- - Alternate keyValue field
-
assignAlternateKey
Sets the alternate field for indexing records in the file. The alternate keyValue might allow duplication.- Parameters:
alternateKey
- - Alternate keyValue fieldallowDuplicates
- - Allow duplicate records or not
-
setAlternateKey
Sets the alternate fields for indexing records in the file. The defined alternate is treated as not unique.- Parameters:
alternateKeys
- - Alternate keyValue fieldisUnique
- - Allow duplicate records or not
-
setAlternateKey
Sets the alternate fields for indexing records in the file. The alternate keys might allow duplication.- Parameters:
alternateKeys
- - Alternate keyValue fieldallowDuplicates
- - Allow duplicate records or not
-
open
public int open(int openMode) Opens the specified file for Reading/writing records.- Specified by:
open
in classAbstractBasePersistence
- Parameters:
openMode
- - An IndexedFileSingleProcess can be opened in the following modes; 1. INPUT(1) - Reads all the records from the specified file and index according to the specified keyValue. If the file does not exist then exception is thrown. 2. OUTPUT(2) - New file is created or if exists then overwritten with the populated records. 3. I/O(3) or Extend(4) - Reads all the records (if file exists) and indexes. Writes all the records while closing the file.
-
openCics
public int openCics(int openMode) -
close
public int close()Closes the file and writes all the indexed records to the specified file if open mode allows writing.- Specified by:
close
in classAbstractBasePersistence
- Returns:
- 0 on success
-
nextRecord
public int nextRecord()Reads the next record into memory. If the file access mode is SEQUENTIAL or DYNAMIC then records are navigated sequentially. Otherwise the records that have an index greater than or equal to the keyValue value are filtered and each record is Read into memory on each call.- Specified by:
nextRecord
in classAbstractBasePersistence
- Returns:
- true on success otherwise, false
-
prevRecord
public int prevRecord()Reads the prev record into memory. If the file access mode is SEQUENTIAL or DYNAMIC then records are navigated sequentially. Otherwise the records that have an index less than or equal to the keyValue value are filtered and each record is Read into memory on each call.- Specified by:
prevRecord
in classAbstractBasePersistence
- Returns:
- true on success otherwise, false
-
readRecord
public int readRecord()Reads the next record into memory if access mode is SEQUENTIAL otherwise, it tries to find a record with key value.- Specified by:
readRecord
in classAbstractBasePersistence
- Returns:
- true on success otherwise, false
-
deleteRecord
public int deleteRecord()Deletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.- Specified by:
deleteRecord
in classAbstractBasePersistence
- Returns:
- true on success otherwise, false
-
deleteFile
public boolean deleteFile()Deletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.- Returns:
- true on success otherwise, false
-
clear
public int clear()Clears all the indexed records.- Specified by:
clear
in classAbstractBasePersistence
- Returns:
- true on success otherwise, false
-
insertRecord
public int insertRecord()Indexes and inserts the current record into memory table.- Specified by:
insertRecord
in classAbstractBasePersistence
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
-
updateRecord
public int updateRecord()updates the record with specified keyValue to current values.- Specified by:
updateRecord
in classAbstractBasePersistence
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
-
seekRecord
Implements the COBOL START command related to IndexedFileSingleProcess, searching for keys matching the condition CONDITION_TYPE_GREATER_OR_EQUALS- Parameters:
searchKey
- -
-
seek
Go to the record identified by key Condition type is one of : ACMBasePersistence.CONDITION_TYPE_NO_CONDITION = 0; ACMBasePersistence.CONDITION_TYPE_EQUALS = 1; ACMBasePersistence.CONDITION_TYPE_GREATER = 2; ACMBasePersistence.CONDITION_TYPE_LESS = 3; ACMBasePersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; ACMBasePersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5; -
seekRecord
Implements the COBOL START command related to IndexedFileSingleProcess.- Parameters:
searchKey
- -conditionType
- -
-
resetseek
public void resetseek() -
assignLock
public void assignLock(boolean on) Locks or unlocks the file for Reading/writing access.- Overrides:
assignLock
in classAbstractBasePersistence
- Parameters:
on
- - Set lock on or off.
-
flush
public void flush() -
isInsertSingleRecordMode
protected boolean isInsertSingleRecordMode()this method is designed to be overwritten by IndexedFiles -
GenerateGUID
-
getFullFileName
-
getDataDirectory
Set-up the Input/Output directory for creation of sequential files. if running in a web-environment (WEB-INF somewhere in the path) The method needs "softwaremining.properties" file somewhere it its path.- Returns:
- if WEB-INF is somewhere in the path then it absolute path for "WEB-INF/out" if WEB-INF is not anywhere in the path - then it returns "";
-
isUseRecSeqDataFiles
public boolean isUseRecSeqDataFiles()indicates whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-Sequential- Returns:
-
assignUseRecSeqDataFiles
public void assignUseRecSeqDataFiles(boolean useRecSeqDataFiles) Used to indicate whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-Sequential- Parameters:
useRecSeqDataFiles
-
-
assignDelegateDAO
This method does not do anything for IndexedFiles. But it is provided just in case we need to change Super-class for a Persistence.DAO from IndexedFiles to SQLWrapper. -
assignRecordsAreFixedLength
Deprecated.This is a stub method, and does not perform anything. Fixed-Length Records not applicable to indexed files.- Parameters:
fixedLengthRecord
-
-