What is the eventCategory for “Build result changed” event?
I want to extend a follow up action in the “Event handling” configuration for “Build result changed” event. From the other forum topic, I know I should use the com.ibm.team.process.service.eventHandlers extension point, but when extend it, what is the eventCategory value?
And is there any Event Handler extension workshop? Is the same as operation follow up action extension? |
Accepted answer
Ralph Schoon (63.6k●3●36●46)
| answered Jan 13 '16, 3:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I found it always hard to find anything about event handlers. I don't have an example and I don't have a list of event categories. I am not aware of any examples. However, the basic extension mechanism works similar to a follow up action and the interfaces you must implement can be found in the extension.
For build I found BuildResultChangeEvent if following it up the extension hierarchy I find com.ibm.team.build.internal.common.events.BuildChangeEvent and there: public static final String BUILD_RESULT_CHANGED_EVENT_CATEGORY = "com.ibm.team.build.category.BuildResultChanged"; //$NON-NLS-1$ com.ibm.team.build.category.BuildResultChanged would be what I would try. Ralph Schoon selected this answer as the correct answer
|
One other answer
Yes, Ralph, you are right, thanks for your way to find the event category id.
I use the following extension to create a Build Result Change event followup actions: <extension point="com.ibm.team.process.service.eventHandlers"> <eventHandler class="com.ibm.team.build.internal.service.process.event.tests.BuildProcessEventHandler" id="com.ibm.team.build.test.BuildProcessEventHandler" eventCategory="com.ibm.team.build.category.BuildResultChanged" name="Build Event Handler"> <extensionService componentId="com.ibm.team.build" implementationClass="com.ibm.team.build.internal.service.process.event.tests.BuildProcessEventHandler"> <prerequisites> <requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/> <requiredService interface="com.ibm.team.build.internal.common.ITeamBuildService"/> </prerequisites> </extensionService> </eventHandler> </extension> Here is a example code from BuildProcessEventHandler class. public class BuildProcessEventHandler extends AbstractService implements IChangeEventHandler { /* * (non-Javadoc) Intentionally not documented. See parent. */ public void handleEvent(IChangeEvent event, IProcessConfigurationElement handlerConfiguration) throws TeamRepositoryException { if (BuildResultChangeEvent.BUILD_RESULT_CHANGED_EVENT_CATEGORY.equals(event.getCategory())) { IRepositoryItemService repoService = getService(IRepositoryItemService.class); IBuildResult buildResult = (IBuildResult) repoService.fetchItem(event.getItem(), IBuildResult.PROPERTIES_COMPLETE); buildResult = (IBuildResult) buildResult.getWorkingCopy(); buildResult.setTags(getClass().getSimpleName()); ITeamBuildService teamBuildService = getService(ITeamBuildService.class); teamBuildService.save(buildResult); } else { throw new IllegalArgumentException("Why am I being invoked for a non-build event?"); //$NON-NLS-1$ } } } |
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.