8-18 Developers Guide for Oracle Business Intelligence Publisher
8.8 Delivering Your Document over the File Transfer Protocol FTP
The following is sample code for delivery to an FTP server:
Example 8–14 Sample Code for Delivering Documents over FTP
create delivery manager instance DeliveryManager dm = new DeliveryManager;
create a delivery request DeliveryRequest req = dm.createRequestDeliveryManager.TYPE_FTP;
set hostname of the FTP server req.addPropertyDeliveryPropertyDefinitions.FTP_HOST, myftphost;
set port of the FTP server req.addPropertyDeliveryPropertyDefinitions.FTP_PORT, 21;
set username and password to access WebDAV server req.addPropertyDeliveryPropertyDefinitions.FTP_USERNAME, xdo;
req.addPropertyDeliveryPropertyDefinitions.FTP_PASSWORD, xdo; set the remote directory that you want to send your document to
req.addPropertyDeliveryPropertyDefinitions.FTP_REMOTE_DIRECTORY, pub; set the remote file name
req.addPropertyDeliveryPropertyDefinitions.FTP_REMOTE_FILENAME, test.pdf; set the document
req.setDocumentdocumenttest.pdf; submit the request
req.submit; close the request
req.close;
The following properties are supported. A String value is required unless otherwise noted.
WEBDAV_ENCTYPE Optional
Valid values for encryption type are: WEBDAV_ENCTYPE_NONE - no encryption default
WEBDAV_ENCTYPE_SSL - use Secure Socket Layer WEBDAV_USE_FULL_
URL Optional
Set to true to send the full URL for the HTTP request header. Valid values are true or false default.
WEBDAV_USE_ CHUNKED_BODY
Optional Valid values are true default to use HTTP chunked transfer
coding for the message body, or false. WEBDAV_URL_
CHARACTER_ ENCODING
Encoding of the URL. It will be used if you use non-ASCII characters in the URL. Set the Java-supported encoding string
for the value.
Table 8–7 Properties for Delivering Documents over FTP
Property Description
FTP_HOST Required
Enter the server host name.
Table 8–6 Cont. Properties for Delivering Documents to WebDAV Servers
Property Description
Using the Delivery Manager Java APIs 8-19
8.9 Delivering Your Documents over Secure FTP
Secure FTP is the protocol based on the Secure Shell technology ssh and it is widely used to transfer files in a secure manner. Both Secure Shell and Secure FTP are defined
by the Internet Engineering Task Force IETF and the specifications are available on their Web site:
http:www.ietf.org . The delivery system supports the delivery of
documents to secure FTP servers. The following tables lists the supported properties. A string value is required for each
property unless otherwise noted.
Example 8–15 Sample Code for Delivering Documents over SFTP
create delivery manager instance DeliveryManager dm = new DeliveryManager;
create a delivery request DeliveryRequest req = dm.createRequestDeliveryManager.TYPE_SFTP;
set hostname of the SFTP server req.addPropertyDeliveryPropertyDefinitions.SFTP_HOST, mysftphost;
set username and password to access server req.addPropertyDeliveryPropertyDefinitions.SFTP_USERNAME, myname;
req.addPropertyDeliveryPropertyDefinitions.SFTP_PASSWORD, mypassword; set the remote directory that you want to send your document to
req.addPropertyDeliveryPropertyDefinitions.SFTP_REMOTE_DIRECTORY, pub; set the remote file name
req.addPropertyDeliveryPropertyDefinitions.SFTP_REMOTE_FILENAME, test.pdf;
set the document req.setDocumentdocumenttest.pdf;
submit the request req.submit;
close the request req.close;
FTP_PORT Optional
Enter the server port number. Default is 21. FTP_USERNAME
Required Enter the login user name to the FTP server.
FTP_PASSWORD Required
Enter the login password to the FTP server. FTP_REMOTE_
DIRECTORY Required
Enter the directory to which to deliver the document example: pub
FTP_REMOTE_ FILENAME
Required Enter the document file name for the remote server.
FTP_BINARY_MODE Optional
Valid values are true default or false. FTP_PASSIVE_MODE
Optional Valid values are true or false default.
Table 8–7 Cont. Properties for Delivering Documents over FTP
Property Description
8-20 Developers Guide for Oracle Business Intelligence Publisher
8.9.1 Authentication Modes
The secure FTP delivery supports two authentication modes: password authentication and public key authentication. Set the property SFTP_AUTH_TYPE to choose the
mode. The default mode is password authentication.
The password authentication mode requires the username and password to log in to the secure FTP server. The following example shows sample code:
Example 8–16 Sample Code for Password Authentication
: :
set password auth type req.addPropertyDeliveryPropertyDefinitions.SFTP_AUTH_TYPE,
DeliveryPropertyDefinitions.SFTP_AUTH_TYPE_PASSWORD; set username and password to access server
req.addPropertyDeliveryPropertyDefinitions.SFTP_USERNAME, myname; req.addPropertyDeliveryPropertyDefinitions.SFTP_PASSWORD, mypassword;
: :
Table 8–8 Properties for Delivering Documents over SFTP
Property Description
SFTP_HOST Required
Enter the target server host name. SFTP_PORT
Optional Enter the target server SSH port number. Default is 22.
SFTP_USERNAME Required
Enter the login user name. SFTP_PASSWORD
Required if you choose the SFTP_AUTH_TYPE_PASSWORD authentication type.
Enter the login password. SFTP_REMOTE_
DIRECTORY Required
Enter the directory to which to deliver the document example: pub. If no value is entered, the document will be delivered
to the login directory. SFTP_REMOTE_
FILENAME Required
Enter the document file name on the remote server. SFTP_AUTH_TYPE
Set either of the following: SFTP_AUTH_TYPE_PASSWORD Default Requires providing
password at login. SFTP_AUTH_TYPE_PUBLIC_KEY - public key authorization
type. SFTP_PRIVATE_KEY_FILE Enter the client private key file. Required if you choose SFTP_
AUTH_TYPE_PUBLIC_KEY. SFTP_PRIVATE_KEY_
PASSWORD Enter the client private key password. Required if you choose
SFTP_AUTH_TYPE_PUBLIC_KEY. SFTP_FILE_PERMISSION
Enter the permissions to set for the file being created. Default is 0755.