public class GerritMissedEventsPlaybackManager extends Object implements com.sonymobile.tools.gerrit.gerritevents.ConnectionListener, com.sonymobile.tools.gerrit.gerritevents.GerritEventListener
Modifier and Type | Field and Description |
---|---|
protected List<com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent> |
receivedEventCache
List that contains received Gerrit Events.
|
protected EventTimeSlice |
serverTimestamp
Server Timestamp.
|
Constructor and Description |
---|
GerritMissedEventsPlaybackManager(String name) |
Modifier and Type | Method and Description |
---|---|
protected String |
buildEventsLogURL(IGerritHudsonTriggerConfig config,
Date date1) |
void |
checkIfEventsLogPluginSupported()
method to verify if plugin is supported.
|
void |
connectionDown()
Log when the connection goes down.
|
void |
connectionEstablished()
When the connection is established, we load in the last-alive
timestamp for this server and try to determine if a time range
exist whereby we missed some events.
|
void |
gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
This allows us to persist a last known alive time
for the server.
|
static hudson.XmlFile |
getConfigXml(String serverName) |
protected Date |
getDateFromTimestamp()
get DateRange from current and last known time.
|
protected List<com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent> |
getEventsFromDateRange(Date lowerDate)
Get events for a given lower bound date.
|
protected String |
getEventsFromEventsLogPlugin(IGerritHudsonTriggerConfig config,
String url) |
EventTimeSlice |
getServerTimestamp()
Return server timestamp.
|
boolean |
isSupported() |
protected void |
load()
Load in the last-alive Timestamp file.
|
void |
shutdown()
Shutdown the listener.
|
protected EventTimeSlice serverTimestamp
protected List<com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent> receivedEventCache
public GerritMissedEventsPlaybackManager(String name)
name
- Gerrit Server Name.public void checkIfEventsLogPluginSupported()
protected void load() throws IOException
IOException
- is we cannot unmarshal.protected Date getDateFromTimestamp()
public void connectionEstablished()
connectionEstablished
in interface com.sonymobile.tools.gerrit.gerritevents.ConnectionListener
public void connectionDown()
connectionDown
in interface com.sonymobile.tools.gerrit.gerritevents.ConnectionListener
public void gerritEvent(com.sonymobile.tools.gerrit.gerritevents.dto.GerritEvent event)
gerritEvent
in interface com.sonymobile.tools.gerrit.gerritevents.GerritEventListener
event
- Gerrit Eventprotected List<com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent> getEventsFromDateRange(Date lowerDate) throws IOException
lowerDate
- lower bound for which to request missed events.IOException
- if HTTP errors occurprotected String getEventsFromEventsLogPlugin(IGerritHudsonTriggerConfig config, String url)
config
- Gerrit config for server.url
- URL to use.protected String buildEventsLogURL(IGerritHudsonTriggerConfig config, Date date1) throws UnsupportedEncodingException
config
- Gerrit Config for server.date1
- lower bound for date range,UnsupportedEncodingException
- if URL encoding not supported.public void shutdown()
public boolean isSupported()
public EventTimeSlice getServerTimestamp()
@CheckForNull public static hudson.XmlFile getConfigXml(String serverName) throws IOException
serverName
- The Name of the Gerrit Server to load config for.IOException
- if it occurs.Copyright © 2016. All rights reserved.