Community
Participate
Working Groups
A DataSource can be attached to a set of connection profiles contained in a ConnectionProfile repository. When you set up the location of the ConnectionProfile the path to the profile is absolute. I believe that the developer should have the option of setting this up to be a path relative to the birt.resource path. In fact, I believe this should be the default behavior.
The connection profile file path does not have to be an absolute path. It can be a relative File spec, per the definition of java.io.File's Javadoc, i.e. the user directory. It's just the Profile Selection UI page that uses an absolute path to look up the contents to populate the profile list in the UI tree view. There is always ambiguity on where a file path should be relative to. Some users may want to keep their data files outside of a BIRT installation folder. Others want to use a common folder shared by multiple products from the same vendor. Furthermore, certain sets of designs may want to use one root path, and other sets may want to use a different root path. What may be obvious to one as a default location is not obvious to others, especially when used in a different ODA consumer application. BTW, this applies to all properties that take a file path, not just the Connection Profile store path property; e.g. the oda.xml or oda.flatfile data files. Thus, using the Property Binding feature in BIRT is a better way to explicitly specify what a file property's root path is. This also provides the flexibility to define different root path for different file properties. The JavaScript expression specified in its corresponding Property Binding value does not have to use a report parameter. It can use a BIRT config[] variable or a reportContext global variable. For example, a JavaScript expression can include a variable to control the root path: config[ "birt.viewer.working.path" ] + "../../data/ProfileStore.dat" One can also define own user JVM property, and refer to it by name in the config scriptable object, e.g. config[ “variableName” ]. A JavaScript expression can also refer to BIRT reportContext's global variable. An enhancement request is open to add BIRT resource folder and BIRT HOME to the list of variables predefined in BIRT reportContext (see bug 217204 ). Having these variables would make it more convenient to specify those root locations, instead of having to define own JVM variable for reference in config[]. Separately, the ODA Connection Profile store path property can also accept a java.net.URL.URL spec, when applied as the runtime value of the Connection Profile Store property. For example, in BIRT Data Source Editor, specify the URL string spec as the value of the "Connection Profile Store URL" property in the Property Binding page.
See bug 217950 on the BIRT solution added to access a BIRT Viewer's BIRT_RESOURCE_PATH (user-defined in web.xml) in a JavaScript expression, via the BIRT reportContext: reportContext.getAppContext().get("birt.viewer.resource.path")
See bug 217952 on yet another BIRT solution added to use a registered resource locator to look up a resource, such as a connection profile store file URL, in a JS expression: reportContext.getResource( "ProfileStore.dat" );
*** Bug 234396 has been marked as a duplicate of this bug. ***
Hi, i don't understand how to apply your solutions. How can i do to configure the path of my datasource (from a connection profile) in my report without java code ? May i use the property binding of the datasourse ? what field does i need to change, with which value ? Thank you.
(In reply to comment #5) From your original problem description in bug 234396, you seem to have wanted to have a way to dynamically specify the "path" of a connection profile file at runtime, when deploying the report to run on a separate machine. To do this, in the "Edit Data Source" dialog, select the "Property Binding" node, and enter the relevant JavaScript expression in the "Connection Profile Store URL" property. Separately, if you want to change the "content" of a connection profile exported to a file, BIRT 2.3 RC1 all-in-one package has included a new DTP console editor application to do that. When a DTP exported profile file is copied to a server platform for deployment, an user can use this editor tool to quickly adjust the connection profile properties without having to bring up the DTP Data Source Explorer UI workbench. See https://bugs.eclipse.org/bugs/attachment.cgi?id=100358 for usage info. BTW, such questions are best discussed in BIRT newsgroup. Please post any follow-up questions there.