It's all about the answers!

Ask a question

Putting prerequisites in plugin.xml for a component plugin


Luca Martinucci (942277105) | asked Jul 08 '15, 4:17 a.m.
edited Jul 08 '15, 4:20 a.m.
I am writing a Java plugin (extension) that provides some common utilities to the other plugins.
Actually, it is neither an advisor nor a participant, but a component instead.
The other plugins (advisors and participants) leverage its methods to retrieve some pieces of information and perform some common tasks.
I would like this plugin to be able to retrieve also the services that advisors and participants use (IWorkItem server, IRepositoryItemService, ...), but I need to declare their interfaces as prerequistes of the component plugin in the plugin.xml file.
Is it possibile or not?
So far, I could not find any point in plugin.xml where it is possible to put this piece of xml:

<prerequisites>
       <requiredService interface="com.ibm.team.workitem.service.IWorkItemServer"/>
       <requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
 </prerequisites>

The current content of plugin.xml of the component plugin is:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension point="com.ibm.team.repository.common.components">       
      <component id="com.ibm.team.custom.common" name="[Custom] Common">
      </component>
   </extension>
</plugin>


I am working with RTC 4.0.6.

Accepted answer


permanent link
Ralph Schoon (57.0k23642) | answered Jul 08 '15, 4:26 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please see Rational Team Concert Extensions Workshop Page 63 and 64.
Also see https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ at the end of the post.
Luca Martinucci selected this answer as the correct answer

Comments
Luca Martinucci commented Jul 13 '15, 4:12 a.m.

In the provided examples the services are retrieved by advisor and participant plugins.
Of course, it works, but I would like to do a different thing.
I am trying to retrieve those services in the component plugin: this way, I would provide a single, common point to retrieve these services.
I have no problem in retrieving the services in the component plugin (there are no changes in the code), but at runtime the plugin generates and exception, because the interfaces are not declared in the plugin.xml.
If I put the <prerequisites> tag anywhere in the plugin.xml. it is just ignored at runtime,


Ralph Schoon commented Jul 13 '15, 5:10 a.m. | edited Jul 13 '15, 5:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can not just put the stuff somewhere because it is more convenient. The other plugins don't know anything about the component plugin. All are isolated. You have to put the required services into each plugin that requires them!

One other answer



permanent link
sam detweiler (12.4k6179201) | answered Jul 08 '15, 8:19 a.m.
Yes, the Eclipse interface for declaring this stuff is hidden behind the right click of the mouse.

if you right click on the service entries in the extensions tab of the plugin.xml you will find 'New'

which will have the entry fields for different capabilities

Comments
Ralph Schoon commented Jul 08 '15, 8:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I find it way easier to just paste it into the plugin.XML.


sam detweiler commented Jul 08 '15, 8:59 a.m.

yeh, you might do it enough to be able to get it in the right spot.

altho I have a lot of plugins, I still struggle with the plugin.xml syntax.

Your answer


Register or to post your answer.