It's all about the answers!

Ask a question

Accessing RTC repository from java class invoked by BIRT report


Shay Atzitz (112) | asked May 28 '15, 5:19 a.m.
edited May 28 '15, 5:23 a.m.

Hello all.

We are trying to create a birt report that uses a java class as the data source.

Following the steps described in the article:

https://www.ibm.com/developerworks/community/blogs/JazzyTunes/entry/creating_birt_reports_for_rtc_which_invokes_java_code?lang=en

We were able to call the class successfully from the BIRT report.

The java class needs to access the RTC repository in order to fetch the data it needs for it's calculations.

When we try calling the getService method, we get an exception.

When Calling:

getService(IRepositoryItemService.class)

We receive:

com.ibm.team.repository.common.transport.internal.registry.ServiceNotFoundException: The service 'com.ibm.test.pkg.TestAPI@2cc92cc9' failed to find the

required service 'interface com.ibm.team.repository.service.IRepositoryItemService'. Check <prerequisites>

in plugin.xml.

When Calling:

getService(IProcessServerService.class)

We receive:

com.ibm.team.repository.common.transport.internal.registry.ServiceNotFoundException: The service 'com.ibm.test.pkg.TestAPI@2cc92cc9' failed to find the
required service 'interface com.ibm.team.process.service.IProcessServerService'. Check <prerequisites> in plugin.xml.

The services are defined in the <prerequisites> of the fragment.xml

We also tried calling these services from a WorkItem Operation Advisor -

and in that case - everything worked just fine, and we were able to get the needed data from RTC.

So - the question is -

What should we do in order to access RTC services from a java class called from a BIRT report.

Many thanks in advance.

Shay

One answer



permanent link
Rafik Jaouani (5.0k16) | answered May 28 '15, 3:31 p.m.
JAZZ DEVELOPER
getService() can only be called from code in a method of an existing service that has a dependency on that service declared in the plugin.xml. There is probably a non API way to do this. But I really do not want it exposed in a public forum.

Comments
Shay Atzitz commented May 31 '15, 8:00 a.m.

Hi Rafik.

Thanks a lot for the quick reply.

We found out that only the first instance of the class, an instance created when the server first starts up, has the ability to access the services.

And when we call

new pkg.ClassName();

from the report, the services are not available.

So we now hold a reference to the first instance, and rely on it to access the services for the instances required by the report.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.