It's all about the answers!

Ask a question

How to detect delivery of change sets into a stream using Java API?


Timothy Wynia (111) | asked Jun 13 '17, 11:07 a.m.
edited Jun 13 '17, 12:33 p.m.

Right now I am trying to programmatically detect when other users deliver Change Sets to a stream using the plain Java API, but I am not currently having any luck detecting detecting any events or deliveries. I'm rather new to this and don't know if I missed something simple, or need to try a completely different approach altogether. Any help is appreciated.

Code:

public void addListener(IWorkspaceConnection monitoredStream) {
    ArrayList<Object> eventList = this.buildEventList();
    for (Object o : eventList) {
       monitoredStream.addGenericListener(o, new MyIListener());
    }
}
public ArrayList<Object> buildEventList() {
    ArrayList<Object> events = new ArrayList<>();
    events.add(IChangeHistoryEvent.ACCEPT_CHANGESETS);
    events.add(IChangeHistoryEvent.ACCEPT_COMBINED);
    events.add(IChangeHistoryEvent.CLOSE_CHANGE_SETS);
    events.add(IChangeHistoryEvent.CONFLICTS_UPDATED);
    events.add(IChangeHistoryEvent.CREATE_CHANGE_SET);
    events.add(IChangeHistoryEvent.DELIVER);
    events.add(IChangeHistoryEvent.DISCARD_CHANGE_SETS);
    events.add(IChangeHistoryEvent.HISTORY_RESTRUCTURED);  
    events.add(ICommitEvent.COMMIT);
    events.add(IConfigurationUpdateEvent.CONFIGURATION_UPDATED);
    events.add(ICurrentChangeSetEvent.SET_CURRENT_CHANGESET);
    events.add(IPropertyChangeEvent.ADD);
    events.add(IPropertyChangeEvent.ADD_MANY);
    events.add(IPropertyChangeEvent.MOVE);
    events.add(IPropertyChangeEvent.NO_INDEX);
    events.add(IPropertyChangeEvent.REMOVE);
    events.add(IPropertyChangeEvent.REMOVE_MANY);
    events.add(IPropertyChangeEvent.SET);
    events.add(IPropertyChangeEvent.UNSET);
    events.add(IQueryEvent.QUERY_ADDED_EVENT_TYPE);
    events.add(IQueryEvent.QUERY_CHANGED_EVENT_TYPE);
    events.add(IQueryEvent.QUERY_CREATED_EVENT_TYPE);
    events.add(IQueryEvent.QUERY_DELETED_EVENT_TYPE);
    events.add(IQueryEvent.QUERY_EXECUTION_DONE_EVENT_TYPE);
    events.add(IQueryEvent.QUERY_EXECUTION_START_EVENT_TYPE);
    events.add(ISharedItemChangeEvent.SHARED_ITEM_CHANGE_EVENT_TYPE);
    return events;
}


Comments
Ralph Schoon commented Jun 13 '17, 11:25 a.m. | edited Jun 13 '17, 11:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

As usual it is more important to understand what you want to achieve. Carefully read: How should I ask a question in the Forum if I want to receive useful answers?


You can also search the SDK for where the generic listeners are used to find out what valid events there might be. I found various test classes that use listeners.

Be the first one to answer this question!


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.