blob: 03e7dac99c75fc068201001d82ca1791812df693 [file] [log] [blame]
//------------------------------------------------------------------------------
//
// This software is provided "AS IS". The JavaPOS working group (including
// each of the Corporate members, contributors and individuals) MAKES NO
// REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NON-INFRINGEMENT. The JavaPOS working group shall not be liable for
// any damages suffered as a result of using, modifying or distributing this
// software or its derivatives.Permission to use, copy, modify, and distribute
// the software and its documentation for any purpose is hereby granted.
//
// HardTotals.java - A JavaPOS 1.14.0 device control
//
//------------------------------------------------------------------------------
package jpos;
import jpos.events.*;
import jpos.services.*;
import java.util.Vector;
import jpos.loader.*;
public class HardTotals
extends BaseJposControl
implements HardTotalsControl114, JposConst
{
//--------------------------------------------------------------------------
// Variables
//--------------------------------------------------------------------------
protected HardTotalsService12 service12;
protected HardTotalsService13 service13;
protected HardTotalsService14 service14;
protected HardTotalsService15 service15;
protected HardTotalsService16 service16;
protected HardTotalsService17 service17;
protected HardTotalsService18 service18;
protected HardTotalsService19 service19;
protected HardTotalsService110 service110;
protected HardTotalsService111 service111;
protected HardTotalsService112 service112;
protected HardTotalsService113 service113;
protected HardTotalsService114 service114;
protected Vector directIOListeners;
protected Vector statusUpdateListeners;
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
public HardTotals()
{
// Initialize base class instance data
deviceControlDescription = "JavaPOS HardTotals Device Control";
deviceControlVersion = deviceVersion114;
// Initialize instance data. Initializations are commented out for
// efficiency if the Java default is correct.
//service12 = null;
//service13 = null;
//service14 = null;
//service15 = null;
//service16 = null;
//service17 = null;
//service18 = null;
//service19 = null;
//service110 = null;
//service111 = null;
//service112 = null;
//service113 = null;
//service114 = null;
directIOListeners = new Vector();
statusUpdateListeners = new Vector();
}
//--------------------------------------------------------------------------
// Capabilities
//--------------------------------------------------------------------------
public boolean getCapErrorDetection()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getCapErrorDetection();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapSingleFile()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getCapSingleFile();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapTransactions()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getCapTransactions();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getCapPowerReporting()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// Perform the operation
try
{
return service13.getCapPowerReporting();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapStatisticsReporting()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.8.0
if(serviceVersion < deviceVersion18)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.8.0 compliant.");
}
// Perform the operation
try
{
return service18.getCapStatisticsReporting();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapUpdateStatistics()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.8.0
if(serviceVersion < deviceVersion18)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.8.0 compliant.");
}
// Perform the operation
try
{
return service18.getCapUpdateStatistics();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapCompareFirmwareVersion()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.9.0
if(serviceVersion < deviceVersion19)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.9.0 compliant.");
}
// Perform the operation
try
{
return service19.getCapCompareFirmwareVersion();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapUpdateFirmware()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.9.0
if(serviceVersion < deviceVersion19)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.9.0 compliant.");
}
// Perform the operation
try
{
return service19.getCapUpdateFirmware();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
//--------------------------------------------------------------------------
// Properties
//--------------------------------------------------------------------------
public int getFreeData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getFreeData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getNumberOfFiles()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getNumberOfFiles();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getTotalsSize()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTotalsSize();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getTransactionInProgress()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTransactionInProgress();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getPowerNotify()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// Perform the operation
try
{
return service13.getPowerNotify();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setPowerNotify(int powerNotify)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// Perform the operation
try
{
service13.setPowerNotify(powerNotify);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getPowerState()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// Perform the operation
try
{
return service13.getPowerState();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
//--------------------------------------------------------------------------
// Methods
//--------------------------------------------------------------------------
public void beginTrans()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.beginTrans();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void claimFile(int hTotalsFile, int timeout)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.claimFile(hTotalsFile, timeout);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void commitTrans()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.commitTrans();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void create(String fileName, int[] hTotalsFile, int size, boolean errorDetection)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.create(fileName, hTotalsFile, size, errorDetection);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void delete(String fileName)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.delete(fileName);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void find(String fileName, int[] hTotalsFile, int[] size)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.find(fileName, hTotalsFile, size);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void findByIndex(int index, String[] fileName)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.findByIndex(index, fileName);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void read(int hTotalsFile, byte[] data, int offset, int count)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.read(hTotalsFile, data, offset, count);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void recalculateValidationData(int hTotalsFile)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.recalculateValidationData(hTotalsFile);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void releaseFile(int hTotalsFile)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.releaseFile(hTotalsFile);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void rename(int hTotalsFile, String fileName)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.rename(hTotalsFile, fileName);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void rollback()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.rollback();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setAll(int hTotalsFile, byte value)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.setAll(hTotalsFile, value);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void validateData(int hTotalsFile)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.validateData(hTotalsFile);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void write(int hTotalsFile, byte[] data, int offset, int count)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.write(hTotalsFile, data, offset, count);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void resetStatistics(String statisticsBuffer)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.8.0
if(serviceVersion < deviceVersion18)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.8.0 compliant.");
}
// Perform the operation
try
{
service18.resetStatistics(statisticsBuffer);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void retrieveStatistics(String[] statisticsBuffer)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.8.0
if(serviceVersion < deviceVersion18)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.8.0 compliant.");
}
// Perform the operation
try
{
service18.retrieveStatistics(statisticsBuffer);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void updateStatistics(String statisticsBuffer)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.8.0
if(serviceVersion < deviceVersion18)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.8.0 compliant.");
}
// Perform the operation
try
{
service18.updateStatistics(statisticsBuffer);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void compareFirmwareVersion(String firmwareFileName, int[] result)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.9.0
if(serviceVersion < deviceVersion19)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.9.0 compliant.");
}
// Perform the operation
try
{
service19.compareFirmwareVersion(firmwareFileName, result);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void updateFirmware(String firmwareFileName)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Make sure service supports at least version 1.9.0
if(serviceVersion < deviceVersion19)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.9.0 compliant.");
}
// Perform the operation
try
{
service19.updateFirmware(firmwareFileName);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
//--------------------------------------------------------------------------
// Framework Methods
//--------------------------------------------------------------------------
// Create an EventCallbacks interface implementation object for this Control
protected EventCallbacks createEventCallbacks()
{
return new HardTotalsCallbacks();
}
// Store the reference to the Device Service
protected void setDeviceService(BaseService service, int nServiceVersion)
throws JposException
{
// Special case: service == null to free references
if(service == null)
{
service12 = null;
service13 = null;
service14 = null;
service15 = null;
service16 = null;
service17 = null;
service18 = null;
service19 = null;
service110 = null;
service111 = null;
service112 = null;
service113 = null;
service114 = null;
}
else
{
// Make sure that the service actually conforms to the interfaces it
// claims to.
if(serviceVersion >= deviceVersion12)
{
try
{
service12 = (HardTotalsService12)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService12 interface",
e);
}
}
if(serviceVersion >= deviceVersion13)
{
try
{
service13 = (HardTotalsService13)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService13 interface",
e);
}
}
if(serviceVersion >= deviceVersion14)
{
try
{
service14 = (HardTotalsService14)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService14 interface",
e);
}
}
if(serviceVersion >= deviceVersion15)
{
try
{
service15 = (HardTotalsService15)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService15 interface",
e);
}
}
if(serviceVersion >= deviceVersion16)
{
try
{
service16 = (HardTotalsService16)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService16 interface",
e);
}
}
if(serviceVersion >= deviceVersion17)
{
try
{
service17 = (HardTotalsService17)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService17 interface",
e);
}
}
if(serviceVersion >= deviceVersion18)
{
try
{
service18 = (HardTotalsService18)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService18 interface",
e);
}
}
if(serviceVersion >= deviceVersion19)
{
try
{
service19 = (HardTotalsService19)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService19 interface",
e);
}
}
if(serviceVersion >= deviceVersion110)
{
try
{
service110 = (HardTotalsService110)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService110 interface",
e);
}
}
if(serviceVersion >= deviceVersion111)
{
try
{
service111 = (HardTotalsService111)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService111 interface",
e);
}
}
if(serviceVersion >= deviceVersion112)
{
try
{
service112 = (HardTotalsService112)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService112 interface",
e);
}
}
if(serviceVersion >= deviceVersion113)
{
try
{
service113 = (HardTotalsService113)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService113 interface",
e);
}
}
if(serviceVersion >= deviceVersion114)
{
try
{
service114 = (HardTotalsService114)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement HardTotalsService114 interface",
e);
}
}
}
}
//--------------------------------------------------------------------------
// Event Listener Methods
//--------------------------------------------------------------------------
public void addDirectIOListener(DirectIOListener l)
{
synchronized(directIOListeners)
{
directIOListeners.addElement(l);
}
}
public void removeDirectIOListener(DirectIOListener l)
{
synchronized(directIOListeners)
{
directIOListeners.removeElement(l);
}
}
public void addStatusUpdateListener(StatusUpdateListener l)
{
synchronized(statusUpdateListeners)
{
statusUpdateListeners.addElement(l);
}
}
public void removeStatusUpdateListener(StatusUpdateListener l)
{
synchronized(statusUpdateListeners)
{
statusUpdateListeners.removeElement(l);
}
}
//--------------------------------------------------------------------------
// EventCallbacks inner class
//--------------------------------------------------------------------------
protected class HardTotalsCallbacks
implements EventCallbacks
{
public BaseControl getEventSource()
{
return (BaseControl)HardTotals.this;
}
public void fireDataEvent(DataEvent e)
{
}
public void fireDirectIOEvent(DirectIOEvent e)
{
synchronized(HardTotals.this.directIOListeners)
{
// deliver the event to all registered listeners
for(int x = 0; x < directIOListeners.size(); x++)
{
((DirectIOListener)directIOListeners.elementAt(x)).directIOOccurred(e);
}
}
}
public void fireErrorEvent(ErrorEvent e)
{
}
public void fireOutputCompleteEvent(OutputCompleteEvent e)
{
}
public void fireStatusUpdateEvent(StatusUpdateEvent e)
{
synchronized(HardTotals.this.statusUpdateListeners)
{
// deliver the event to all registered listeners
for(int x = 0; x < statusUpdateListeners.size(); x++)
{
((StatusUpdateListener)statusUpdateListeners.elementAt(x)).statusUpdateOccurred(e);
}
}
}
}
}