Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
xml datasource as inputStream
RegisR
Hi,
I have a quick question about the BIRT 2.2.2 reportEngine.
I'm developping a batch application, which generate the XML datasource on the fly.
Of what I have seen, the report engine can only get an XML datasource from a "physical" source. I mean file or URL.
Is there a way to send the datasource as inputStream to the report engine ? Because I can have thousands of reports a day, it will be better than write the report to disk then read it from engine...
Thanks a lot!
Find more posts tagged with
Comments
RegisR
Never mind...
Sorry for the inconvenience, I finally found the response by myself by looking at the ODA xml source code...
Here is a sample of code for those interested.
Map appContext = runAndRenderTask.getAppContext();
FileInputStream fileInputStream = new FileInputStream("D:/workspaces/birt/2.2.2/datasource/batch/reports/report.xml");
appContext.put("org.eclipse.datatools.enablement.oda.xml.inputStream", fileInputStream);
//Use closeInputStream (true) to let BIRT automatically close the inputStream.
appContext.put("org.eclipse.datatools.enablement.oda.xml.closeInputStream", "true");
RegisR
Hum, finally...
It's not resolved...
In case of the report contains 2 xml datasources... The 2 datasources will be bound on the same inputStream ! That's too bad...
Any idea to resolve this, please ?
Thanks !
vash
Hi,
Can you please tell me, from where did you get this package:
org.eclipse.datatools.enablement.oda.xml.inputStream
because its not available in the lib directory.
-Vash
RegisR
The package "org.eclipse.datatools.enablement.oda.xml.inputStream" does not exists (I think).
It is only a string to "register" a variable. But the driver is contained in the org.eclipse.datatools.enablement.oda.xml...jar
It's available in the plugins directory (sub folder of the lib one).
But only since BIRT 2.2 (BIRT 2.1 uses a custom ODA drivers).
vash
Thanks RegisR,
Got it.
Its in plugins.
-Vash
hearttaker
Hi,
I am relatively new to BIRT .
I'm trying to create a report design and then render the contents to an excel using BIRT 2.3
I have used an XML datasource which will take in a physical xml file at runtime and create a design. I am actually writing an xml object into a file (say abc.xml) at run time .
and set the xml file to the datasourcehandle as below :
dataSourceHandle.setProperty("FILELIST", xmlFilePath);
my question is , instead of using a physical file, is there a way to pass an xml object as a String/stream for creating the design ?
Thanks in Advance,
Hearttaker!!!
RegisR
Yes, just take the code above and replace the FileInputStream by a "whatever"InputStream.
Map appContext = runAndRenderTask.getAppContext();
SomethingInputStream inputStream = new SomethingInputStream (...);
appContext.put("org.eclipse.datatools.enablement.oda.xml.inputStream", inputStream);
//Use closeInputStream (true) to let BIRT automatically close the inputStream.
appContext.put("org.eclipse.datatools.enablement.oda.xml.closeInputStream", "true");
The only requirement is that the inputStream streams XML...
Please note that it is a dangerous way to do things. BIRT does not natively support InputStream. It's a property of the XML driver.
Please also note that BIRT will make a lot of calls to the input stream. You can expect to have only one call to get data, but no ! Depending on your report and the input stream you may have huge performance issues. Because it can be called many many many many times...
hearttaker
Thanks a ton RegisR !!!!
it worked
)))
Regards,
Hearttaker !!!
pkkoniec
<p>How does one consume inputStream set with "org.eclipse.datatools.enablement.oda.xml.inputStream" in java code?</p>
<p>What datasource should be used and how to configure it to use inputStream in .rtpdesign?</p>
<p>In XML DataSource i have to provide file.xml, there is no option to use inputStream. Do I have to somehow override this file.xml with inputStream in beforeOpen?</p>
<p>I'd be very grateful for any advice.</p>
pkkoniec
<blockquote class="ipsBlockquote" data-author="pkkoniec" data-cid="147449" data-time="1493206466">
<div>
<p>How does one consume inputStream set with "org.eclipse.datatools.enablement.oda.xml.inputStream" in java code?</p>
<p>What datasource should be used and how to configure it to use inputStream in .rtpdesign?</p>
<p>In XML DataSource i have to provide file.xml, there is no option to use inputStream. Do I have to somehow override this file.xml with inputStream in beforeOpen?</p>
<p>I'd be very grateful for any advice.</p>
</div>
</blockquote>
<p>It turns out that file.xml is overridden by inputStream without any actions required.</p>
<p>If inputStream happens to be null, by default, file.xml is used</p>