Publishing a BIRT report design to the Actuate Java Component
Actuate Java Components generate BIRT reports using BIRT report design (.rptdesign) files and their associated resource files. Actuate Java Components access BIRT report design and associated resource files from configurable locations on a file system.
The default location designated for BIRT report design files is the repository folder in the context root directory structure, as illustrated in Figure 2‑1.
Figure 2‑1 Actuate Java Component folder structure
To configure the repository location for publishing BIRTdesigns and documents, change the value of the STANDALONE_REPOSITORY_PATH parameter in the Actuate Java Component’s web.xml file. The web.xml file is in the following location:
<context root>/WEB-INF
The following code sets STANDALONE_REPOSITORY_PATH to the <context root>/WEB-INF/repository subfolder:
<context-param>
<param-name>STANDALONE_REPOSITORY_PATH</param-name>
<param-value>WEB-INF/repository</param-value>
</context-param>
BIRT_RESOURCE_PATH specifies the path to the shared resources for Actuate BIRT Java Components, including libraries, templates, properties, and Java archive (.jar) files for BIRT report designs. The default value is <context root>/WEB-INF/repository.
How to publish a BIRT report design to an Actuate Java Component
This procedure uses the default location of the Actuate Java Component repository.
1 Navigate to the application server’s directory for deployed web applications. For example, Apache Tomcat stores web applications in <Apache Tomcat root directory>/Tomcat 6.0/webapps.
2 In the web application directory, manually copy the BIRT report design to a directory in the following location:
<context root>/WEB-INF/repository
The installation provides default home and public directories, as shown in Figure 2‑1. All user directories are created in the repository/home directory.
3 To make a report design available to all users, place the file in a directory within:
<context root>/WEB-INF/repository/Public
4 To make a report design available to an individual user only, place the file in a directory within:
<context root>/WEB-INF/repository/Home/<user name>
5 Run the Actuate Java Component to access the report design.
Publishing a BIRT resource to an Actuate Java Component
You configure the repository for publishing a BIRT resource using the BIRT_RESOURCE_PATH parameter in an Actuate Java Component’s web.xml file. The web.xml file is in the following location:
<context root>/WEB-INF
The following code sets BIRT_RESOURCE_PATH to the <context root>/resources subfolder:
<context-param>
<param-name>BIRT_RESOURCE_PATH</param-name>
<param-value>resources</param-value>
</context-param>
BIRT_RESOURCE_PATH specifies the path to the shared resources for Actuate BIRT Java Components, including libraries, templates, properties, and Java archive (.jar) files for BIRT report designs. The default value is <context root>/resources.
If the BIRT report explicitly includes a resource such as a JAR file, library, CSS, a Flash (.swf) file, images, or JavaScript in the report design, then the resources need to be copied under the BIRT_RESOURCE_PATH folder to the correct relative path.
For example, if the images for your report are in the /images folder in your report design project, when you deploy the report, you copy the images to the <context root>/resources/images folder.
In cases when an Actuate BIRT report uses Java classes directly from JAR files, copy your JAR files to:
<context root>/scriptlib
How to publish a BIRT resource to an Actuate Java Component
1 Copy the resource file to the resource directory, defined in web.xml.
2 To test the resource, run the Actuate Java Component to execute and view a report that uses the resource.
Installing a custom JDBC driver in an Actuate Java Component
When you use an Actuate Java Component and an Actuate BIRT report uses a custom JDBC driver, you must install the JDBC driver in the following location:
<context root>/WEB-INF/platform/plugins/org.eclipse.birt.report.data.oda.jdbc_<VERSION>/drivers
Installing custom ODA drivers and custom plug-ins in an Actuate Java Component
All custom ODA drivers and custom plug-ins need to be installed in the following folder:
<context root>/WEB-INF/platform/plugins
Accessing BIRT report design and BIRT resources paths in custom ODA plug-ins
ODA providers often need to obtain information about a resource path defined in ODA consumer applications. For example, if you develop an ODA flat file data source, you can implement an option to look up the data files in a path relative to a resource folder managed by its consumer. Such resource identifiers are needed at both design-time and run-time drivers. ODA consumer applications are able to specify the following items as described in the next two sections:
*The run-time resource identifiers to pass o the ODA run-time driver in an application context map
*The design-time resource identifiers in a DataSourceDesign, as defined in an ODA design session model
Accessing resource identifiers in run-time ODA driver
For run time, the BIRT ODA run-time consumer passes its resource location information in a org.eclipse.datatools.connectivity.oda.util.ResourceIdentifiers instance in the appContext map. ODA run-time drivers can get the instance in any one of the setAppContext methods, such as IDriver.setAppContext. You can use resource identifiers to perform the following tasks:
*To get the BIRT resource folder URI, call getApplResourceBaseURI( ) method.
*To get the instance from the appContext map, pass the map key ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS, defined by the class as a method argument.
*To get the URI of the associated report design file folder, call getDesignResourceBaseURI( ) method. The URI is application dependent and it can be absolute or relative. If your application maintains relative URLs, call the getDesignResourceURILocator.resolve( ) method to get the absolute URI.
The code snippet on Listing 2‑1 shows how to access the resource identifiers through the application context.
Listing 2‑1 Accessing resource identifiers at run time
URI resourcePath = null;
URI absolutePath = null;
 
Object obj = this.appContext.get( ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS );
if ( obj != null )
{
ResourceIdentifiers identifier = (ResourceIdentifiers)obj;
 
if ( identifier.getDesignResourceBaseURI( ) != null )
{
resourcePath = identifier.getDesignResourceBaseURI( );
 
if ( ! resourcePath.isAbsolute( ) )
absolutePath = identifier.getDesignResourceURILocator( ).resolve( resourcePath );
else
absolutePath = resourcePath;
}
}
Accessing resource identifiers in design ODA driver
The resource identifiers are available to the custom ODA designer UI driver. The designer driver provides the user interface for a custom data source and data set.
Typically, to implement a custom behavior, the data source UI driver extends:
org.eclipse.datatools.connectivity.oda.design.ui.wizards.DataSourceWizardPage
The DataSourceWizardPage class has an inherited method getHostResourceIdentifiers( ) that provides access to the resource and report paths. The extended DataSourceWizardPage just needs to call the base method to get the ResourceIdentifiers for its paths information.
Similarly, if the custom driver implements a custom data source editor page, it extends:
org.eclipse.datatools.connectivity.oda.design.ui.wizards.DataSourceEditorPage
The DataSourceEditorPage class has an inherited method getHostResourceIdentifiers( ). The extended class needs to call the base class method to get the ResourceIdentifiers object for the two resource and report paths base URIs.
Related primary methods in the org.eclipse.datatools.connectivity.oda.design. ResourceIdentifiers are:
* URI getDesignResourceBaseURI( );
* URI getApplResourceBaseURI( );