Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 215497 - Connection Profile Root Should be Relative Path
Summary: Connection Profile Root Should be Relative Path
Status: RESOLVED WONTFIX
Alias: None
Product: Data Tools
Classification: Tools
Component: Open Data Access (show other bugs)
Version: 1.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.6M5   Edit
Assignee: Linda Chan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 234396 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-01-16 10:35 EST by Scott Rosenbaum CLA
Modified: 2008-06-05 20:29 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Rosenbaum CLA 2008-01-16 10:35:50 EST
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.
Comment 1 Linda Chan CLA 2008-01-30 21:21:46 EST
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.

Comment 2 Linda Chan CLA 2008-02-21 22:35:18 EST
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")
Comment 3 Linda Chan CLA 2008-03-03 15:08:47 EST
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" );
Comment 4 Linda Chan CLA 2008-05-28 14:35:02 EDT
*** Bug 234396 has been marked as a duplicate of this bug. ***
Comment 5 meurwinn CLA 2008-05-29 04:40:31 EDT
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.
Comment 6 Linda Chan CLA 2008-06-05 20:29:09 EDT
(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.