RCP, scripted datasource and classpath [message #253896] |
Wed, 29 August 2007 16:55  |
Eclipse User |
|
|
|
Originally posted by: mail.micke.gmail.com
Hi
I have been trying to figure out how to integrate BIRT into an RCP
application when using a scripted datasource.
I've seen this question anwsered elsewhere in the forum but I haven't
managed to get it working.
Especially this thread "Custom classes are not found in
ScriotedDataSource in my RCP app" which had a lot of deprecated things
in it. Is there a good place to find documentation about the
EngineConstants? Checked the javadoc but wasn't that many comments about
it. Also couldn't find the ReportEngineService class used in the example
code.
First of, is it possible to get BIRT to pick up classes in the normal
classpath? I really don't want to copy the classes into the web-inf
folder of the viewer (perhaps this is the old way of doing it).
If not how do you guys deal with packaging and developing your
applications using scripted datasources in a pain less way.
As a base for my test application I use the BIRT RCP Viewer found here:
http://wiki.eclipse.org/index.php/RCP_Example
Using:
BIRT 2.2
Eclipse 3.3
Would be really grateful for responses.
Cheers,
Mike
|
|
|
|
|
Re: RCP, scripted datasource and classpath [message #254130 is a reply to message #253937] |
Sat, 01 September 2007 19:40   |
Eclipse User |
|
|
|
Originally posted by: mail.micke.gmail.com
surya wrote:
> Hello Mike,
> you have two solutions for the above problem.
> In my case i was using a java standalone application with BIRT reporting
> API to execute a report and was using scripted data source.
> what is did, i had the Java class which i was accessing in the birt
> report as scripted data source in the same eclipse project.
>
> 1. u can ste this property before staritng the platform // Option 1
> System.setProperty
> (EngineConstants.WEBAPP_CLASSPATH_KEY,"./myclasses/myjar.jar " );
>
> u can create jar of ur java clasees and can give that path in this call.
>
> or
>
> 2.
> // Option - MyClass dSrc = new MyClass();
> //runReport is on type IRunAndRenderTask//
> runReport.addScriptableJavaObject("MyJavaScriptItem", dSrc );
> // u can get more info at this place
> http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.p hp
> u have miscellanesous section near the end of the page which will help u
> with the above functioncall. Furthur the above funtion is depricated,
> so u can use theoption that i have given below:
> //You can use the application context object to do
> this. You can set this for the task or the engine like:
>
> DummyClass dl = new DummyClass();
>
> Configure the Engine and start the Platform
> config = new EngineConfig( );
> HashMap hm = config.getAppContext();
> hm.put( "dummy", dl);
> config.setAppContext(hm);
> // do these defore starting the platform
>
>
> If you still be facing issues do revert back, will try my best to get it
> resolved
> Thanks and Regards
> Surya
>
>
>
Thanks option2 seems to work fine :).
In option 1 you say that I should set the classpath before the platform
starts up, where would I do that? I tried adding the code to teh
Activator but that didn't work for me.
Addd this to the Activator:
System.setProperty(EngineConstants.WEBAPP_CLASSPATH_KEY,
System.getProperty("java.class.path"));
Many thanks,
Mike
|
|
|
Re: RCP, scripted datasource and classpath [message #254180 is a reply to message #254130] |
Mon, 03 September 2007 01:58  |
Eclipse User |
|
|
|
Originally posted by: suryakant.in.ibm.com
Hello..
the system property shd be set before starting the BIRT platform when all
the pluggins are loaded..
I mean to say when u say
platform.startup(config);
Furthur the path shd be the location of the custom class files or jar
files which u wud be accessing in ur Java Script code..
e.g if i have created a sample java class DataSource.java in the same
directory as the ExecutreReport.java . then the class path i wud be giving
as "./bin" as after building all the class files for default package wud
be put into bin directory
Regards
surya
|
|
|
Powered by
FUDForum. Page generated in 0.12239 seconds