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

java.lang.Object
  extended by hudson.Plugin
      extended by com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl
All Implemented Interfaces:
hudson.model.Saveable

public class PluginImpl
extends hudson.Plugin

Main Plugin entrance.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.Plugin
hudson.Plugin.DummyImpl
 
Field Summary
static String DISPLAY_NAME
          What to call this plug-in to humans.
static hudson.security.Permission MANUAL_TRIGGER
          The permission that allows users to perform the ManualTriggerAction.
static hudson.security.PermissionGroup PERMISSION_GROUP
          Any special permissions needed by this plugin are grouped into this.
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
PluginImpl()
          Constructor.
 
Method Summary
 boolean addListener(ConnectionListener listener)
          Adds a Connection Listener to the manager.
 void addListener(GerritEventListener listener)
          Adds a listener to the EventManager.
protected static void doXStreamRegistrations()
          Registers XStream alias and converters to handle backwards compatibility with old data.
 IGerritHudsonTriggerConfig getConfig()
          Gets the global config.
 List<String> getGerritProjects()
          Returns a list of Gerrit projects.
static PluginImpl getInstance()
          Returns this singleton instance.
 void removeListener(ConnectionListener listener)
          Removes a connection listener from the manager.
 void removeListener(GerritEventListener listener)
          Removes a listener from the manager.
 void restartConnection()
          Restarts the connection to Gerrit stream of events.
 void start()
           
 void startConnection()
          Starts the connection to Gerrit stream of events.
 void stop()
           
 void stopConnection()
          Stops the connection to Gerrit stream of events.
 void triggerEvent(GerritEvent event)
          Adds the given event to the stream of events.
 
Methods inherited from class hudson.Plugin
configure, configure, doDynamic, getConfigXml, load, postInitialize, save, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISPLAY_NAME

public static final String DISPLAY_NAME
What to call this plug-in to humans.

See Also:
Constant Field Values

PERMISSION_GROUP

public static final hudson.security.PermissionGroup PERMISSION_GROUP
Any special permissions needed by this plugin are grouped into this.


MANUAL_TRIGGER

public static final hudson.security.Permission MANUAL_TRIGGER
The permission that allows users to perform the ManualTriggerAction.

Constructor Detail

PluginImpl

public PluginImpl()
Constructor.

Method Detail

getConfig

public IGerritHudsonTriggerConfig getConfig()
Gets the global config.

Returns:
the config.

getInstance

public static PluginImpl getInstance()
Returns this singleton instance.

Returns:
the singleton.

start

public void start()
           throws Exception
Overrides:
start in class hudson.Plugin
Throws:
Exception

doXStreamRegistrations

protected static void doXStreamRegistrations()
Registers XStream alias and converters to handle backwards compatibility with old data.


stop

public void stop()
          throws Exception
Overrides:
stop in class hudson.Plugin
Throws:
Exception

addListener

public void addListener(GerritEventListener listener)
Adds a listener to the EventManager. The listener will receive all events from Gerrit.

Parameters:
listener - the listener.
See Also:
GerritHandler.addListener(com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritEventListener)

removeListener

public void removeListener(GerritEventListener listener)
Removes a listener from the manager.

Parameters:
listener - the listener to remove.
See Also:
GerritHandler.removeListener(com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritEventListener)

removeListener

public void removeListener(ConnectionListener listener)
Removes a connection listener from the manager.

Parameters:
listener - the listener to remove.

startConnection

public void startConnection()
                     throws Exception
Starts the connection to Gerrit stream of events.

Throws:
Exception - if it is so unfortunate.

stopConnection

public void stopConnection()
                    throws Exception
Stops the connection to Gerrit stream of events.

Throws:
Exception - if it is so unfortunate.

restartConnection

public void restartConnection()
                       throws Exception
Restarts the connection to Gerrit stream of events.

Throws:
Exception - if it is so unfortunate.

addListener

public boolean addListener(ConnectionListener listener)
Adds a Connection Listener to the manager. Return the current connection status so that listeners that are added later than a connectionestablished/ connectiondown will get the current connection status.

Parameters:
listener - the listener.
Returns:
the connection status.

getGerritProjects

public List<String> getGerritProjects()
Returns a list of Gerrit projects.

Returns:
list of gerrit projects

triggerEvent

public void triggerEvent(GerritEvent event)
Adds the given event to the stream of events. It gets added to the same event queue as any event coming from the stream-events command in Gerrit.

Parameters:
event - the event.
See Also:
GerritHandler.triggerEvent(com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.GerritEvent)


Copyright © 2004-2011. All Rights Reserved.