com.ibm.dse.services.fpprint
Class FormsPathService

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.services.fpprint.FormsPathService

public class FormsPathService
extends Service
implements PrintService, com.qic.FPPrint.FPListener

The FormsPathService class implements the interface of a print service using the FormsPath. It has two different ways of working: through named pipes (mode="pipe") or through files (mode="file").

See Also:
Serialized Form

Field Summary
protected  java.util.Vector aFPPrintListener
          Contains a set of Listener of FPEvent event.
static java.lang.String COMPID
          The component id.
 
Fields inherited from class com.ibm.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Constructor Summary
FormsPathService()
          This constructor creates a FormsPathService object.
FormsPathService(java.lang.String aName)
          This constructor creates a FormsPathService object.
 
Method Summary
 void addHandler(Handler aHandler, java.lang.String anEventName)
          Adds a aHandler to the chain of handlers for the specific instance of DSENotifier.
protected  void firePrintJobCompleted(com.qic.FPPrint.FPEvent arg1)
          Supports listener events.
 java.util.Vector getJobListPrintingResults()
          Returns a vector of keyed collections, which contains the information available for each of the jobs that have been sent to the printer.
 KeyedCollection getJobResult(long aJobId)
          Returns a keyed collection with all the available information for a job, given its identifier.
 int getJobsCurrentlyProcessing()
          Returns the number of jobs that have not been completed yet.
 long getJobsListQueueLength()
          Gets the JobListQueueLength attribute.
 int getStatus()
          Returns the current status of the printer.
 void initialize()
          Initializes the printer device.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a FormsPath service object with the Tag attributes.
 boolean isJobCompleted(long aJobId)
          Returns true if the job with a given ID has already been printed.
 long printForm(FormsRecordFormat aFormat, Context aContext)
          Formats a context with a given format of type FormsRecordFormat and then performs the asynchronous print with the resulting String.
 long printForm(java.lang.String data)
          Performs the asynchronous print.
 long printForm(java.lang.String aFormatName, Context aContext)
          Performs the asynchronous print.
 void printFormAndWait(FormsRecordFormat aFormat, Context aContext)
          Formats a context with a format of type FormsRecordFormat and then performs the synchronous print with the resulting String.
 void printFormAndWait(java.lang.String data)
          Performs the synchronous print operation.
 void printFormAndWait(java.lang.String aFormatName, Context aContext)
          Instantiates a FormsRecordFormat, given its name, and uses it to format a context.
 void printJobCompleted(com.qic.FPPrint.FPEvent event)
          Handles the com.qic.FPPrint.FPEvent.
 void removeFPPrintListener(com.qic.FPPrint.FPListener newListener)
          Removes a FPPrint.FPPrintListener.
 void setFilePath(java.lang.String aFilePath)
          Sets the file path attribute.
 void setFormName(java.lang.String aFormName)
          Sets the compiledFormName property.
 void setMode(java.lang.String aMode)
          Sets the mode attribute.
 void setPrinterName(java.lang.String aPrinterName)
          Sets the printerName property.
 void setServerName(java.lang.String param1)
          Sets the serverName property.
 void shutdown()
          Closes the print service, which means that no more jobs are going to be printed.
 java.lang.String toString()
          Returns an XML representation of this print service.
 
Methods inherited from class com.ibm.dse.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, terminate, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.dse.base.DSENotifier
getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

aFPPrintListener

protected transient java.util.Vector aFPPrintListener
Contains a set of Listener of FPEvent event.

COMPID

public static final java.lang.String COMPID
The component id. Is used in the trace facilities.
Constructor Detail

FormsPathService

public FormsPathService()
This constructor creates a FormsPathService object.

FormsPathService

public FormsPathService(java.lang.String aName)
                 throws java.io.IOException
This constructor creates a FormsPathService object.
Parameters:
aName - java.lang.String, the value to the name attribute of DSENotifier
Throws:
java.io.IOException -  
Method Detail

addHandler

public void addHandler(Handler aHandler,
                       java.lang.String anEventName)
                throws DSEInvalidArgumentException
Adds a aHandler to the chain of handlers for the specific instance of DSENotifier.

