Internationalization Support Setting Global Properties

Using the Delivery Manager Java APIs 8-35 Destination property definition. public static final String FILE_DESTINATION = FILE_DESTINATION:String; } The value of each constant can be anything, if it is a String. It is recommend that you define the value in[property name]:[property value type]format so that the delivery system automatically validates the property value at run time. In the example, the FILE_DESTINATION property is defined to have a String value.

8.20.2 Implement DeliveryRequest Interface

DeliveryRequest represents a delivery request that includes document information and delivery metadata, such as destination and other properties. To implement oracle.apps.xdo.delvery.DeliveryRequest you can extend the class oracle.apps.xdo.delivery.AbstractDeliveryRequest. For example, to create a custom delivery channel to deliver documents to the local file system, the DeliveryRequest implementation will be as follows: Example 8–36 Sample Code for Delivering Documents to a Local File System through a Custom Delivery Channel package oracle.apps.xdo.delivery.file; import oracle.apps.xdo.delivery.AbstractDeliveryRequest; public class FileDeliveryRequest extends AbstractDeliveryRequest implements FilePropertyDefinitions { private static final String[] MANDATORY_PROPS = {FILE_DESTINATION}; Returns mandatory property names public String[] getMandatoryProperties { return MANDATORY_PROPS; } Returns optional property names public String[] getOptionalProperties { return null; } }

8.20.3 Implement DeliveryRequestHandler Interface

DeliveryRequestHandler includes the logic for handling the delivery requests. A sample implementation of oracle.apps.xdo.delivery.DeliveryRequestHandler for the file delivery channel is as follows: Example 8–37 Sample Code for Implementing the DeliveryRequestHandler Interface package oracle.apps.xdo.delivery.file; import java.io.BufferedOutputStream; import java.io.File; 8-36 Developers Guide for Oracle Business Intelligence Publisher import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import oracle.apps.xdo.delivery.DeliveryException; import oracle.apps.xdo.delivery.DeliveryRequest; import oracle.apps.xdo.delivery.DeliveryRequestHandler; import oracle.apps.xdo.delivery.DeliveryStatusDefinitions; public class FileDeliveryRequestHandler implements DeliveryRequestHandler { private FileDeliveryRequest mRequest; private boolean mIsOpen = false; private OutputStream mOut; default constructor. public FileDeliveryRequestHandler { } sets the request. public void setRequestDeliveryRequest pRequest { mRequest = FileDeliveryRequest pRequest; } returns the request. public DeliveryRequest getRequest { return mRequest; } opens the output stream to the destination. public OutputStream openRequest throws DeliveryException { try { String filename = String mRequest.getPropertyFileDeliveryRequest.FILE_DESTINATION; mOut = new BufferedOutputStreamnew FileOutputStreamfilename; mIsOpen = true; set request status to open mRequest.setStatusDeliveryStatusDefinitions.STATUS_OPEN; return mOut; } catch IOException e { closeRequest; throw new DeliveryExceptione;