com.sonyericsson.hudson.plugins.gerrit.trigger.config
Class ReplicationConfig

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.config.ReplicationConfig

public class ReplicationConfig
extends Object

Each instance of this class holds data needed to trigger builds on replication events, and is associated to one specific GerritServer. A GerritServer can have at most one ReplicationConfig in its Config object.

Author:
Mathieu Wang <mathieu.wang@ericsson.com>

Constructor Summary
ReplicationConfig()
          Default constructor.
ReplicationConfig(ReplicationConfig config)
          Copy constructor.
 
Method Summary
static ReplicationConfig createReplicationConfigFromJSON(net.sf.json.JSONObject formData)
          Create a ReplicationConfig object from JSON.
 String getDefaultSlaveId()
          The id of the default slave to be selected in job config.
 GerritSlave getGerritSlave(String id, boolean defaultSlave)
          Get a specific Gerrit slave using its id.
 List<GerritSlave> getGerritSlaves()
          Get the list of GerritSlave objects.
 boolean isEnableReplication()
          If we enable waiting on replication events.
 boolean isEnableSlaveSelectionInJobs()
          Whether slave selection in enabled in job config.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationConfig

public ReplicationConfig(ReplicationConfig config)
Copy constructor.

Parameters:
config - the ReplicationConfig object to be copied, never null.

ReplicationConfig

public ReplicationConfig()
Default constructor.

Method Detail

isEnableReplication

public boolean isEnableReplication()
If we enable waiting on replication events.

Returns:
true if so.

getGerritSlaves

public List<GerritSlave> getGerritSlaves()
Get the list of GerritSlave objects.

Returns:
the list.

isEnableSlaveSelectionInJobs

public boolean isEnableSlaveSelectionInJobs()
Whether slave selection in enabled in job config.

Returns:
true if so.

getDefaultSlaveId

public String getDefaultSlaveId()
The id of the default slave to be selected in job config.

Returns:
the id of default slave.

getGerritSlave

public GerritSlave getGerritSlave(String id,
                                  boolean defaultSlave)
Get a specific Gerrit slave using its id.

Parameters:
id - the id of the slave.
defaultSlave - if true, will return the default slave when specified id do not exists.
Returns:
the Gerrit slave that has the given id, otherwise return null.

createReplicationConfigFromJSON

public static ReplicationConfig createReplicationConfigFromJSON(net.sf.json.JSONObject formData)
Create a ReplicationConfig object from JSON.

Parameters:
formData - the JSON data.
Returns:
the ReplicationConfig object.


Copyright © 2004-2014. All Rights Reserved.