8-34 Developers Guide for Oracle Business Intelligence Publisher
Example 8–34 Sample Code for Setting Global Properties
create delivery manager instance DeliveryManager dm = new DeliveryManager;
set global properties dm.addPropertyDeliveryPropertyDefinitions.TEMP_DIR, tmp;
dm.addPropertyDeliveryPropertyDefinitions.BUFFERING_MODE, true; create delivery requests
DeliveryRequest req1 = dm.createRequestDeliveryManager.TYPE_IPP_PRINTER; DeliveryRequest req2 = dm.createRequestDeliveryManager.TYPE_IPP_FAX;
DeliveryRequest req3 = dm.createRequestDeliveryManager.TYPE_SMTP_EMAIL; :
:
8.20 Adding a Custom Delivery Channel
You can add custom delivery channels to the system by following the steps below:
1.
Define the delivery properties
2.
Implement the DeliveryRequest interface
3.
Implement the DeliveryRequestHandler interface
4. Implement the DeliveryRequestFactory interface
5. Register your custom DeliveryRequestFactory to the DeliveryManager
The following sections detail how to create a custom delivery channel by creating a sample called File delivery channel that delivers documents to the local file system.
8.20.1 Define Delivery Properties
The first step to adding a custom delivery channel is to define the properties. These will vary depending on what you want your channel to do. You can define constants
for your properties. Our example, a file delivery channel requires only one property, which is the destination.
Sample code is:
Example 8–35 Sample Code for Defining Delivery Channel Properties
package oracle.apps.xdo.delivery.file; public interface FilePropertyDefinitions
{
Table 8–13 Global Properties Supported by the DeliveryManager API
Property Description
BUFFERING_MODE Valid values are true default and false. See
Section 8.14, Direct and Buffering Modes.
TEMP_DIR Define the location of the temporary directory.
CA_CERT_FILE Define the location of the CA Certificate file generated by
Oracle Wallet Manager. This is used for SSL connection with the Oracle SSL library. If not specified, the default CA
Certificates are used.
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;