IBM LANDP J/XFS Wrappers

com.ibm.landp.device
Class LandpIBM47xxMSD

java.lang.Object
  |
  +--com.ibm.landp.device.internal.LandpDeviceService
        |
        +--com.ibm.landp.device.LandpIBM47xxMSD
Direct Known Subclasses:
LandpIBM4778PIN_MSD

public class LandpIBM47xxMSD
extends com.ibm.landp.device.internal.LandpDeviceService
implements com.jxfs.service.IJxfsMagStripeService, com.jxfs.forum.support.IQueueResponse, com.ibm.landp.device.internal.msd.ILandpMagStripeService

This class implements the necessary functionality for the IBM 4777 MSR device. It extends the LandpDeviceService class and implements the rest of the methods, as well as those methods of the IJxfsMagStripeInterface that actually perform the reading and writing of tracks.


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.IJxfsMagStripeService
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.msd.ILandpMagStripeService
copyrightNotice
 
Fields inherited from interface com.jxfs.service.IJxfsBaseService
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Constructor Summary
LandpIBM47xxMSD()
          Default constructor.
 
Method Summary
 void cancel(int identification_id, int control_id)
          Attempts to cancel the operation identified by the identification ID.
 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 getDeviceType(int control_id)
          Identifies which type of mag stripe device this is.
 com.jxfs.general.JxfsMediaStatus getMediaStatus(int control_id)
          Returns the state of the media in the device.
 com.jxfs.control.msd.JxfsMSDTracks getSupportedReadTracks(int control_id)
          Returns the tracks that this device supports for reading.
 com.jxfs.control.msd.JxfsMSDTracks getSupportedWriteTracks(int control_id)
          Returns the tracks that this device supports for writing.
 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 readData(com.jxfs.control.msd.JxfsMSDTrackSelection tracksToRead, int control_id)
          Creates a ReadTracksJob and then returns an identification ID for the operation.
 void readInternal(com.ibm.landp.device.internal.msd.ReadTracksJob job, com.jxfs.control.msd.JxfsMSDTrackSelection tracksToRead)
          Implements the operations necessary for a readTracks operation.
 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 writeData(java.util.Vector wdata, boolean newCard, int control_id)
          Creates a WriteTracksJob and then returns an identification ID for the operation.
 void writeInternal(com.ibm.landp.device.internal.msd.WriteTracksJob job, java.util.Vector wdata)
          Implements the operations necessary for a writeTracks operation.
 
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

LandpIBM47xxMSD

public LandpIBM47xxMSD()
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 -  

getDeviceType

public int getDeviceType(int control_id)
                  throws com.jxfs.events.JxfsException
Identifies which type of mag stripe device this is. In this case we always return JXFS_MSD_TYPE_SWIPE. This is a synchronous operation.
Specified by:
getDeviceType in interface com.jxfs.service.IJxfsMagStripeService
Parameters:
control_id - The control ID of the calling DC.
Returns:
int The type of mag stripe device.
Throws:
com.jxfs.events.JxfsException -  

readData

public int readData(com.jxfs.control.msd.JxfsMSDTrackSelection tracksToRead,
                    int control_id)
             throws com.jxfs.events.JxfsException
Creates a ReadTracksJob and then returns an identification ID for the operation. This is an asynchronous operation. This method also checks that the tracks specified in the tracksToRead parameter are supported by the device, and that indeed, some tracks have been specified to read!
Specified by:
readData in interface com.jxfs.service.IJxfsMagStripeService
Parameters:
tracksToRead - Object that identifies which tracks are to be read from the card.
control_id - The control ID of the calling DC.
Returns:
int Identification ID of this operation.
Throws:
com.jxfs.events.JxfsException - JXFS_E_MSD_NOTRACKS if no tracks have been specified to read.
JXFS_E_MSD_NOTSUPPORTEDTRACK if one of the tracks is not supported.

writeData

public int writeData(java.util.Vector wdata,
                     boolean newCard,
                     int control_id)
              throws com.jxfs.events.JxfsException
