Sunday, June 8, 2008

JFreechart and JIRA

One of the features on my plugin is creating a chart based on the specified parameter. Actually, this plugin is completely the same as report but the different is the representation. If report plugin is using text but this portlet plugin (I put my chart onto portlet) is using chart to represent the data.

The tricky thing on this plugin is on how to generate chart on the fly. As you know, JIRA is built on several frameworks. Even in plugin creation, you can not be as free as you create common servlet. Thus, creating plugin in JIRA is similar with creating a feature or functionality in the box. There are a lot of limitations.

Lucky me, since version 3.xx (I forget since what version), JIRA (and Confluence) provides you a way to create servlet. Isnt it very cool? It seems that JIRA provides you a way to get a freedom to add an additional functionalities as free as you create common servlet. Moreover, JIRA provides you an injection mechanism so that whenever you need JIRA's object, you can grab it using ComponentManager object. The following is as example of it.

public ServletImage() {
this.searchProvider = ComponentManager.getInstance().getSearchProvider();
this.authenticationContext = ComponentManager.getInstance().getJiraAuthenticationContext();

By using servlet, you can create any file on the fly and you do not need to worry about temporary directory to put your file.

1 comment:

M@rcelo C@stilho said...


I'm from brazil and need to make a gadget using JFreechart and portlet. Do you have any example of this?