Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 202049 - It is not possible to access classes inside ODA runtime plugin from javascript in RCP designer / genReport
Summary: It is not possible to access classes inside ODA runtime plugin from javascrip...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.3.0 RC1   Edit
Assignee: Jerry Cheng CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-03 03:57 EDT by Antti Karanta CLA
Modified: 2008-05-06 22:48 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 Antti Karanta CLA 2007-09-03 03:57:51 EDT
Accessign classes used also by an ODA runtime plugin is possible when embedding BIRT in your app, i.e. at the deployment phase. This is made possible by registering the correct classloader like described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=186272

However, javascript still fails to find classes inside an ODA driver in 

  * BIRT RCP designer's preview, thus making designing reports more difficult (now working preview)
  * BIRT runtime's genReport.bat (/.sh also I suppose), thus making that tool unusable if you need javascript access to your own classes

Being able to access classes exported from an ODA runtime driver plugin from javascript makes it easier to implement an ODA plugin as, at least in my case, there is some data that is not natural to provide as a result set and I'd like to let the report maker access that with javascript.

I am wrapping a native library, so having more than one classloader load my classes will result in problems. Also in general I think it is cleaner to have the classes loaded only once. I'm saying this as it means the classloader javascript uses should then either ask for the classes it needs from the ODA plugins' classloaders OR there should be a way to access the classloaders used by a named ODA plugin from javascript. The latter is propably simpler and cleaner. Or maybe some other solution?
Comment 1 Antti Karanta CLA 2007-09-05 02:33:56 EDT
This appears to be the same issue as in bug 190500. I tried to use buddy classloading by appending this to my plugin's manifest.mf:

Eclipse-RegisterBuddy: org.eclipse.birt.report.data.adapter,org.eclipse.tomcat

It didn't help, so maybe I didn't choose the right buddies?


*** This bug has been marked as a duplicate of bug 190500 ***
Comment 2 Antti Karanta CLA 2007-09-06 04:07:11 EDT
Sorry, actually this is not a duplicate to bug 190500, but it's related. 

With some help I got in birt newsgroup I was able to resolve the issue for the RCP designer. The solution is to enable buddying in org.eclipse.birt.report.viewer plugin's manifest.mf like this:

Eclipse-BuddyPolicy: registered

  and then registering my ODA runtime plugin as its buddy in its manifest.mf:

Eclipse-RegisterBuddy: org.eclipse.birt.report.viewer

Now the javascript snippets in the report are able to access classes exported by my ODA runtime plugin when using RCP designer's preview.

So I suggest adding buddypolicy registered to org.eclipse.birt.report.viewer's manifest.mf as then one would not need to modify rcp designer installation's plugins to get things working.


I suppose the same idea would work for genReport.bat, i.e. modify the suitable plugin's manifest to enable buddying and then be buddies with it. I don't know which plugin it should be, though.
It would be useful to get genReport.bat working, but I do not have the time to look into it right now.
Comment 3 Lin Zhu CLA 2008-05-05 06:44:58 EDT
This bug is actually not only about the accessing of Classes that defined in ODA runtime, but also the accessing to the Classes that in a loaded plugin in java scripting.

Our current policy in finding a java Class in javascript is:
1.Using the user defined classloader.
2.Search particular location, say "scriptlib" directory.

We need to consider whether to allow alternative approaches.
Comment 4 Jerry Cheng CLA 2008-05-06 22:48:15 EDT
Add Eclipse-BuddyPolicy: registered in MANIFEST.MF