BEA Systems, Inc.

com.bea.rfid.workflow.print
Class PrintTag

java.lang.Object
  extended by com.bea.rfid.workflow.print.PrintTag

public class PrintTag
extends Object

Java class for programing tags for specified EPC class or with the specified EPC. This manages the creation and definition of PCSpec, as needed. When it receives a request to print a tag for a type for which there is no PCSpec defined, it will send out a request for PCSpec to the registered observer. When it receives a PCSpec back, it defines the PCSpec in the ALEPC engine and does a poll to program the tag.


Constructor Summary
PrintTag(com.connecterra.alepc.api.ALEPC alepc, com.connecterra.alepc.api.ALEPCFactory alepcFactory, Timer timer)
          Constructor.
 
Method Summary
 void print(String inStr)
          Prints an EPC based on the input string.
 void printSetup(String inStr)
          This method should be used to set up PCSpec for the input EPC class.
 void receivePCSpec(com.connecterra.alepc.api.PCSpec pcspec)
          Used to send a PCSpec back to this for a PCSpec request.
 void setPCSpecNamePrefix(String pcspecNamePrefix)
          The prefix that will be used on the automatically generated PCSpec name.
 void setPCSpecNameSuffix(String pcspecNameSuffix)
          The suffix that will be used on the automatically generated PCSpec name.
 void setPrinterName(String printerName)
          Specifies the printer name that will be used to program tags, if none is specified in the PCSpec that this receives.
 void setPrintObserver(PrintObserver printObserver)
          Registers an observer with this.
 void setPrintParameters(Map parameters)
          Stores the print parameters that will be used by the next print operation.
 void setTimeoutDuration(long duration)
          Specifies the timeout to wait for receiving PCSpecs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintTag

public PrintTag(com.connecterra.alepc.api.ALEPC alepc,
                com.connecterra.alepc.api.ALEPCFactory alepcFactory,
                Timer timer)
Constructor.

Parameters:
alepc - the instance of ALEPC to use for programming tags
alepcFactory - ALEPC factory for creating ALEPC objects
timer - java.util.Timer instance to use for setting up timeouts (for example, timeout to receive PCSpec)
Method Detail

print

public void print(String inStr)
           throws com.connecterra.ale.api.ALEException,
                  RemoteException,
                  InterruptedException,
                  URISyntaxException,
                  com.connecterra.ale.epc.EPCException
Prints an EPC based on the input string. If the input is an EPC tag URI, this will program a tag with the EPC tag value. if this is an EPC pattern string this will:

Parameters:
inStr - input string value, for which tag should be programmed
Throws:
com.connecterra.ale.epc.EPCException - if the input string is not a valid EPC or EPC pattern
URISyntaxException - if the input string is not a valid URI
RemoteException - if a remote exception occurs trying to define PCSpec or programming the tag
com.connecterra.ale.api.ALEException - if ALE exception occurs trying to define PCSpec or programming the tag
InterruptedException - if interrupted exception occurs trying to program the tag

setPrintParameters

public void setPrintParameters(Map parameters)
Stores the print parameters that will be used by the next print operation.

Parameters:
parameters - Map of string to string with the parameters to use in the next print operation. See ALEPC.poll(pcspecName, Map) for exact syntax of these parameters.

printSetup

public void printSetup(String inStr)
                throws com.connecterra.ale.api.ALEException,
                       URISyntaxException,
                       com.connecterra.ale.epc.EPCException
This method should be used to set up PCSpec for the input EPC class. If a PCSpec is already set up for the input, it will still be set up again. Request for PCSpec will be sent out to listeners and the new PCSpec received will be defined with the ALEPC instance.

Parameters:
inStr - string with the EPC class for which PCSpec is to be set up. This must be an EPC pattern URI. The EPC class part will be extracted out of the input.
Throws:
com.connecterra.ale.epc.EPCException - if the input is not a valid EPC or EPC pattern
URISyntaxException - if the input is not a valid URI
com.connecterra.ale.api.ALEException

receivePCSpec

public void receivePCSpec(com.connecterra.alepc.api.PCSpec pcspec)
                   throws com.connecterra.ale.api.ALEException,
                          com.connecterra.alepc.api.PCSpecValidationException,
                          com.connecterra.alepc.api.NoSuchCacheException,
                          RemoteException,
                          InterruptedException
Used to send a PCSpec back to this for a PCSpec request. The received PCSpec must have the EPC class in the application data. If this receives a PCSpec that it is not waiting for, it will be simply ignored.

Parameters:
pcspec - PCSpec for a pcspec request
Throws:
RemoteException - if remote exception occurs trying to define or use the input PCSpec
com.connecterra.alepc.api.NoSuchCacheException - if the cache specified in the input PCSpec does not exist with the ALEPC instance
com.connecterra.alepc.api.PCSpecValidationException - if the PCSpec received in invalid
com.connecterra.ale.api.ALEException - if an ALE exception occurs trying to define or use the PCSpec
InterruptedException - if an interrupted exception occurs trying to program tag using the PCSpec

setPrintObserver

public void setPrintObserver(PrintObserver printObserver)
Registers an observer with this. The observer will be notified with PCSpec requests and result of print tag operation.

Parameters:
printObserver - the observer that is to be registered with this PrintTag

setPCSpecNamePrefix

public void setPCSpecNamePrefix(String pcspecNamePrefix)
The prefix that will be used on the automatically generated PCSpec name. The PCSpec name will contain the EPC class, with this prefix and any suffix specified.

Parameters:
pcspecNamePrefix - string with the prefix for the PCSpec name

setPCSpecNameSuffix

public void setPCSpecNameSuffix(String pcspecNameSuffix)
The suffix that will be used on the automatically generated PCSpec name. The PCSpec name will contain the EPC class, with prefix, if any specified and this suffix.

Parameters:
pcspecNameSuffix - string with the suffix for the PCSpec name

setPrinterName

public void setPrinterName(String printerName)
Specifies the printer name that will be used to program tags, if none is specified in the PCSpec that this receives. The printer name must be a valid logical reader defined in the ALEPC instance.

Parameters:
printerName - logical reader name, defined with ALEPC, of the printer that is to be used to program tags

setTimeoutDuration

public void setTimeoutDuration(long duration)
Specifies the timeout to wait for receiving PCSpecs. The default value is 0, which means infinite.

Parameters:
duration - the timeout duration. 0 or negative values are treated as infinite.

Documentation is available at
${DOCSWEBROOT}
Copyright 2007 BEA Systems Inc.