| Summary: | Consider replacing static singletons with Guice | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Aaron Digulla <digulla> |
| Component: | BIRT | Assignee: | Birt-ReportViewer <Birt-ReportViewer-inbox> |
| Status: | NEW --- | QA Contact: | Maggie Shen <lshen> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | bluesoldier, jouyang |
| Version: | 4.0.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Aaron Digulla
What do you think BIRT can do with Guice? BIRT uses OSGi extension framework to resolve module depending. I'm not talking about class loading. BIRT code contains a lot of singletons which make it hard to test, integrate and extend. Just look at the code which calls BirtReportServiceFactory.init() - you need to call this several times from several places in the JEE life cycle to make sure the factory eventually is initialized. I want to get rid of the singletons like BirtReportServiceFactory and all the others. I know that OSGi offers a "Blueprint Service" which does DI and IoC. Maybe this can be used instead of Guice. My concern is that Xtext uses Guice and Xtext is a very successful project. Using the code gives me a feeling that a lot of thought has went into it. When these people chose Guice over OSGi, that's a strong indication for me to wonder why. I'm not sure the component change makes sense. I only mentioned the singletons in the viewer component but the engine also uses singletons. Similarily, ReportEngine uses new to create a ReportEngineHelper which means that it's impossible to overrode the behavior of that class. With DI, it would be possible to configure these pieces of the BIRT framework and inject them preconfigured instead of adding options to AppContext or the EngineConfig. OK. Get it. We will discuss about it. Thanks. |