BIRT report with HBase Phoenix

Home Forums BIRT Reporting BIRT report with HBase Phoenix

This topic contains 0 replies, has 1 voice, and was last updated by  bulldog006 3 years, 3 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1886

    bulldog006
    Participant

    My primary requirement is to use data in HBase for reporting in BIRT. What I have tried to do is tried to access HBase through Phoenix driver using Scripted datasource. This is what I have tried.

    1. Created a Java class file that access data from my HBASE cluster through Phoenix. Referred example from link: http://www.javaworld.com/article/3030214/big-data/open-source-java-projects-apache-phoenix.html.
    2. Instead of showing the fetched data in Console I created a method myPhoenixDatabase() that converts the data to JSON String and returns.
    3. In BIRT report, I used scripted datasource. In the script for dataset, I imported the package that has the class mentioned in (1) and (2), parsed the JSON array that is being returned from myPhoenixDatabase() and mapped them to my dataset fields.

    I have attached the report file, Java class and Maven POM file here. Below is a sample of the code.

    BIRT Dataset Script
    Open Method

    importPackage(Packages.com.geekcap.javaworld.phoenixexample);
    pe = new Packages.com.geekcap.javaworld.phoenixexample.PhoenixExample();
    var jsontext = pe.myPhoenixDatabase();
    myJSONObject = eval ("(" + jsontext + ")");
    len = myJSONObject.length; 
    count=0;

    Fetch Method

    if(count < len)
    {
        var EmpID     = myJSONObject[count].EMPID;
        var Name   = myJSONObject[count].NAME;
        var Designation    = myJSONObject[count].DESIGNATION;
        row["EmpID"] = EmpID;
        row["Name"]= Name;
        row["Designation"]= Designation;
        count++;
        return true;
    }
    return false;
    

    Issues
    1. This works fine only on the first execution after opening ECLIPSE. In subsequent runs the return value from the function was NULL and it throws error: “TypeError: Cannot read property “length” from null”.
    2. A weird workaround fixed this issue, calling the function twice, once from Open method of dataset script and second time from Afteropen method, fixed this issue.
    3. But still I am not able to get the report working from Tomcat server.

    I have uploaded the class, Maven POM and report files. Sorry for a long description. Any help would be much appreciated.
    Files: https://drive.google.com/folderview?id=0B5pKuCLloQdHM09HN1E4MndQQ1k&usp=sharing

    • This topic was modified 3 years, 3 months ago by  bulldog006.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.