Birt POJO Data Source POC
Options
I am doing POC for Birt POJO Data source. I want to reuse the existing Spring based framework code in Birt POC.
In Open method, I am loading Spring Application context, executing business logic to get data and close method destroying the spring application context. Please advise, this is the correct way to load Spring Application context in open method?
public class ReportApplication {
private AnnotationConfigApplicationContext ctx = null; Iterator<? extends String> iterator; public void open(Object appContext, Map<String, Object> datasetParamValues) { try { ctx = new AnnotationConfigApplicationContext(); ctx.scan("com.****.****"); ctx.register(BirtConfig.class); IReferenceService refService = (IReferenceService) SpringContext.getBean("referenceService"); List<String> positions = null; positions = refService.refData(QueryType.NAMED); iterator = positions.iterator(); } catch (Exception e) { e.printStackTrace(); } } public Object next() { if (iterator != null && iterator.hasNext()) { return iterator.next(); } return null; } public void close() { iterator = null; if (ctx != null) { ctx.close(); } }
}
0
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 122 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management