Accessing BIRT report design and BIRT resources paths in custom ODA plug-insODA 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 modelFor 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 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 Object obj = this.appContext.get( ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS );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.org.eclipse.datatools.connectivity.oda.design.ui.wizards.DataSourceWizardPageThe 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.org.eclipse.datatools.connectivity.oda.design.ui.wizards.DataSourceEditorPageThe 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:
|
|
Copyright Actuate Corporation 2012 |