java.lang.Object
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 Details

    • ReplicationConfig

      public ReplicationConfig(ReplicationConfig config)
      Copy constructor.
      Parameters:
      config - the ReplicationConfig object to be copied, never null.
    • ReplicationConfig

      @DataBoundConstructor public ReplicationConfig()
      Default constructor.
  • Method Details

    • isEnableReplication

      public boolean isEnableReplication()
      If we enable waiting on replication events.
      Returns:
      true if so.
    • setEnableReplication

      public void setEnableReplication(boolean enableReplication)
      Enable replication of events.
      Parameters:
      enableReplication - enable
    • getGerritSlaves

      public List<GerritSlave> getGerritSlaves()
      Get the list of GerritSlave objects.
      Returns:
      the list.
    • getReplicas

      public List<GerritSlave> getReplicas()
      Get the list of replication servers to use.
      Returns:
      the list.
    • setReplicas

      public void setReplicas(List<GerritSlave> replicas)
      Set list of configured replicas to use.
      Parameters:
      replicas - replicas.
    • isEnableSlaveSelectionInJobs

      public boolean isEnableSlaveSelectionInJobs()
      Whether slave selection in enabled in job config.
      Returns:
      true if so.
    • isEnableReplicaSelectionInJobs

      public boolean isEnableReplicaSelectionInJobs()
      Whether replica selection in enabled in job config.
      Returns:
      true if so.
    • setEnableReplicaSelectionInJobs

      public void setEnableReplicaSelectionInJobs(boolean enableReplicaSelectionInJobs)
      Set replica selection in enabled in job config.
      Parameters:
      enableReplicaSelectionInJobs - 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.
    • getDefaultReplicaId

      public String getDefaultReplicaId()
      The id of the default replica to be selected in job config.
      Returns:
      the id of default replica.
    • setDefaultReplicaId

      public void setDefaultReplicaId(String replicaId)
      Set default replica id.
      Parameters:
      replicaId - default id
    • 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.