8-30 Developers Guide for Oracle Business Intelligence Publisher
8.14.2 Buffering Mode
The buffering mode enables you to redeliver documents as many times as you want. The delivery system uses temporary files to buffer documents, if you specify a
temporary directory ds-temp-dir in the delivery server configuration file. If you do not specify a temporary directory, the delivery system uses the temporary memory
buffer. It is recommended that you define a temporary directory. For more information about the configuration file, see
Section 8.21, Configuration File Support. You can explicitly clear the temporary file or buffer by calling
DeliveryRequest.close after finishing your delivery request.
Example 8–27 Sample Code for Setting Buffering Mode
create delivery manager instance DeliveryManager dm = new DeliveryManager;
create a delivery request DeliveryRequest req = dm.createRequestDeliveryManager.TYPE_IPP_PRINTER;
set buffering mode req.addPropertyDeliveryPropertyDefinitions.BUFFERING_MODE, true;
req.addPropertyDeliveryPropertyDefinitions.TEMP_DIR, tmp; :
: :
submit request req.submit;
: :
submit request again req.submit;
: :
close the request req.close;
8.15 Asynchronous Delivery Requests
The Delivery API provides the ability to run the delivery requests asynchronously by registering the callback functions.
You can create your own callback logic by implementing the DeliveryResponseListener interface. You must implement the resposeReceived
method. You can implement your logic in this method so that it will be called when the delivery request is finished. Sample code is as follows:
Example 8–28 Sample Code for Implementing Callback Logic
import oracle.apps.xdo.delivery.DeliveryResponseListener; class MyListener implements DeliveryResponseListener
{ public void responseReceivedDeliveryResponse pResponse
{ Show the status to the System.out
System.out.printlnRequest done; System.out.printlnRequest status id : + pResponse.getStatus;
Using the Delivery Manager Java APIs 8-31
System.out.printlnRequest status msg : + pResponse.getStatusMessage; }
}
Once you implement the callback, you can pass your callback when you call the submit method of your DeliveryRequest. If you call the submit with the callback,
the delivery process will start in the background and the submit method will immediately return the control. Sample code follows:
Example 8–29 Sample Code for Submitting Callback Logic
create delivery manager instance DeliveryManager dm = new DeliveryManager;
create a delivery request DeliveryRequest req = dm.createRequestDeliveryManager.TYPE_IPP_PRINTER;
: :
submit request with the callback logic req.submitnew MyListener;
: :
8.16 Document Filter Support
The Delivery API supports the document filter functionality for all the supported protocols. This functionality enables you to call the native operating system OS
command to transform the document before each delivery request. To specify the filter, pass the native OS command string with the two placeholders for the input and
output filename: {infile} and {outfile}. You can set your filter in your delivery request as a delivery property. Following are two samples:
Example 8–30 Sample Code for Setting Document Filter as Delivery Property
The easiest filter, just copy the file : req.addPropertyDeliveryPropertyDefinitions.FILTER, cp {infile} {outfile};
Call pdftops utility to transform the PDF document into Postscript format req.addPropertyDeliveryPropertyDefinitions.FILTER, pdftops {infile}
{outfile};
Alternatively, you can also specify the filter for each server in the configuration file see
Section 8.21, Configuration File Support . In this case, the server will always use
this filter for the requests to this server:
Example 8–31 Sample Code for Setting Document Filter in Configuration File
: :
server name=printer1 type=ipp_printer default=true uriipp:myserver:80printersMyPrinter1.printeruri
filterpdftops {infile} {outfile}filter server
: :