IBM LANDP J/XFS Wrappers

com.ibm.landp.device
Class LandpIBM4722PTR

java.lang.Object
  |
  +--com.ibm.landp.device.internal.LandpDeviceService
        |
        +--com.ibm.landp.device.LandpIBM4722PTR

public class LandpIBM4722PTR
extends com.ibm.landp.device.internal.LandpDeviceService
implements com.jxfs.service.IJxfsPrinterService, com.jxfs.forum.support.IQueueResponse, com.ibm.landp.device.internal.ptr.ILandpPrinterService

This class implements the necessary functionality for the IBM 4722 PTR device. It extends the LandpDeviceService class and implements the rest of the methods, as well as those methods of the IJxfsPrinterService that actually perform printer operations.

At the first Beta level, this class only provides support for the printRawData mode of operation. There is no support for Forms based printing, or for use of the DF operation supplied by the LANDP Financial Printer Server. This class does not currently support the REMS support of the 4722 model 3. In addition there is no support for determining the paper status of the device. Before starting to write data to the printer the user must make sure that there is paper in the device.


Field Summary
static java.lang.String copyrightNotice
           
 
Fields inherited from class com.ibm.landp.device.internal.LandpDeviceService
controls, DESCRIPTION, INTERNAL_TIMEOUT, isShutdownActive, landpServer, localDeviceInfo, logger, openCount, ORIGIN, physicalDeviceDescription, physicalDeviceName, queue, status, subclass, version
 
Fields inherited from interface com.jxfs.service.IJxfsPrinterService
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.jxfs.forum.support.IQueueResponse
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.ibm.landp.device.internal.ptr.ILandpPrinterService
copyrightNotice
 
Fields inherited from interface com.jxfs.service.IJxfsBaseService
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Constructor Summary
LandpIBM4722PTR()
          Default constructor.
 
Method Summary
 void cancel(int identification_id, int control_id)
          Attempts to cancel the operation identified by the identification ID.
 boolean cancelInternal()
          Attempts to cancel an operation.
 boolean checkInternal()
          Implemented just to keep the compiler happy
 boolean claim(int timeout, int control_id)
          Sets up a claim operation for a specific device control.
 void claimInternal(int control_id)
          Simply logs the fact that the device has been claimed
 int close(int control_id)
          Closes the device for the calling device control.
 void closeInternal(com.jxfs.forum.support.IJxfsServiceJob job)
          Implements the operations necessary for a DC to close the device.
 int ctrlMedia(int mediaControl, int control_id)
          Asynchronous method to control a piece of media in the printer.
 com.jxfs.control.ptr.JxfsPtrCtrlMediaCapability getCtrlMediaCapability(int control_id)
          Returns JxfsPtrCtrlMediaCapability object containing the media capabilities of the printer.
 com.jxfs.control.ptr.JxfsPtrExtentCapability getExtentCapability(int control_id)
          Returns JxfsExtendCapability object containing the extent capabilities of the printer.
 int getFieldDescription(java.lang.String[] fieldNames, java.lang.String formName, int control_id)
          Asynchronous method to get the description of a field(s).
 int getFormDescription(java.lang.String formName, int control_id)
          Asynchronous method to get the description of a form.
 int getFormList(int control_id)
          Asynchronous method to get the forms this printer supports.
 com.jxfs.control.ptr.JxfsPtrFormsConfig getFormsConfig(int control_id)
          Returns a JxfsPtrFormsConfig object.
 int getMediaDescription(java.lang.String mediaName, int control_id)
          Asynchronous method to get the description of a piece of media This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
 int getMediaList(int control_id)
          Asynchronous method to get a list of media types available.
 com.jxfs.control.ptr.JxfsPtrStatus getPtrStatus(int control_id)
          Returns object containing the current status of the printer.
 com.jxfs.control.ptr.JxfsPtrWriteFormCapability getWriteFormCapability(int control_id)
          Returns the write form capability of the printer
 boolean isCompound(int controlID)
          Checks to see if the device is compound.
 int mediaExtents(int control_id)
          Asynchronous method to get the extends of the current media.
 int open(int control_id)
          Opens the device for a device control to use.
 void openInternal(com.jxfs.forum.support.IJxfsServiceJob job)
          Implements the operations necessary for a DC to open the device.
 int printForm(java.lang.String formName, java.lang.String mediaName, java.lang.String[] fieldWriteData, int control_id)
          Asynchronous method to print a form.
 int printRawData(byte[] rawData, boolean inputData, int control_id)
          Asynchronous method to print a raw data stream.
 void printRawDataInternal(com.ibm.landp.device.internal.ptr.PrintRawDataJob job, byte[] rawData, boolean inputData)
          This method prints a raw data stream to the printer.
 boolean release(int timeout, int control_id)
          Sets up a release operation for a specific device control.
 void releaseInternal(int control_id)
          Simply logs the fact that the device claim has been released
 int resetPrinter(int control_id)
          Asynchronous method to reset the printer.
 void resetPrinterInternal(com.ibm.landp.device.internal.ptr.ResetPrinterJob job)
          Resets the printer by performing an OP with the 'R' flag set The following calls to LANDP are made in this method: OP - Open the printer.
 void setFormsConfig(com.jxfs.control.ptr.JxfsPtrFormsConfig formsConfig, int control_id)
          Sets the forms config
 