The handler is located in the first position of the chain so it will be the first handler to receive the event when signaled.

The handler is added to the chain of handlers using this operation and is registered for the event anEventName to be signaled by the DSENotifier. If it is interested in any event signaled by this notifier then the event name must be set to "allEvents". This method generates a DSEInvalidArgumentException when aHandler, or anEventName, is null.

Overrides:
addHandler in class DSENotifier
Parameters:
aHandler - Handler
anEventName - String
Throws:
DSEInvalidArgumentException -  

firePrintJobCompleted

protected void firePrintJobCompleted(com.qic.FPPrint.FPEvent arg1)
Supports listener events.
Returns:
arg1 com.qic.FPPrint.FPEvent - the event to fire

getJobListPrintingResults

public java.util.Vector getJobListPrintingResults()
Returns a vector of keyed collections, which contains the information available for each of the jobs that have been sent to the printer.
Specified by:
getJobListPrintingResults in interface PrintService
Returns:
java.util.Vector - the vector that is requested

getJobResult

public KeyedCollection getJobResult(long aJobId)
                             throws DSEJobNotFoundException
Returns a keyed collection with all the available information for a job, given its identifier. If the job ID does not exist, it must throw a DSEJobNotFoundException.
Specified by:
getJobResult in interface PrintService
Parameters:
jobId - long, the long that represents the job ID
Returns:
com.ibm.dse.base.KeyedCollection - the Keyed collection that is requested
Throws:
DSEJobNotFoundException -  

getJobsCurrentlyProcessing

public int getJobsCurrentlyProcessing()
Returns the number of jobs that have not been completed yet.
Specified by:
getJobsCurrentlyProcessing in interface PrintService
Returns:
int - the number of jobs that have not yet been completed

getJobsListQueueLength

public long getJobsListQueueLength()
Gets the JobListQueueLength attribute.
Returns:
long - the value of attribute

getStatus

public int getStatus()
Returns the current status of the printer.
Specified by:
getStatus in interface PrintService
Returns:
int - the value that represents the current status of the printer. Possible values are:

ERROR (-1): Printer has not been correctly initialized.

OK (0): Printer has been initialized.

RESET (1): The printer has been shutdown. This is the initial status of the printer.


initialize

public void initialize()
                throws DSEPrinterException
Initializes the printer device. If an error occurs, this method throws a DSEPrinterException.
Specified by:
initialize in interface PrintService
Throws:
DSEPrinterException -  

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws DSEInvalidArgumentException
Initializes a FormsPath service object with the Tag attributes. This method throws a DSEInvalidArgumentException if the attribute named jobsListQueueLength does not have a minimum value of 10.
Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.dse.base.Tag, the Tag
Returns:
java.lang.Object - the initialized service
Throws:
DSEInvalidArgumentException -  

isJobCompleted

public boolean isJobCompleted(long aJobId)
                       throws DSEJobNotFoundException
Returns true if the job with a given ID has already been printed. If the jobId doesn't exist, this method throws a DSEJobNotFoundException.
Specified by:
isJobCompleted in interface PrintService
Parameters:
jobId - long, the long that represents the job ID about which we want to ask
Returns:
boolean - true or false
Throws:
DSEJobNotFoundException -  

printForm

public long printForm(FormsRecordFormat aFormat,
                      Context aContext)
               throws DSEPrinterException,
                      DSEException
Formats a context with a given format of type FormsRecordFormat and then performs the asynchronous print with the resulting String. If there is any problem trying to access the printing server, or if the print service has not been initialized a DSEPrinterException is thrown.
Specified by:
printForm in interface PrintService
Parameters:
aFormat - com.ibm.dse.services.formsprint.FormsRecordFormat, the provided format
aContext - com.ibm.dse.base.Context, the context to be formated
Returns:
long - the identifier of the job that is being sent to the printer
Throws:
DSEPrinterException, - DSEException

printForm

public long printForm(java.lang.String data)
               throws DSEPrinterException
Performs the asynchronous print. Receives the string already formatted for the FormsPath prining server, sends it to the server and returns the identifier of the job. If the printer has not been properly initialized, or if there is any problem accessing the server a DSEPrinterException is thrown.
Specified by:
printForm in interface PrintService
Parameters:
data - java.lang.String, the data that must be sent to the printer
Returns:
long - the identifier of the job that is being sent to the printer
Throws:
DSEPrinterException -  

