com.sonyericsson.hudson.plugins.gerrit.trigger
Class GerritProjectListUpdater

java.lang.Object
  extended by java.lang.Thread
      extended by com.sonyericsson.hudson.plugins.gerrit.trigger.GerritProjectListUpdater
All Implemented Interfaces:
ConnectionListener, java.lang.Runnable

public class GerritProjectListUpdater
extends java.lang.Thread
implements ConnectionListener

Class responsible for providing the Config object with a list of all available Gerrit projects. Executed periodically on a timely basis and every time the connection to the Gerrit server has been restored.

Author:
Gustaf Lundh <Gustaf.Lundh@sonyericsson.com>

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.lang.String GERRIT_LS_PROJECTS
          The command for fetching projects.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GerritProjectListUpdater()
          Standard constructor.
 
Method Summary
 void connectionDown()
           
 void connectionEstablished()
           
 java.util.List<java.lang.String> getGerritProjects()
          Returns a string list of Gerrit projects.
 boolean isConnected()
           
static java.util.List<java.lang.String> readProjects(java.io.Reader commandReader)
          Reads a list of Gerrit projects from a Reader, one project per line.
 void run()
           
 void setConnected(boolean connected)
           
 void setGerritProjects(java.util.List<java.lang.String> projects)
          Sets the internal Gerrit project list.
 void shutdown()
          Shutdown the thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GERRIT_LS_PROJECTS

public static final java.lang.String GERRIT_LS_PROJECTS
The command for fetching projects.

See Also:
Constant Field Values
Constructor Detail

GerritProjectListUpdater

public GerritProjectListUpdater()
Standard constructor.

Method Detail

connectionEstablished

public void connectionEstablished()
Specified by:
connectionEstablished in interface ConnectionListener

connectionDown

public void connectionDown()
Specified by:
connectionDown in interface ConnectionListener

shutdown

public void shutdown()
Shutdown the thread.


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

readProjects

public static java.util.List<java.lang.String> readProjects(java.io.Reader commandReader)
                                                     throws java.io.IOException
Reads a list of Gerrit projects from a Reader, one project per line. As from command: gerrit ls-projects.

Parameters:
commandReader - the Reader.
Returns:
a list of projects
Throws:
java.io.IOException - if something unfortunate happens.

isConnected

public boolean isConnected()
Returns:
if connected to Gerrit.

setConnected

public void setConnected(boolean connected)
Parameters:
connected - the connected to set.

setGerritProjects

public void setGerritProjects(java.util.List<java.lang.String> projects)
Sets the internal Gerrit project list.

Parameters:
projects - The list of projects

getGerritProjects

public java.util.List<java.lang.String> getGerritProjects()
Returns a string list of Gerrit projects.

Returns:
list of gerrit projects


Copyright © 2004-2012. All Rights Reserved.