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:
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 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  
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 );
      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:
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:
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 ResourceIdentifiers are:

Additional Links:

Copyright Actuate Corporation 2012