printForm

public long printForm(java.lang.String aFormatName,
                      Context aContext)
               throws DSEPrinterException,
                      DSEException,
                      java.io.IOException
Performs the asynchronous print. It receives the format name and the context, and after instantiating the format, it formats the data to be sent to the printer. If there is any problem trying to access the printer device, a DSEPrinterException is thrown.
Specified by:
printForm in interface PrintService
Parameters:
aFormatName - java.lang.String, the name of the FormsRecordFormat format to instantiate
aContext - com.ibm.dse.base.Context, the context to be formated
Returns:
long - the identifier of the job that is being sent to the printer
Throws:
DSEPrinterException, - DSEException, java.io.IOException

printFormAndWait

public void printFormAndWait(FormsRecordFormat aFormat,
                             Context aContext)
                      throws DSEPrinterException,
                             DSEException
Formats a context with a format of type FormsRecordFormat and then performs the synchronous print with the resulting String.
Specified by:
printFormAndWait in interface PrintService
Parameters:
aFormat - com.ibm.dse.services.formsprint.FormsRecordFormat, the provided format
aContext - com.ibm.dse.base.Context, the context to be formated
Throws:
DSEPrinterException, - DSEException

printFormAndWait

public void printFormAndWait(java.lang.String data)
                      throws DSEPrinterException
Performs the synchronous print operation. Receives the string already formatted for the FormsPath server and sends it to the server. If the printer has not been initialized or if there is any problem accessing the server, a DSEPrinterException is thrown.
Specified by:
printFormAndWait in interface PrintService
Parameters:
data - java.lang.String, the data that must be sent to the printer device
Throws:
DSEPrinterException -  

printFormAndWait

public void printFormAndWait(java.lang.String aFormatName,
                             Context aContext)
                      throws DSEPrinterException,
                             DSEException,
                             java.io.IOException
Instantiates a FormsRecordFormat, given its name, and uses it to format a context. It then performs the synchronous print with the resulting String.
Specified by:
printFormAndWait in interface PrintService
Parameters:
aFormatName - java.lang.String, the name of the FormsRecordFormat to instantiate
aContext - com.ibm.dse.base.Context, the context to be formated
Throws:
DSEPrinterException, - DSEException, java.io.IOException

printJobCompleted

public void printJobCompleted(com.qic.FPPrint.FPEvent event)
Handles the com.qic.FPPrint.FPEvent.
Specified by:
printJobCompleted in interface com.qic.FPPrint.FPListener
Parameters:
event - com.qic.FPPrint.FPEvent, the event to handle

removeFPPrintListener

public void removeFPPrintListener(com.qic.FPPrint.FPListener newListener)
Removes a FPPrint.FPPrintListener.
Parameters:
newListener - com.qic.FPPrint.FPListener, the Listener to remove

setFilePath

public void setFilePath(java.lang.String aFilePath)
Sets the file path attribute.
Parameters:
aName - java.lang.String, the file path value

setFormName

public void setFormName(java.lang.String aFormName)
Sets the compiledFormName property.
Specified by:
setFormName in interface PrintService
Parameters:
aFormName - java.lang.String, the compiled form name

setMode

public void setMode(java.lang.String aMode)
Sets the mode attribute.
Parameters:
aMode - java.lang.String, the mode value

setPrinterName

public void setPrinterName(java.lang.String aPrinterName)
Sets the printerName property.
Specified by:
setPrinterName in interface PrintService
Parameters:
aPrinterName - java.lang.String, the resource name of the printer

setServerName

public void setServerName(java.lang.String param1)
Sets the serverName property.
Specified by:
setServerName in interface PrintService
Parameters:
param1 - java.lang.String, the hostname of the quality printing server

shutdown

public void shutdown()
Closes the print service, which means that no more jobs are going to be printed.
Specified by:
shutdown in interface PrintService

toString

public java.lang.String toString()
Returns an XML representation of this print service.
Overrides:
toString in class Service
Returns:
java.lang.String, the XML representation