Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes


Accepted answer

Permanent link
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

2 votes


One other answer

Permanent link
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$
        }
    }
}

0 votes

Comments

Thanks for sharing.

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jan 13 '16, 12:51 a.m.

Question was seen: 2,353 times

Last updated: Jan 14 '16, 3:25 a.m.

Confirmation Cancel Confirm