Creates a WriteTracksJob and then returns an identification ID for the operation. This is an asynchronous operation. This method also checks that the tracks to write are supported by the device, and that indeed, some tracks have been specified to write to!
Specified by:
writeData in interface com.jxfs.service.IJxfsMagStripeService
Parameters:
wdata - Vector containing three elements representing the data to write to track 1 2 and 3. If any element is null then that track is not to be written.
control_id - The control ID of the calling DC.
Returns:
int Identification ID of this operation.
Throws:
com.jxfs.events.JxfsException - JXFS_E_UNREGISTERED if the DC making this call is not registered
JXFS_E_CLOSED is the DC making this call has not opened the device.
JXFS_E_MSD_NOTRACKS if no tracks have been specified to write.
JXFS_E_MSD_NOTSUPPORTEDTRACK if one of the tracks is not supported.

getMediaStatus

public com.jxfs.general.JxfsMediaStatus getMediaStatus(int control_id)
                                                throws com.jxfs.events.JxfsException
Returns the state of the media in the device. As the 47xx is a swipe device this is irrelevant and therefore always returns a JxfsMediaStatus object with the mediaState set to 0. Likewise, this device service does not implement any methods to change the state, or fire events when the state changes.
Specified by:
getMediaStatus in interface com.jxfs.service.IJxfsMagStripeService
Parameters:
control_id - The control ID of the calling DC.
Returns:
JxfsMediaStatus
Throws:
com.jxfs.events.JxfsException -  

getSupportedReadTracks

public com.jxfs.control.msd.JxfsMSDTracks getSupportedReadTracks(int control_id)
                                                          throws com.jxfs.events.JxfsException
Returns the tracks that this device supports for reading. This information is obtained by making an EC request to the LANDP device service when the initializePhysically method is called.
Specified by:
getSupportedReadTracks in interface com.jxfs.service.IJxfsMagStripeService
Parameters:
control_id - The control ID of the calling DC.
Returns:
JxfsMSDTracks Object containing information on which tracks this device supports for reading.
Throws:
com.jxfs.events.JxfsException -  

getSupportedWriteTracks

public com.jxfs.control.msd.JxfsMSDTracks getSupportedWriteTracks(int control_id)
                                                           throws com.jxfs.events.JxfsException
Returns the tracks that this device supports for writing. This information is obtained by making an EC request to the LANDP device service when the initializePhysically method is called.
Specified by:
getSupportedWriteTracks in interface com.jxfs.service.IJxfsMagStripeService
Parameters:
control_id - The control ID of the calling DC.
Returns:
JxfsMSDTracks Object containing information on which tracks this device supports for writing.
Throws:
com.jxfs.events.JxfsException -  

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

readInternal

public void readInternal(com.ibm.landp.device.internal.msd.ReadTracksJob job,
                         com.jxfs.control.msd.JxfsMSDTrackSelection tracksToRead)
Implements the operations necessary for a readTracks operation. This method makes the calls necessary to the LANDP device server to read the tracks specified in the tracksToRead parameter
Specified by:
readInternal in interface com.ibm.landp.device.internal.msd.ILandpMagStripeService
Parameters:
job - Object implementing the IJxfsServiceJob interface
tracksToRead - Specifies which tracks are to be read from the card
Returns:
none

writeInternal

public void writeInternal(com.ibm.landp.device.internal.msd.WriteTracksJob job,
                          java.util.Vector wdata)
Implements the operations necessary for a writeTracks operation. This method makes the calls necessary to the LANDP device server to write the tracks specified in wdata.
Specified by:
writeInternal in interface com.ibm.landp.device.internal.msd.ILandpMagStripeService
Parameters:
job - Object implementing the IJxfsServiceJob interface
tracksToRead - Specifies the data to write to the card
Returns:
none

IBM LANDP J/XFS Wrappers

Copyright IBM Corporation 2000. All Rights Reserved.