com.ibm.dse.services.jfprint
Class JetFormService

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.services.jfprint.JetFormService

public class JetFormService
extends Service
implements PrintService

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

See Also:
Serialized Form

Field Summary
static int COMPLETED_JOB
          State of a job.
static int ERROR
          State of the printer.
static int OK
          State of the printer.
static int PROCESSING_JOB
          State of a job.
static int RESET
          State of the printer.
 
Fields inherited from class com.ibm.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Constructor Summary
JetFormService()
          This constructor creates a JetFormService object.
 
Method Summary
 java.util.Vector getJobListPrintingResults()
          Returns a list with the information available for each job that has been sent to the printer.
 KeyedCollection getJobResult(long jobId)
          Returns a keyed collection with all of the available information for a job, given its identifier.
 int getJobsCurrentlyProcessing()
          Returns the number of jobs that have not yet been completed.
 int getStatus()
          Returns the current status of the printer.
 void initialize()
          Implements the initialize method of the PrintService API.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a DiskFormsPrint 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)
          Performs the synchronous print.
 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 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 setPipeName(java.lang.String aName)
          Sets the pipe name attribute.
 void setPrinterName(java.lang.String aPrinterName)
          Sets the printerName property.
 void setServerName(java.lang.String aServerName)
          Sets the serverName.
 void shutdown()
          Shuts down the print service.
 java.lang.String toString()
          Returns an SGML representation of this 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
addHandler, 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

ERROR

public static final int ERROR
State of the printer. The printer has not been correctly initialized.

OK

public static final int OK
State of the printer. The printer has been initialized.

RESET

public static final int RESET
State of the printer. The printer has been shutdown. This is the initial status of the printer.

PROCESSING_JOB

public static final int PROCESSING_JOB
State of a job. The job has not been finished yet.

COMPLETED_JOB

public static final int COMPLETED_JOB
State of a job. The job has already been finished.
Constructor Detail

JetFormService

public JetFormService()
This constructor creates a JetFormService object.
Method Detail

getJobListPrintingResults

public java.util.Vector getJobListPrintingResults()
Returns a list with the information available for each job that has been sent to the printer.
Specified by:
getJobListPrintingResults in interface PrintService
Returns:
java.util.Vector - the list that is required

getJobResult

public KeyedCollection getJobResult(long jobId)
                             throws DSEJobNotFoundException
Returns a keyed collection with all of 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 yet been completed.
Specified by:
getJobsCurrentlyProcessing in interface PrintService
Returns:
int - the number of jobs that have not yet been completed

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
Implements the initialize method of the PrintService API. If there is an error while initializing the printer, this method must throw a DSEPrinterException.
Specified by:
initialize in interface PrintService
Throws:
DSEPrinterException -  

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws DSEInvalidArgumentException
Initializes a DiskFormsPrint object with the Tag attributes.
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.
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 JetForm printing 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 device
Returns:
long - the identifier of the job that is being sent to the printer
Throws:
DSEPrinterException - - if the job could not be sent to the printer or the printer is not initialized.

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. After instantiating the format, it formats the data to be sent to the printer. If the attempt to access the printer device is unsuccessful, 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
Performs the synchronous print. It receives the format and the context that formats the data, which is sent to the printer. If the attempt to access the printer device is unsuccessful, a DSEPrinterException is thrown.
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 JetForm printing 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 format to instantiate
aContext - com.ibm.dse.base.Context, the context to be formated
Throws:
DSEPrinterException, - DSEException, java.io.IOException

setFilePath

public void setFilePath(java.lang.String aFilePath)
Sets the file path attribute.
Parameters:
aFilePath - 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

setPipeName

public void setPipeName(java.lang.String aName)
Sets the pipe name attribute.
Parameters:
aName - java.lang.String, the pipe name 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 aServerName)
Sets the serverName.
Specified by:
setServerName in interface PrintService
Parameters:
aServerName - java.lang.String, the hostname of the quality printing server

shutdown

public void shutdown()
Shuts down the print service.
Specified by:
shutdown in interface PrintService

toString

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