Pages

Saturday, October 15, 2005

Integrating BIRT with Your Application

I recently started to explore BIRT - Eclipse Business Intelligence and Reporting Tool. As illustrated in the following examples available on BIRT's web site, it provides a wide range of reporting and charting capabilities.

One of the features, that I find quite promising is the ability to easily embed the BIRT engine in custom applications. This can easily be illustrated through a basic unit test. The code below illustrates the key elements required to get started:
    /**
     * @see junit.framework.TestCase#setUp()
     */
    protected void setUp() throws Exception
    {
        super.setUp();
        // The directory where the key plugins are located.
        System.setProperty("BIRT_HOME", "C:/.../src/main/resources");
    }

    ...

    /**
     * @throws Exception Throws exception.
     */
    public void testRunReport() throws Exception
    {
        String[] args = {
            // The format
            "-f",
            "html",
            // The output directory
            "-o",
            "C:/.../target",
            // The locale
            "-l",
            "en_US",
            // The encoding
            "-e",
            "UTF-8",
            // The file to generate the report from.
            "C:/.../src/test/resources/helloworld.rptdesign"    
            };
        ReportRunner.main(args);
    }
The BIRT_HOME directory should contains the following runtime plugins required for the embedded engine:
BIRT Plugins

No comments: