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
FieldsFields inherited from class com.softwaremining.wrappers.AbstractBasePersistence
fileName, ownerClassName, statusFields 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_setFieldFormattedFields 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_CLOSE_FILE_FILE_NOT_OPEN, 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_OPEN_FILE_FILE_NOT_FOUND, STATUS_REWRITE_WITHOUT_READ, STATUS_SM_FAIL_UNKOWN_REASON, STATUS_SM_NOT_ASSIGNED, STATUS_SUCCESS, UNCERTAIN_OF_RETURN_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassignAlternateKey(AbstractCBLField alternateKey) Sets the alternate field for indexing records in the file.voidassignAlternateKey(AbstractCBLField alternateKey, boolean allowDuplicates) Sets the alternate field for indexing records in the file.voidassignDelegateDAO(IndexedFileSingleProcess delegateDAO) This method does not do anything for IndexedFiles.voidassignLock(boolean on) Locks or unlocks the file for Reading/writing access.voidassignOptimiseForDeleteOperation(boolean optimiseForDeleteOperation) voidassignOptional(boolean isOptional) voidassignRecordKey(AbstractCBLField recordKey) Sets the field for indexing records in the file.voidassignRecordKey(AbstractCBLField recordKey, boolean allowDuplicates) Sets the field for indexing records in the file.voidassignRecordsAreFixedLength(boolean fixedLengthRecord) Deprecated.voidassignSQLTableName(String tableName) This method does nothing! It is provided to simply moving between ISQLBean and Indexed file architecturevoidassignUseRecSeqDataFiles(boolean useRecSeqDataFiles) Used to indicate whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-Sequentialintclear()Clears all the indexed records.intclose()Closes the file and writes all the indexed records to the specified file if open mode allows writing.booleanDeletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.intDeletes the current record if access mode is SEQUENTIAL otherwise, tries to delete the record with keyValue value.voiddispose()~IndexedFileSingleProcess() { dispose(false); }protected voiddispose(boolean disposing) voidflush()protected Stringstatic final StringSet-up the Input/Output directory for creation of sequential files.Returns the index field.intIndexes and inserts the current record into memory table.booleanprotected booleanthis method is designed to be overwritten by IndexedFilesbooleanindicates whether the underlying data-file is RECORD-SEQUENTIAL (no CR/LF) or Line-SequentialintReads the next record into memory.intopen(int openMode) Opens the specified file for Reading/writing records.intopenCics(int openMode) intReads the prev record into memory.intReads the next record into memory if access mode is SEQUENTIAL otherwise, it tries to find a record with key value.voidintfor internal use onlyintseek(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;intseekRecord(AbstractCBLField searchKey) Implements the COBOL START command related to IndexedFileSingleProcess, searching for keys matching the condition CONDITION_TYPE_GREATER_OR_EQUALSintseekRecord(ISMObject searchKey, int conditionType) Implements the COBOL START command related to IndexedFileSingleProcess.voidsetAlternateKey(AbstractCBLField[] alternateKeys) Sets the alternate fields for indexing records in the file.voidsetAlternateKey(AbstractCBLField[] alternateKeys, boolean allowDuplicates) Sets the alternate fields for indexing records in the file.intupdates 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, updateMethods 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, 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, print, printFieldPosition, printFieldValues, printOrderedFieldPosition, releaseResources, releaseResources, resetCachedValues, resetCompressedFieldList, resetStorageManager, resetStructure, resize, retrieveActualLength, retrieveAsInt, retrieveAsString, retrieveCachedInitializationValue, retrieveCompressedFields, retrieveDependedFieldsList, retrieveEbcdicBytes, retrieveEbcdicValue, retrieveEncodedValue, retrieveField, retrieveField, retrieveFieldAtMemoryPosition, retrieveFieldFormatted, retrieveFields, retrieveIsTargetOfPointers, retrievePrimitiveFields, retrieveRawEbcdicBytes, retrieveRedefinesList, retrieveSQLObject, retrieveStorageBytes, retrieveStorageCellSize, 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:
retrieveOpenModein 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:
openin 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:
closein 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:
nextRecordin 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:
prevRecordin 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:
readRecordin 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:
deleteRecordin 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:
clearin classAbstractBasePersistence- Returns:
- true on success otherwise, false
-
insertRecord
public int insertRecord()Indexes and inserts the current record into memory table.- Specified by:
insertRecordin classAbstractBasePersistence- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
-
updateRecord
public int updateRecord()updates the record with specified keyValue to current values.- Specified by:
updateRecordin 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:
assignLockin 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-
-
assignOptional
public void assignOptional(boolean isOptional)
-