Class HardTotalsProperties
java.lang.Object
de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
de.gmxhome.conrad.jpos.jpos_base.hardtotals.HardTotalsProperties
- All Implemented Interfaces:
HardTotalsInterface,JposBaseInterface
Class containing the hard totals specific properties, their default values and default implementations of
HardTotalsInterface.
For details about properties, methods and method parameters, see UPOS specification, chapter Hard Totals.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanUPOS property CapErrorDetection.booleanUPOS property CapSingleFile.booleanUPOS property CapTransactions.UPOS property FreeData.UPOS property NumberOfFiles.UPOS property TotalsSize.Buffered SetAll and Write requests, to be performed at transaction end.booleanUPOS property TransactionInProgress.Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
AllowAlwaysSetProperties, AllowDeprecatedMethods, AsyncInputActive, AsyncMode, AutoDisable, CapStatisticsReporting, CapUpdateStatistics, CheckHealthText, Claimed, Claiming, ClaimWaiters, CurrentCommands, CurrentUnitID, DataCount, DataEventEnabled, DataEventList, Device, DeviceEnabled, DeviceServiceDescription, DeviceServiceVersion, DevProps, ErrorString, ErrorUnits, EventCB, EventList, EventSource, EventString, EventUnitID, EventUnits, ExclusiveAllowed, ExclusiveNo, ExclusiveUse, ExclusiveYes, FirstEnableHappened, FlagWhenIdle, FlagWhenIdleStatusValue, FreezeEvents, Index, LogicalName, MaximumConfirmationEventWaitingTime, OutputID, PowerNotify, PowerState, SerializedRequestRunner, SerializedRequests, State, StrictFIFOEventHandling, SuspendedCommands, SuspendedConcurrentCommands, UnitsOnline, UsesSubsystemUnits -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidFinal part of BeginTrans method.intReturns the number of currently claimed hard total files.voidclaimFile(int hTotalsFile, int timeout)Final part of ClaimFile method.voidclose()Final part of close method.voidFinal part of CommitTrans method.voidFinal part of Create method.voidFinal part of Delete method.voidFinal part of Find method.voidfindByIndex(int index, String[] fileName)Final part of FindByIndex method.voidread(int hTotalsFile, byte[] data, int offset, int count, List<ChangeRequest> transaction)Final part of Read method.voidrecalculateValidationData(int hTotalsFile)Final part of RecalculateValidationData method.voidreleaseFile(int hTotalsFile)Final part of ReleaseFile method.voidFinal part of Rename method.voidrollback()Final part of Rollback method.setAll(int hTotalsFile, byte value)Validation part of SetAll method.voidFinal part of SetAll method.voidvalidateData(int hTotalsFile)Final part of OpenGate method.write(int hTotalsFile, byte[] data, int offset, int count)Validation part of Write method.voidFinal part of Write method.Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
addProperties, asyncMode, attachWaiter, autoDisable, checkForDeprecation, checkHealth, checkProperties, claim, clearDataProperties, clearErrorProperties, clearInput, clearOutput, clearOutputErrorProperties, compareFirmwareVersion, dataEventEnabled, deviceEnabled, directIO, directIO, flagWhenIdle, freezeEvents, getClaimingInstance, handlePowerStateOnEnable, initOnClaim, initOnEnable, initOnFirstEnable, initOnOpen, newJposOutputRequest, open, powerNotify, release, releaseWaiter, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, signalWaiter, unitDataCount, updateFirmware, updateFirmware, updateStatistics, waitWaiterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.gmxhome.conrad.jpos.jpos_base.JposBaseInterface
asyncMode, autoDisable, checkHealth, claim, clearInput, clearOutput, compareFirmwareVersion, dataEventEnabled, deviceEnabled, directIO, directIO, flagWhenIdle, freezeEvents, handlePowerStateOnEnable, newJposOutputRequest, open, powerNotify, release, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, unitDataCount, updateFirmware, updateFirmware, updateStatistics
-
Field Details
-
CapErrorDetection
public boolean CapErrorDetectionUPOS property CapErrorDetection. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapSingleFile
public boolean CapSingleFileUPOS property CapSingleFile. Default: true. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapTransactions
public boolean CapTransactionsUPOS property CapTransactions. Default: true. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
FreeData
UPOS property FreeData. Must be initialized in the individual initOnEnable method. -
NumberOfFiles
UPOS property NumberOfFiles. Must be initialized in the individual initOnEnable method. -
TotalsSize
UPOS property TotalsSize. Must be overwritten in the individual initOnEnable method. Value must be ≥ FreeData. -
TransactionInProgress
public boolean TransactionInProgressUPOS property TransactionInProgress. Default: false. Must not be overwritten within the changeDefaults method. -
Transaction
Buffered SetAll and Write requests, to be performed at transaction end. This list will be cleared and filled by the service implementation. A Device implementation must never change this list, but use the list as far as TransactionInProgress is true.
-
-
Constructor Details
-
HardTotalsProperties
protected HardTotalsProperties(int dev)Constructor.- Parameters:
dev- Device index
-
-
Method Details
-
claimedHandles
public int claimedHandles()Returns the number of currently claimed hard total files.- Returns:
- Number of claimed files.
-
close
public void close() throws jpos.JposExceptionDescription copied from interface:JposBaseInterfaceFinal part of close method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is neither enabled nor claimed.
- Specified by:
closein interfaceJposBaseInterface- Overrides:
closein classJposCommonProperties- Throws:
jpos.JposException- See UPOS specification, method Close
-
beginTrans
public void beginTrans() throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of BeginTrans method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapTransaction is true,
- TransactionInProgress is false.
- Specified by:
beginTransin interfaceHardTotalsInterface- Throws:
jpos.JposException- If an error occurs.
-
claimFile
public void claimFile(int hTotalsFile, int timeout) throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of ClaimFile method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- The hard totals file specified by hTotalsFile has not been claimed previously,
- timeout is FOREVER or positive.
- Specified by:
claimFilein interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.timeout- The (reduced) time in milliseconds to wait for the file to become available.- Throws:
jpos.JposException- If an error occurs.
-
commitTrans
public void commitTrans() throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of CommitTrans method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- CapTransactions is true,
- TransactionInProgress is true,
- All files used in stored Write or SetAll operations have not been claimed by another instance.
- Specified by:
commitTransin interfaceHardTotalsInterface- Throws:
jpos.JposException- If an error occurs.
-
create
public void create(String fileName, int[] hTotalsFile, int size, boolean errorDetection) throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of Create method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- if CapSingleFile is true, fileName is an empty string,
- otherwise, fileName consists of no more than 10 ASCII characters (character codes between 0x20 and 0x7f,
- hTotalsFile is an array with length = 1,
- size is a positive value.
- Specified by:
createin interfaceHardTotalsInterface- Parameters:
fileName- Name of totals file.hTotalsFile- No matter on call, handle to file on return.size- Requested size of the file.errorDetection- Error detection level.- Throws:
jpos.JposException- If an error occurs.
-
delete
Description copied from interface:HardTotalsInterfaceFinal part of Delete method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- if CapSingleFile is true, fileName is an empty string,
- otherwise, fileName consists of no more than 10 ASCII characters (character codes between 0x20 and 0x7f.
- Specified by:
deletein interfaceHardTotalsInterface- Parameters:
fileName- Name of file to be deleted.- Throws:
jpos.JposException- If an error occurs.
-
find
Description copied from interface:HardTotalsInterfaceFinal part of Find method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- if CapSingleFile is true, fileName is an empty string,
- otherwise, fileName consists of no more than 10 ASCII characters (character codes between 0x20 and 0x7f,
- hTotalsFile is an array with length = 1,
- size is an array with length = 1.
- Specified by:
findin interfaceHardTotalsInterface- Parameters:
fileName- Name of file to be found.hTotalsFile- No matter on call, file handle on return.size- No matter on call, file size on return.- Throws:
jpos.JposException- If an error occurs.
-
findByIndex
Description copied from interface:HardTotalsInterfaceFinal part of FindByIndex method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- fileName is an array with length = 1,
- index is ≥ 0 and < NumberOfFiles.
- Specified by:
findByIndexin interfaceHardTotalsInterface- Parameters:
index- File index between 0 and NumberOfFiles - 1.fileName- No matter on call, file name on return.- Throws:
jpos.JposException- If an error occurs.
-
read
public void read(int hTotalsFile, byte[] data, int offset, int count, List<ChangeRequest> transaction) throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of Read method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- offset ≥ 0, count ≥ 0 and length of data ≥ count,
- offset + count ≤ TotalsSize,
- The hard totals file specified by hTotalsFile has not been claimed by another instance.
- Specified by:
readin interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.data- Data buffer for read.offset- Starting offset for read operation.count- Number of bytes to be read.transaction- List of ChangeRequest objects stored within all current transactions. An empty list if no transaction is in progress.- Throws:
jpos.JposException- If an error occurs.
-
recalculateValidationData
public void recalculateValidationData(int hTotalsFile) throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of RecalculateValidationData method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- The hard totals file specified by hTotalsFile has not been claimed by other instance,
- Device supports advanced error detection.
- Specified by:
recalculateValidationDatain interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.- Throws:
jpos.JposException- If an error occurs.
-
releaseFile
public void releaseFile(int hTotalsFile) throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of ReleaseFile method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- The hard totals file specified by hTotalsFile has not been claimed.
- Specified by:
releaseFilein interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.- Throws:
jpos.JposException- If an error occurs.
-
setAll
Description copied from interface:HardTotalsInterfaceValidation part of SetAll method. Can be overwritten within derived classes, if necessary. This method shall only perform additional validation. It will be called before the service buffers the method call for synchronous or asynchronous execution. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- The hard totals file specified by hTotalsFile has not been claimed by another instance.
- Specified by:
setAllin interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.value- Value to set all locations to in totals file.- Returns:
- SetAll object for use in final part or in CommitTrans.
- Throws:
jpos.JposException- If an error occurs.
-
setAll
Description copied from interface:HardTotalsInterfaceFinal part of SetAll method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a SetAll object. This method will be called when the corresponding operation shall be performed, either synchronously during commit. All plausibility checks have been made before, only runtime errors can occur.
The default implementation should be called within derived methods to ensure that the property TransactionInProgress is updated as expected.- Specified by:
setAllin interfaceHardTotalsInterface- Parameters:
request- Output request object returned by validation method that contains all parameters to be used by SetAll.- Throws:
jpos.JposException- If an error occurs.
-
write
Description copied from interface:HardTotalsInterfaceValidation part of Write method. Can be overwritten within derived classes, if necessary. This method shall only perform additional validation. It will be called before the service buffers the method call for synchronous or asynchronous execution. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- The byte buffer consists of at least count bytes,
- Both, offset and count, are ≥ 0 and their sum is %le; TotalsSize,
- Device has not been claimed by another instance,
- The hard totals file specified by hTotalsFile has not been claimed by another instance.
- Specified by:
writein interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.data- Data to be written.offset- Starting offset for write operation.count- Number of bytes to be written.- Returns:
- Write object for use in final part.
- Throws:
jpos.JposException- If an error occurs.
-
write
Description copied from interface:HardTotalsInterfaceFinal part of Write method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a Write object. This method will be called when the corresponding operation shall be performed, either synchronously during commit. All plausibility checks have been made before, only runtime errors can occur.
The default implementation should be called within derived methods to ensure that the property TransactionInProgress is updated as expected.- Specified by:
writein interfaceHardTotalsInterface- Parameters:
request- Output request object returned by validation method that contains all parameters to be used by Write.- Throws:
jpos.JposException- If an error occurs.
-
rename
Description copied from interface:HardTotalsInterfaceFinal part of Rename method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- if CapSingleFile is true, fileName is an empty string,
- otherwise, fileName consists of no more than 10 ASCII characters (character codes between 0x20 and 0x7f,
- The hard totals file specified by hTotalsFile has not been claimed by other instance.
- Specified by:
renamein interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.fileName- New file name.- Throws:
jpos.JposException- If an error occurs.
-
rollback
public void rollback() throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of Rollback method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapTransactions and TransactionInProgress are true.
- Specified by:
rollbackin interfaceHardTotalsInterface- Throws:
jpos.JposException- If an error occurs.
-
validateData
public void validateData(int hTotalsFile) throws jpos.JposExceptionDescription copied from interface:HardTotalsInterfaceFinal part of OpenGate method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled and not claimed by other instance,
- The hard totals file specified by hTotalsFile has not been claimed by other instance,
- Device supports advanced error detection.
- Specified by:
validateDatain interfaceHardTotalsInterface- Parameters:
hTotalsFile- Handle of a totals file.- Throws:
jpos.JposException- If an error occurs.
-