Methods inherited from class com.ibm.landp.device.internal.LandpDeviceService
checkShutdown, connectionFailure, deregisterControl, directIO, getDeviceFirmwareVersion, getDeviceServiceVersion, getFirmwareStatus, getPhysicalDeviceDescription, getPhysicalDeviceName, getRepositoryFirmwareVersion, getStatus, initialize, isPowerSaveModeSupported, registerControl, shutdown, updateFirmware, wakeUpFromPowerSave
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyrightNotice

public static final java.lang.String copyrightNotice
Constructor Detail

LandpIBM4722PTR

public LandpIBM4722PTR()
Default constructor. This sets a number of the variables in LandpDeviceService and creates a reference to the Jxfs logger and a QueueControl object
Method Detail

open

public int open(int control_id)
         throws com.jxfs.events.JxfsException
Opens the device for a device control to use. This is an asynchronous method.
Overrides:
open in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
control_id - The control ID of the calling DC.
Returns:
int The identification ID of this operation.
Throws:
com.jxfs.events.JxfsException -  

close

public int close(int control_id)
          throws com.jxfs.events.JxfsException
Closes the device for the calling device control. This is an asynchronous method.
Overrides:
close in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
control_id - The control ID of the calling DC.
Returns:
int The identification ID of this operation.
Throws:
com.jxfs.events.JxfsException -  

claim

public boolean claim(int timeout,
                     int control_id)
              throws com.jxfs.events.JxfsException
Sets up a claim operation for a specific device control. This is a synchronous method that returns true if the claim succeeds. The method will attempt to claim the device for the time specified in the timeout variable.
Overrides:
claim in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
timeout - The amount of time in millis before stopping the claim attempt.
control_id - The control ID of the calling DC.
Returns:
boolean true - the claim was successful
false - the claim was unsuccessful.
Throws:
com.jxfs.events.JxfsException -  

release

public boolean release(int timeout,
                       int control_id)
                throws com.jxfs.events.JxfsException
Sets up a release operation for a specific device control. This is a synchronous method that returns true if the release succeeds. The method will attempt to release the device for the time specified in the timeout variable.
Overrides:
release in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
timeout - The amount of time in millis before stopping the release attempt.
control_id - The control ID of the calling DC.
Returns:
boolean true - the release was successful
false - the release was unsuccessful.
Throws:
com.jxfs.events.JxfsException -  

cancel

public void cancel(int identification_id,
                   int control_id)
            throws com.jxfs.events.JxfsException
Attempts to cancel the operation identified by the identification ID.
Overrides:
cancel in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
identification_id - The identification ID of the operation to be cancelled.
control_id - The control ID of the calling DC.
Returns:
none
Throws:
com.jxfs.events.JxfsException -  

isCompound

public boolean isCompound(int controlID)
                   throws com.jxfs.events.JxfsException
Checks to see if the device is compound. Returns false by default.
Specified by:
isCompound in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC.
Returns:
boolean true if the device is compound, false if it is not.
Throws:
com.jxfs.events.JxfsException -  

getCtrlMediaCapability

public com.jxfs.control.ptr.JxfsPtrCtrlMediaCapability getCtrlMediaCapability(int control_id)
                                                                       throws com.jxfs.events.JxfsException
Returns JxfsPtrCtrlMediaCapability object containing the media capabilities of the printer.
Specified by:
getCtrlMediaCapability in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
JxfsPtrCtrlMediaCapability contains the media capabilities of the printer
Throws:
com.jxfs.events.JxfsException -  

getExtentCapability

public com.jxfs.control.ptr.JxfsPtrExtentCapability getExtentCapability(int control_id)
                                                                 throws com.jxfs.events.JxfsException
