Class TriggerMonitor
- java.lang.Object
-
- com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.actions.manual.TriggerMonitor
-
- All Implemented Interfaces:
GerritEventLifecycleListener
public class TriggerMonitor extends Object implements GerritEventLifecycleListener
Keeps track of the lifecycle of a GerritEvent.- Author:
- Robert Sandell <robert.sandell@sonyericsson.com>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TriggerMonitor.EventState
State information about an event.
-
Constructor Summary
Constructors Constructor Description TriggerMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(GerritEventLifecycle gerritEventLifecycle)
Adds the event and a holder for its state to the list of triggered events.void
allBuildsCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Called when all builds triggered by the event are completed.void
buildCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Called when a build is completed.void
buildStarted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Called when a build has started.boolean
contains(GerritEventLifecycle gerritEventLifecycle)
Checks to see if the list of triggered events and their states contains the given event.List<TriggerMonitor.EventState>
getEvents()
The list of events and their states.Iterator<TriggerMonitor.EventState>
getEventsIterator()
An iterator of the list of events and their states.void
projectTriggered(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Job project)
Called when the trigger of a project has decided to trigger on the event.void
triggerScanDone(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Called after all triggers has been enumerated.void
triggerScanStarting(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Called before any triggers are enumerated.
-
-
-
Method Detail
-
add
public void add(GerritEventLifecycle gerritEventLifecycle)
Adds the event and a holder for its state to the list of triggered events. And adds this TriggerMonitor as a listener to the event. Unless it doesn't already exists in the list of events.- Parameters:
gerritEventLifecycle
- the event.
-
contains
public boolean contains(GerritEventLifecycle gerritEventLifecycle)
Checks to see if the list of triggered events and their states contains the given event.- Parameters:
gerritEventLifecycle
- the event to check.- Returns:
- true if it exests in the list.
- See Also:
getEvents()
-
triggerScanStarting
public void triggerScanStarting(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Description copied from interface:GerritEventLifecycleListener
Called before any triggers are enumerated.- Specified by:
triggerScanStarting
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.
-
triggerScanDone
public void triggerScanDone(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Description copied from interface:GerritEventLifecycleListener
Called after all triggers has been enumerated.- Specified by:
triggerScanDone
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.
-
projectTriggered
public void projectTriggered(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Job project)
Description copied from interface:GerritEventLifecycleListener
Called when the trigger of a project has decided to trigger on the event.- Specified by:
projectTriggered
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.project
- the project that was triggered.
-
buildStarted
public void buildStarted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Description copied from interface:GerritEventLifecycleListener
Called when a build has started.- Specified by:
buildStarted
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.build
- the build.
-
buildCompleted
public void buildCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event, Run build)
Description copied from interface:GerritEventLifecycleListener
Called when a build is completed.- Specified by:
buildCompleted
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.build
- the build.
-
allBuildsCompleted
public void allBuildsCompleted(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
Description copied from interface:GerritEventLifecycleListener
Called when all builds triggered by the event are completed.- Specified by:
allBuildsCompleted
in interfaceGerritEventLifecycleListener
- Parameters:
event
- the event.
-
getEvents
public List<TriggerMonitor.EventState> getEvents()
The list of events and their states.- Returns:
- a list.
-
getEventsIterator
public Iterator<TriggerMonitor.EventState> getEventsIterator()
An iterator of the list of events and their states.- Returns:
- a iterator.
-
-