Package SampleCAT
Class ElectronicJournal
- All Implemented Interfaces:
ElectronicJournalInterface
,JposBaseInterface
Sample device specific accessor class, bound to the credit authorization terminal service.
This implementation provides up to two electronic journal devices, depending on the CAT device
configuration:
- If a path prefix has been specified in jpos.xml (entry JournalPath), ElectronicJournal services are available. They use the device indices 0 (for customer tickets) and 1 (for merchant tickets).
- Otherwise, ticket data will be passed to the application via DirectIOEvents, fired by the CAT service.
- The ElectronicJournal will be written automatically whenever ticket data are received from the terminal.
- The transaction time stamp will be used as markers for the corresponding tickets.
- All ticket data will be written to electronic journal wih index 0.
- All ticket data that shall be printed twice will be written to electronic journal with index 1 as well.
- The application can retrieve ticket data with the QueryContent method. Print methods are not available because the sample device has no printer.
- To be able to use QueryContent, methods RetrieveCurrentMarker and RetrieveMarkerByDateTime can be used. In addition, the contents of the CAT property SlipNumber can be used as marker.
- Each electronic journal can be cleared with the EraseMedium method. This method must be called whenever property MediumFreeSpace is 0.
-
Field Summary
Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.electronicjournal.ElectronicJournalProperties
CapAddMarker, CapErasableMedium, CapInitializeMedium, CapMediumIsAvailable, CapPrintContent, CapPrintContentFile, CapRetrieveCurrentMarker, CapRetrieveMarker, CapRetrieveMarkerByDateTime, CapRetrieveMarkersDateTime, CapStation, CapStorageEnabled, CapSuspendPrintContent, CapSuspendQueryContent, CapWaterMark, MediumFreeSpace, MediumFreeSpaceDef, MediumID, MediumIDDef, MediumIsAvailable, MediumIsAvailableDef, MediumSize, MediumSizeDef, Station, StorageEnabled, Suspended, WaterMark
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 TypeMethodDescriptionvoid
checkHealth(int level)
Final part of CheckHealth method.void
claim(int timeout)
Final part of setting claim.void
deviceEnabled(boolean enable)
Final part of setting DeviceEnabled.void
eraseMedium(EraseMedium request)
Final part of EraseMedium method.void
Will be called whenever DeviceEnabled will be set to true if power notification is enabled (PowerNotify = PN_ENABLED).void
queryContent(QueryContent request)
Final part of QueryContent method.void
retrieveCurrentMarker(int type, String[] marker)
Final part of RetrieveCurrentMarker method.void
retrieveMarkerByDateTime(int type, String date, String count, String[] marker)
Final part of RetrieveMarkerByDateTime method.void
retrieveMarkersDateTime(String marker, String[] date)
Final part of RetrieveMarkersDateTime method.void
station(int station)
Final part of setting Station.Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.electronicjournal.ElectronicJournalProperties
addMarker, cancelPrintContent, cancelQueryContent, clearInput, clearOutput, eraseMedium, initializeMedium, initializeMedium, initOnEnable, initOnFirstEnable, initOnOpen, newJposOutputRequest, printContent, printContent, printContentFile, printContentFile, queryContent, resumePrintContent, resumeQueryContent, retrieveMarker, retryInput, retryOutput, storageEnabled, suspendPrintContent, suspendQueryContent, waterMark
Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
addProperties, asyncMode, attachWaiter, autoDisable, checkForDeprecation, checkProperties, clearDataProperties, clearErrorProperties, clearOutputErrorProperties, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, getClaimingInstance, initOnClaim, open, powerNotify, release, releaseWaiter, removeFromPropertySetList, resetStatistics, retrieveStatistics, signalWaiter, unitDataCount, updateFirmware, updateFirmware, updateStatistics, waitWaiter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.gmxhome.conrad.jpos.jpos_base.JposBaseInterface
asyncMode, autoDisable, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, open, powerNotify, release, removeFromPropertySetList, resetStatistics, retrieveStatistics, unitDataCount, updateFirmware, updateFirmware, updateStatistics
-
Constructor Details
-
ElectronicJournal
Constructor.- Parameters:
index
- Property set used by this accessor.dev
- Device communication handler object.
-
-
Method Details
-
checkHealth
public void checkHealth(int level) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of CheckHealth method. Can be overwritten in derived class, if necessary. Keep in mind that dvice class specific checks (e.g. check of Claimed or DeviceEnabled) must be done within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device is neither enabled nor claimed.
- Specified by:
checkHealth
in interfaceJposBaseInterface
- Overrides:
checkHealth
in classJposCommonProperties
- Parameters:
level
- See UPOS specification, method CheckHealth- Throws:
jpos.JposException
- See UPOS specification, method CheckHealth
-
claim
public void claim(int timeout) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of setting claim. Can be overwritten within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- The device is not claimed,
- ExclusiveUse dos not equal ExclusiveNo,
- timeout is negative not equal to FOREVER.
- Specified by:
claim
in interfaceJposBaseInterface
- Overrides:
claim
in classJposCommonProperties
- Parameters:
timeout
- see UPOS specification, method Claim- Throws:
jpos.JposException
- If an error occurs while claiming the device
-
deviceEnabled
public void deviceEnabled(boolean enable) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of setting DeviceEnabled. Can be overwritten within derived classes. Performs initOnEnable method of corresponding property set in addition to setting DeviceEnabled. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- ExclusiveUse equals ExclusiveYes: Device is claimed,
- DeviceEnabled != enabled.
- Specified by:
deviceEnabled
in interfaceJposBaseInterface
- Overrides:
deviceEnabled
in classJposCommonProperties
- Parameters:
enable
- True to enable, false to disable- Throws:
jpos.JposException
- If an error occurs during enable or disable
-
station
public void station(int station) throws jpos.JposExceptionDescription copied from interface:ElectronicJournalInterface
Final part of setting Station. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- All bits set in station are set in CapStation as well,
- internal property AllowAlwaysSetProperties is true or station equals the previous value of Station.
- Specified by:
station
in interfaceElectronicJournalInterface
- Overrides:
station
in classElectronicJournalProperties
- Parameters:
station
- Station for subsequent storing data into journal.- Throws:
jpos.JposException
- If an error occurs.
-
handlePowerStateOnEnable
public void handlePowerStateOnEnable() throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Will be called whenever DeviceEnabled will be set to true if power notification is enabled (PowerNotify = PN_ENABLED). Should update the PowerState property. Further processing like firing a StatusUpdateEvent is not necessary, this will be made by the framework automatically.- Specified by:
handlePowerStateOnEnable
in interfaceJposBaseInterface
- Overrides:
handlePowerStateOnEnable
in classJposCommonProperties
- Throws:
jpos.JposException
- If an error occurs.
-
eraseMedium
Description copied from interface:ElectronicJournalInterface
Final part of EraseMedium method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a EraseMedium object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.- Specified by:
eraseMedium
in interfaceElectronicJournalInterface
- Overrides:
eraseMedium
in classElectronicJournalProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by EraseMedium.- Throws:
jpos.JposException
- If an error occurs.
-
queryContent
Description copied from interface:ElectronicJournalInterface
Final part of QueryContent method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a QueryContent object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.- Specified by:
queryContent
in interfaceElectronicJournalInterface
- Overrides:
queryContent
in classElectronicJournalProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by QueryContent.- Throws:
jpos.JposException
- If an error occurs.
-
retrieveCurrentMarker
Description copied from interface:ElectronicJournalInterface
Final part of RetrieveCurrentMarker method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- marker is a String array of length 1,
- CapRetrieveCurrentMarker is true,
- marterType is one of MT_SESSION_BEG, MT_SESSION_END, MT_DOCUMENT, MT_HEAD or MT_TAIL.
- Specified by:
retrieveCurrentMarker
in interfaceElectronicJournalInterface
- Overrides:
retrieveCurrentMarker
in classElectronicJournalProperties
- Parameters:
type
- Specifies the type of the queried current marker.marker
- Contains the return value, the implementation specific marker.- Throws:
jpos.JposException
- If an error occurs.
-
retrieveMarkerByDateTime
public void retrieveMarkerByDateTime(int type, String date, String count, String[] marker) throws jpos.JposExceptionDescription copied from interface:ElectronicJournalInterface
Final part of RetrieveMarkerByDateTime method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- Neither dateTime normarkerNumber is null,
- marker is a String array of length 1,
- CapRetrieveMarkerByDateTime is true,
- markerType is one of MT_SESSION_BEG, MT_SESSION_END or MT_DOCUMENT,
- dateTime consists of a valid date and - if present - a valid time,
- markerNumber is numeric, the value is ≥ 1,
- Specified by:
retrieveMarkerByDateTime
in interfaceElectronicJournalInterface
- Overrides:
retrieveMarkerByDateTime
in classElectronicJournalProperties
- Parameters:
type
- Specifies the type of the queried marker.date
- The date-time period the marker is queried for.count
- The number of the marker which has to be queried.marker
- Contains the return value, the implementation specific marker.- Throws:
jpos.JposException
- If an error occurs.
-
retrieveMarkersDateTime
Description copied from interface:ElectronicJournalInterface
Final part of RetrieveMarkersDateTime method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- marker is not null,
- dateTime is a String array of length 1,
- CapRetrieveMarkersDateTime is true.
- Specified by:
retrieveMarkersDateTime
in interfaceElectronicJournalInterface
- Overrides:
retrieveMarkersDateTime
in classElectronicJournalProperties
- Parameters:
marker
- Specifies the marker for which the time has to be determined.date
- Contains the return value, the date and time string of the given marker.- Throws:
jpos.JposException
- If an error occurs.
-