Returns JxfsExtendCapability object containing the extent capabilities of the printer.
Specified by:
getExtentCapability in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
JxfsPtrExtentCapability the extent capabilities of the printer.
Throws:
com.jxfs.events.JxfsException -  

getFormsConfig

public com.jxfs.control.ptr.JxfsPtrFormsConfig getFormsConfig(int control_id)
                                                       throws com.jxfs.events.JxfsException
Returns a JxfsPtrFormsConfig object.
Specified by:
getFormsConfig in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
JxfsPtrFormsConfig contains the forms configuration information for the printer
Throws:
com.jxfs.events.JxfsException -  

setFormsConfig

public void setFormsConfig(com.jxfs.control.ptr.JxfsPtrFormsConfig formsConfig,
                           int control_id)
                    throws com.jxfs.events.JxfsException
Sets the forms config
Specified by:
setFormsConfig in interface com.jxfs.service.IJxfsPrinterService
Parameters:
formsConfig - The new forms configuration
control_id - The control ID of the calling DC
Returns:
none
Throws:
com.jxfs.events.JxfsException -  

getPtrStatus

public com.jxfs.control.ptr.JxfsPtrStatus getPtrStatus(int control_id)
                                                throws com.jxfs.events.JxfsException
Returns object containing the current status of the printer.
Specified by:
getPtrStatus in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - Control ID of the calling DC
Returns:
JxfsPtrStatus object containing printer status
Throws:
com.jxfs.events.JxfsException -  

getWriteFormCapability

public com.jxfs.control.ptr.JxfsPtrWriteFormCapability getWriteFormCapability(int control_id)
                                                                       throws com.jxfs.events.JxfsException
Returns the write form capability of the printer
Specified by:
getWriteFormCapability in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
JxfsPtrWriteFormCapability object containing the write form capability of the printer.
Throws:
com.jxfs.events.JxfsException -  

ctrlMedia

public int ctrlMedia(int mediaControl,
                     int control_id)
              throws com.jxfs.events.JxfsException
Asynchronous method to control a piece of media in the printer. This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
ctrlMedia in interface com.jxfs.service.IJxfsPrinterService
Parameters:
mediaControl - Defines how the media should be handled
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

getFormList

public int getFormList(int control_id)
                throws com.jxfs.events.JxfsException
Asynchronous method to get the forms this printer supports. This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
getFormList in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

mediaExtents

public int mediaExtents(int control_id)
                 throws com.jxfs.events.JxfsException
Asynchronous method to get the extends of the current media. This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
mediaExtents in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

getMediaList

public int getMediaList(int control_id)
                 throws com.jxfs.events.JxfsException
Asynchronous method to get a list of media types available. This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
getMediaList in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

printForm

public int printForm(java.lang.String formName,
                     java.lang.String mediaName,
                     java.lang.String[] fieldWriteData,
                     int control_id)
              throws com.jxfs.events.JxfsException
Asynchronous method to print a form. This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
printForm in interface com.jxfs.service.IJxfsPrinterService
Parameters:
formName - The name of the form to print on
mediaName - the media to print on
fieldWrtieData - The array of strings containing the field data to print
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

printRawData

public int printRawData(byte[] rawData,
                        boolean inputData,
                        int control_id)
                 throws com.jxfs.events.JxfsException
Asynchronous method to print a raw data stream. The application passes a byte array that contains characters to print and control and escape codes to control the printing. This method creates a PrintRawDataJob and places it onto the queue.
Specified by:
printRawData in interface com.jxfs.service.IJxfsPrinterService
Parameters:
rawData - The data stream to pass to the printer
inputData - true if data is expected back from the printer
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException -  

getFieldDescription

public int getFieldDescription(java.lang.String[] fieldNames,
                               java.lang.String formName,
                               int control_id)
                        throws com.jxfs.events.JxfsException
Asynchronous method to get the description of a field(s). This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
getFieldDescription in interface com.jxfs.service.IJxfsPrinterService
Parameters:
fieldNames - The name(s) of the field(s) to get descriptions for
formName - The name of the form that contains the fields
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

getFormDescription

public int getFormDescription(java.lang.String formName,
                              int control_id)
                       throws com.jxfs.events.JxfsException
Asynchronous method to get the description of a form. This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
getFormDescription in interface com.jxfs.service.IJxfsPrinterService
Parameters:
formName - The name of the form
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

getMediaDescription

public int getMediaDescription(java.lang.String mediaName,
                               int control_id)
                        throws com.jxfs.events.JxfsException
