Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Custom Oda Datasource
sthien
Hi,
I am currently working on a custom ODA datasource plugin for my organization. I have created an interface/wizard almost exactly same as the default xml datasource wizard/dataset wizard. In my birt designer, I can create the datasource, choose the xml file save the datasource. Next, i create a new dataset from my custom xml datasource, choose xpath, choose column mapping and preview the data query. The wizard Finish button is enabled but, however, when I clicked on the Finish button, nothing happens.
I have tried to find some information from the internet but there is limited topic regarding this custom datasource thing. So i was hoping someone can help me out here. I cant figure out what is the problem or how to locate the root of the problem here. If you required more details please let me know. I can attached my plugin here.
Find more posts tagged with
Comments
johnw
Go ahead and attach it. Usually what is happening is in the Designer plugin, there is a event called savePage that needs to be called, and even if Finished is enabled, it wont execute until savePage is called. At least, if I remember correctly, its savePage...
sthien
Hi John,
Here is that attached custom datasource plugin that i am working on. I checked that there is a savePage function but it is not called when i run in debug mode. Not sure if that is the savePage event that you are referring.
Birt User,
Sthien
sthien
Sorry, forgot to attach my plugin. Here is it.
sthien
Anyone can resolve these issue? Or any idea where did I messed up in creating this custom oda datasource?
Thanks.
tdtappe
I am facing the same problem. Did you ever solve it?
For creating the plugin(s) I used the Eclipse Indigo ODA Project Wizard for BIRT 3.7
--Heiko
CBR
I faced the same problem. It has to do with the code you have in the isComplete (or canLeave?) method. To test if that's the issue you could simply return true.
tdtappe
<blockquote class='ipsBlockquote' data-author="'cbrell'" data-cid="85137" data-time="1320862828" data-date="09 November 2011 - 11:20 AM"><p>
I faced the same problem. It has to do with the code you have in the isComplete (or canLeave?) method. To test if that's the issue you could simply return true.<br /></p></blockquote>
<br />
Yes, I thought the same and already tried that. But unfortunately that doesn't seem to be the issue. Any other idea?<br />
<br />
--Heiko
tdtappe
Oops, after displaying the error log I just noticed the following error when pushing the finish button.<br />
Any idea what could be the cause of it?<br />
<br />
--Heiko<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>java.lang.NullPointerException
at org.eclipse.birt.report.designer.data.ui.dataset.DataSetBasePage.createDataSet(DataSetBasePage.java:939)
at org.eclipse.birt.report.designer.data.ui.dataset.DataSetBasePage.createDataSetODAV2(DataSetBasePage.java:928)
at org.eclipse.birt.report.designer.data.ui.dataset.DataSetBasePage.createSelectedDataSet(DataSetBasePage.java:865)
at org.eclipse.birt.report.designer.data.ui.dataset.DefaultDataSetWizard.performFinish(DefaultDataSetWizard.java:84)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.birt.report.designer.data.ui.actions.NewDataSetAction.createNewDataSet(NewDataSetAction.java:193)
at org.eclipse.birt.report.designer.data.ui.actions.NewDataSetAction.run(NewDataSetAction.java:181)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)</pre>
CBR
Did you add code to save the dataset properties back to the model? I got this exception while trying to close the dialog without adding the dataset info to the model.
If it's of any help you can have a look at my custom ODA that was build using BIRT 3.7 but works in older versions too. You can find it on google code:
http://code.google.com/p/birt-spreadsheet-datasource/source/checkout
(just checkout the source)
It contains custom dialogs for dataset and dataSource. I added code to save changes back to model.
hope this helps
tdtappe
<blockquote class='ipsBlockquote' data-author="'cbrell'" data-cid="85192" data-time="1320954106" data-date="10 November 2011 - 12:41 PM"><p>
If it's of any help you can have a look at my custom ODA that was build using BIRT 3.7 but works in older versions too. You can find it on google code: <a class='bbc_url' href='
http://code.google.com/p/birt-spreadsheet-datasource/source/checkout'>http://code.google.com/p/birt-spreadsheet-datasource/source/checkout</a>
; (just checkout the source)<br />
It contains custom dialogs for dataset and dataSource. I added code to save changes back to model.<br />
<br />
hope this helps<br /></p></blockquote>
<br />
Fantastic - thanks a lot. Your spreadsheet ODA works out-of-the-box :-)<br />
Based on your code I should definitely be able to build my own custom ODA.<br />
I will report back...<br />
<br />
Big smile!<br />
<br />
--Heiko
CBR
Thanks...feel free to contact me if you have any questions, concerns or in case you find any bugs inside my code.
May i ask you what type of ODA you plan to develop?
CBR
By the way:
The difference between my code and the default ODA plugin code is that my plugin saves the query of the data set as XML that is added to the report xml using a CDATA section. In other plugins the query is saved as a single string that is parsed to get back the information.
Perhaps it's better to use a simple string as query, but in my case it would have been to much work to parse a simple string to get back a bunch of informations (that's why i used XML). I couldn't see a major disadvantage of using a complex xml instead of a simple string.
tdtappe
As for the XML / simple string query stuff, I will keep that in mind and see what suits my needs.
I basically need POJO access. My web app works with a business object layer. All business objects are read from the database via repository functions. I definitely need to go through these repository functions in the report layer also, as there are a bunch of search criteria that need to be guaranteed.
So my idea was to parameterize the needed repository functions, execute them and pass the result to the report engine. The provided data would be a list of invoices for instance. The report itself would then iterate over the invoices and could iterate over the invoice items or do whatever it wants.
In the end I probably need some kind of catalogue of data providers for all the different types of reports. These data providers define the type of data (business objects) that goes into the reports engine. Most probably there can be more than just one data provider for a report.
As I am a newbie to BIRT do you think this is a proper way to go?
BTW, I started with an attempt to access my data via a scripted datasource. And although that kind of worked it was a bit complicated. And I wasn't able for instance to iterate over some inner list (invoice items) inside the report. But that's a different story.
--Heiko
CBR
Hi,
i did something similar in the past. My backend used JPA as a relational data to object mapper. There are also some JPA , Hibernate ODA plugins available. The advantage is that you can write JPA queries using your business objects and get the data back in a feasible way.
The disadvantage i m seeing at the moment is that you need one plugin per Query. So if you need a new query you have to write a new plugin. If you want to go that way, you should make sure that the effort needed to add the new query is very small (e.g. define a extension point that can be used to add a new query without the need to implement all the interfaces)
The optimum would be to define a language that your plugin can understand. Having that kind of language it would be possible to just tell the plugin what to do using the query text.
How does your application look like? (Java: Spring, EJB, custom framework? .NET?)
Concerning the limitation of traversing inner lists using the scripted data set:
The problem does no longer exist (since BIRT 2.6). Using BIRT 2.6 a column can be of type Java object. You can then use a subreport to traverse the inner list of the parent object. There are some nice tutorials available that show you how to do it with a scripted data set (just use the search on the Dev share).
Christian
tdtappe
The app is basically based on EJB, CDI, Seam, JSF 2 - using JPA 2.0 (not working with JPA entities directly as I mentioned before) deployed on a JBoss 6/7.
Concerning the "plugin per query" problem: I was indeed thinking of some kind of simple "language". In a first step maybe just a kind of id or unique name for each type of report resp. data provider.
In the report designer the only thing I can do or have to do is choose the data provider. This defines what kind of dataset(s) is available. A filter must be defined outside the report definition but can / should later be moved into the report creating the need for a "real language".
As for the scripted datasource: I used BIRT 3.7 for my tests already using Java objects. But I wasn't able to bind the inner list to the outer one. Simply moving the inner table outside the outer table (of course with a fixed parameter) made the whole thing much more promissing. My code for providing the data got called :-) But I gave up at that point as the whole scripted datasource thing seemed to be too complicated for using it over and over again.
--Heiko