com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger
Class GerritConnectionListener

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritConnectionListener
All Implemented Interfaces:
com.sonymobile.tools.gerrit.gerritevents.ConnectionListener

public class GerritConnectionListener
extends Object
implements com.sonymobile.tools.gerrit.gerritevents.ConnectionListener

Every instance of this class is a connection listener to a specific Gerrit server. It keeps track of the connection status and information about the version and features of the Gerrit server.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Constructor Summary
GerritConnectionListener(String serverName)
          Default constructor.
 
Method Summary
 void checkGerritVersionFeatures()
          Checks the Gerrit version that we are connected to.
 void connectionDown()
           
 void connectionEstablished()
           
 boolean equals(Object obj)
           
 List<GerritVersionChecker.Feature> getDisabledFeatures()
          A list of the features that have been disabled due to old Gerrit version of a specific Gerrit server.
 String getName()
          Return the name of the server to which this listener is attached.
 int hashCode()
           
 boolean isConnected()
          Return whether the listener is connected.
 boolean isSnapShotGerrit()
          Return whether the Gerrit server is a snapshot version.
 void setConnected(boolean connected)
          Set the connection status.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GerritConnectionListener

public GerritConnectionListener(String serverName)
Default constructor. Initializes serverName and performs a Gerrit version check

Parameters:
serverName - the name of the Gerrit server.
Method Detail

getName

public String getName()
Return the name of the server to which this listener is attached.

Returns:
the name of the server.

isConnected

public boolean isConnected()
Return whether the listener is connected.

Returns:
whether it is connected

setConnected

public void setConnected(boolean connected)
Set the connection status.

Parameters:
connected - the connection status

isSnapShotGerrit

public boolean isSnapShotGerrit()
Return whether the Gerrit server is a snapshot version.

Returns:
whether the Gerrit server is a snapshot version

getDisabledFeatures

public List<GerritVersionChecker.Feature> getDisabledFeatures()
A list of the features that have been disabled due to old Gerrit version of a specific Gerrit server.

Returns:
the list.

connectionEstablished

public void connectionEstablished()
Specified by:
connectionEstablished in interface com.sonymobile.tools.gerrit.gerritevents.ConnectionListener
See Also:
ConnectionListener.connectionEstablished()

connectionDown

public void connectionDown()
Specified by:
connectionDown in interface com.sonymobile.tools.gerrit.gerritevents.ConnectionListener
See Also:
ConnectionListener.connectionDown()

checkGerritVersionFeatures

public void checkGerritVersionFeatures()
Checks the Gerrit version that we are connected to. If it is a snapshot or if any features will be disabled because of this. It should be called whenever we got some new connection status.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2004-2014. All Rights Reserved.