Asynchronous method to get the description of a piece of media This method by default returns a JxfsException with JXFS_E_NOT_SUPPORTED.
Specified by:
getMediaDescription in interface com.jxfs.service.IJxfsPrinterService
Parameters:
mediaName - The name of the media
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException - with JXFS_E_NOT_SUPPORTED

resetPrinter

public int resetPrinter(int control_id)
                 throws com.jxfs.events.JxfsException
Asynchronous method to reset the printer. This creates a ResetPrinterJob and places it on the queue.
Specified by:
resetPrinter in interface com.jxfs.service.IJxfsPrinterService
Parameters:
control_id - The control ID of the calling DC
Returns:
int Identification ID of the asynchronous operation
Throws:
com.jxfs.events.JxfsException -  

printRawDataInternal

public void printRawDataInternal(com.ibm.landp.device.internal.ptr.PrintRawDataJob job,
                                 byte[] rawData,
                                 boolean inputData)
This method prints a raw data stream to the printer. The data stream in the form of a byte array is passed transparantly to the Financial Printer Server with no validation, so it is the applications resposbility to make sure that only valid characters, control and escape codes are included.

The following calls to LANDP are made in this method:

  1. OP - Open the printer. This gives us exclusive use.
  2. WR - Write operation that sends the data stream to the printer.
  3. CL - Closes the printer. This is performed in a finally block, so id always executed making sure that the printer is never left in an inaccessible state. param job - Reference to the PrintRawDataJob that is calling this method. param rawData - the byte array containing the data stream param inputData - true if data is expected back from the printer. This is ignored return none
    Specified by:
    printRawDataInternal in interface com.ibm.landp.device.internal.ptr.ILandpPrinterService

resetPrinterInternal

public void resetPrinterInternal(com.ibm.landp.device.internal.ptr.ResetPrinterJob job)
Resets the printer by performing an OP with the 'R' flag set The following calls to LANDP are made in this method:
  1. OP - Open the printer. This gives us exclusive use. The 'R' flag is set in the request parameters to force a reset.
  2. CL - Closes the printer. This is performed in a finally block, so id always executed making sure that the printer is never left in an inaccessible state. param job - Reference to the PrintRawDataJob that is calling this method. return none
    Specified by:
    resetPrinterInternal in interface com.ibm.landp.device.internal.ptr.ILandpPrinterService

cancelInternal

public boolean cancelInternal()
Attempts to cancel an operation. If status.isBusy() returns true then operations cannot be cancelled, else this method sets the cancelop flag to true in the knowledge that the operation will pick up on this and cancel itself. This method is not implemented at the moment. return boolean True if operation was successfully cancelled.
Specified by:
cancelInternal in interface com.ibm.landp.device.internal.ptr.ILandpPrinterService

checkInternal

public boolean checkInternal()
Implemented just to keep the compiler happy
Specified by:
checkInternal in interface com.jxfs.forum.support.IQueueResponse
Overrides:
checkInternal in class com.ibm.landp.device.internal.LandpDeviceService
Returns:
boolean true

openInternal

public void openInternal(com.jxfs.forum.support.IJxfsServiceJob job)
                  throws com.jxfs.events.JxfsException
Implements the operations necessary for a DC to open the device. If this is the first time this call is made then the device is initialized else the open count is simply incremented
Specified by:
openInternal in interface com.jxfs.forum.support.IQueueResponse
Overrides:
openInternal in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
job - Object implementing the IJxfsServiceJob interface
Returns:
none
Throws:
com.jxfs.events.JxfsException -  

closeInternal

public void closeInternal(com.jxfs.forum.support.IJxfsServiceJob job)
                   throws com.jxfs.events.JxfsException
Implements the operations necessary for a DC to close the device.
Specified by:
closeInternal in interface com.jxfs.forum.support.IQueueResponse
Overrides:
closeInternal in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
job - Object implementing the IJxfsServiceJob interface
Returns:
none
Throws:
com.jxfs.events.JxfsException -  

claimInternal

public void claimInternal(int control_id)
Simply logs the fact that the device has been claimed
Specified by:
claimInternal in interface com.jxfs.forum.support.IQueueResponse
Overrides:
claimInternal in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
control_id - The control ID of the calling DC.
Returns:
none

releaseInternal

public void releaseInternal(int control_id)
Simply logs the fact that the device claim has been released
Specified by:
releaseInternal in interface com.jxfs.forum.support.IQueueResponse
Overrides:
releaseInternal in class com.ibm.landp.device.internal.LandpDeviceService
Parameters:
control_id - The control ID of the calling DC.
Returns:
none

IBM LANDP J/XFS Wrappers

Copyright IBM Corporation 2000. All Rights Reserved.