2. Where to Start

This section tells you about the Destination class and how it can be implemented to create your own destination.

To create your own destination, you need to implement a Destination class. Oracle9i JDeveloper contained in Oracle9i Developer Suite, provides a wizard to help you to develop a new destination. You can see this wizard in action in this viewlet.

 

2.1 Implementing the Destination class

The Destination class is the class used by the Reports Server to push a reports output to a specific destination. You can find the Destination Java API documentation here.

The most common overrided methods are:

1. init(java.util.Properties destProps)

Initializes the destination during the startup of the server. You can use this method to set all static information that you can load from the Reports Server configuration file. (server.conf file in the $ORACLE_HOME/reports/config directory). The properties object that the method receives as parameter contains the list of values that you have in the configuration file. (see Integration with Reports section)

In the FTP destination, we use this method to load the information about the proxy configuration.

2. start(java.util.Properties props, java.lang.String desname, int totalFile, long totalSize, short mainFormat)

Starts the destination job process. When Oracle9iAS Reports Services sends the job to the Destination, it calls the start() method. The start() method receives all parameters from the job. This method is called one time per job submit. If this method return 'false' other methods are not executed.

The Properties object contains all parameters of the Job.

In the FTP Destination sample we use the start() method to

  • Open a FTP connection
  • Navigate to the directory specified by the user. If the directory structure does not exist the FTP Destination automatically creates it.

3. sendFile(boolean main, java.lang.String fileName, short fileFormat, long fileSize)

Sends the report output to the destination. The server calls this method for each file of the job.

Note that a job can have more that one file. For example, a reports HTML output could contains several files, one for the HTML file itself and one file per image used by the page.

In the FTP Destination, we use this method to write the files to the server using the standard FTP command "PUT".

4. stop()

Stops the destination. The stop() method is called by the server at the end of the job execution. You use this method to release some resource that you reserve for a specific job.

In the FTP Destination, we use this method to close the FTP connection.

5. shutdown()

Call during the shutdown of the server, you use this method to release global resource.

 

2.2. Phases of Destination methods call sequence

 Calling Sequence of methods:

init() -- called on server startup
foreach job
{
start() -- called on start of distribution of job to this destination
foreach file in job
{
sendFile() -- call to send each file to the destination
}
stop() -- called on end of job to this destination
}
shutdown() -- called on server shutdown


 

 


Copyright © 2002, Oracle Corporation. All rights reserved.