Home
Analytics
Change BIRT Library by Parameter
SNX2012
Hi @ all,
I?ve got Question. We use BRIT Reports (v.3.7.2) integrated in an Application. We use more than one Instance of the Application on one Application Server so we have to switch the Library dynamically on Runtime via Parameter. Is something like that possible in BIRT? What is best practice? I am thankful for every kind of help.
Find more posts tagged with
Comments
mwilliams
How many different library possibilities are there? If just a couple, you could add the elements from both libraries and then drop the unneeded items based on the parameter. You could also probably dynamically add the library to the report and add elements to your design from the library, in your beforeFactory. I've not done this, so I'm not totally certain.
Yaytay
<blockquote class='ipsBlockquote' data-author="'SNX2012'" data-cid="98237" data-time="1332756121" data-date="26 March 2012 - 03:02 AM"><p>
Hi @ all,<br />
<br />
I?ve got Question. We use BRIT Reports (v.3.7.2) integrated in an Application. We use more than one Instance of the Application on one Application Server so we have to switch the Library dynamically on Runtime via Parameter. Is something like that possible in BIRT? What is best practice? I am thankful for every kind of help.<br /></p></blockquote>
<br />
What we do is to change the ResourceLoader in the application to replace tokens in the name of the resource.<br />
So we can have, in the rptdesign, a resource file name of libraries/__CLIENT/styles.rptlibrary, and that gets converted to libraries/bigco/styles.rptlibrary based upon an instruction to replace "__CLIENT" with "bigco".<br />
<br />
This is one way in which our report service is aimed at supporting client-specific web applications; another feature of the report service is the option to replace the datasource with a different one (based upon the name of the datasource).<br />
This is used when each client has a specific, identical, database.<br />
<br />
Jim
SNX2012
Thanks for the answers. This sounds like the same Workaround that we use at the moment. We want to run 10 instances of the application with integrated BIRT reports on the same Application Server. So I have to run the same reports with 10 different Data sources. The only difference is the Port of the Data source. So what we do is to add the Data source to a Library and use it in all reports and replace the port after it by hand. What I want to do is to replace the used Library by runtime with a parameter. The only thing in the Library what would change would be the port of the Data source.
Yaytay
<blockquote class='ipsBlockquote' data-author="'SNX2012'" data-cid="98327" data-time="1332920495" data-date="28 March 2012 - 12:41 AM"><p>
Thanks for the answers. This sounds like the same Workaround that we use at the moment. We want to run 10 instances of the application with integrated BIRT reports on the same Application Server. So I have to run the same reports with 10 different Data sources. The only difference is the Port of the Data source. So what we do is to add the Data source to a Library and use it in all reports and replace the port after it by hand. What I want to do is to replace the used Library by runtime with a parameter. The only thing in the Library what would change would be the port of the Data source.<br /></p></blockquote>
A custom ResourceLoader lets you do that.<br />
<br />
Changing the library at run time isn't (and shouldn't be) BIRT's responsibility, but BIRT should do (and does, via the ResourceLoader) give you the facility to do it.
SNX2012
Where can I get such a ResouceLoader? Never heared about it.
Yaytay
<blockquote class='ipsBlockquote' data-author="'SNX2012'" data-cid="98329" data-time="1332920972" data-date="28 March 2012 - 12:49 AM"><p>
Where can I get such a ResouceLoader? Never heared about it.<br /></p></blockquote>
Oops, sorry, got the name wrong, it's ResourceLocator:<br />
<br />
<a class='bbc_url' href='
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.birt.doc.isv/model/api/org/eclipse/birt/report/model/api/IResourceLocator.html'>http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.birt.doc.isv/model/api/org/eclipse/birt/report/model/api/IResourceLocator.html</a><br
/>
<br />
You implement one of those yourself and then pass it in to openReportDesign for your RunTask (or you get the DefaultResourceLocator):<br />
<a class='bbc_url' href='
http://help.eclipse.org/indigo/topic/org.eclipse.birt.doc.isv/engine/api/org/eclipse/birt/report/engine/api/ReportEngine.html#openReportDesign(java.lang.String, org.eclipse.birt.report.model.api.IResourceLocator'>http://help.eclipse.org/indigo/topic/org.eclipse.birt.doc.isv/engine/api/org/eclipse/birt/report/engine/api/ReportEngine.html#openReportDesign(java.lang.String, org.eclipse.birt.report.model.api.IResourceLocator</a>)<br
/>
<br />
You can also set the ResourceLocator on the engine, but for my purposes that wasn't good enough - I couldn't get enough context through the IResourceLocator interface so I have to construct a specific ResourceLocator instance for each task.<br />
<br />
Jim
SNX2012
Hey thanks, i think this will help.