org.jvnet.jenkins.plugins.nodelabelparameter
Class NodeParameterDefinition

java.lang.Object
  extended by hudson.model.ParameterDefinition
      extended by hudson.model.SimpleParameterDefinition
          extended by org.jvnet.jenkins.plugins.nodelabelparameter.NodeParameterDefinition
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.model.ParameterDefinition>, java.io.Serializable

public class NodeParameterDefinition
extends hudson.model.SimpleParameterDefinition

Defines a build parameter used to select the node where a job should be executed on. Although it is possible to define the node name in the UI at "restrict where this job should run", but that would tide a job to a fix node. This parameter actually allows to define a list of possible nodes and ask the user before execution.

Author:
domi
See Also:
Serialized Form

Nested Class Summary
static class NodeParameterDefinition.DescriptorImpl
           
 
Nested classes/interfaces inherited from class hudson.model.ParameterDefinition
hudson.model.ParameterDefinition.ParameterDescriptor
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static java.lang.String ALL_NODES
           
 java.util.List<java.lang.String> allowedSlaves
           
 java.lang.String defaultValue
           
 
Fields inherited from class hudson.model.ParameterDefinition
LIST
 
Constructor Summary
NodeParameterDefinition(java.lang.String name, java.lang.String description, java.lang.String defaultValue, java.util.List<java.lang.String> allowedSlaves, java.lang.String triggerIfResult)
           
 
Method Summary
 hudson.model.ParameterDefinition copyWithDefaultValue(hudson.model.ParameterValue defaultValueObj)
           
 hudson.model.ParameterValue createValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)
           
 hudson.model.ParameterValue createValue(java.lang.String value)
           
 java.util.List<java.lang.String> getAllowedNodesOrAll()
          Returns a list of nodes the job could run on.
 boolean getAllowMultiNodeSelection()
           
 NodeParameterValue getDefaultParameterValue()
          e.g.
static java.util.List<java.lang.String> getSlaveNames()
          Gets the names of all configured slaves, regardless whether they are online.
static java.util.List<java.lang.String> getSlaveNamesForSelection()
          returns all available nodes plus an identifier to identify all slaves at position one.
 java.lang.String getTriggerIfResult()
           
 boolean isTriggerConcurrentBuilds()
           
 
Methods inherited from class hudson.model.SimpleParameterDefinition
createValue, createValue
 
Methods inherited from class hudson.model.ParameterDefinition
all, getDescription, getDescriptor, getName, getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_NODES

public static final java.lang.String ALL_NODES
See Also:
Constant Field Values

allowedSlaves

public final java.util.List<java.lang.String> allowedSlaves

defaultValue

public final java.lang.String defaultValue
Constructor Detail

NodeParameterDefinition

@DataBoundConstructor
public NodeParameterDefinition(java.lang.String name,
                                                    java.lang.String description,
                                                    java.lang.String defaultValue,
                                                    java.util.List<java.lang.String> allowedSlaves,
                                                    java.lang.String triggerIfResult)
Method Detail

getDefaultParameterValue

public NodeParameterValue getDefaultParameterValue()
e.g. what to show if a build is triggered by hand?

Overrides:
getDefaultParameterValue in class hudson.model.ParameterDefinition

createValue

public hudson.model.ParameterValue createValue(java.lang.String value)
Specified by:
createValue in class hudson.model.SimpleParameterDefinition

copyWithDefaultValue

public hudson.model.ParameterDefinition copyWithDefaultValue(hudson.model.ParameterValue defaultValueObj)
Overrides:
copyWithDefaultValue in class hudson.model.ParameterDefinition

getAllowedNodesOrAll

public java.util.List<java.lang.String> getAllowedNodesOrAll()
Returns a list of nodes the job could run on. If allowed nodes is empty, it falls back to all nodes

Returns:
list of nodenames.

getTriggerIfResult

public java.lang.String getTriggerIfResult()
Returns:
the triggerIfResult

getSlaveNamesForSelection

public static java.util.List<java.lang.String> getSlaveNamesForSelection()
returns all available nodes plus an identifier to identify all slaves at position one.

Returns:
list of node names

getSlaveNames

public static java.util.List<java.lang.String> getSlaveNames()
Gets the names of all configured slaves, regardless whether they are online.

Returns:
list with all slave names

createValue

public hudson.model.ParameterValue createValue(org.kohsuke.stapler.StaplerRequest req,
                                               net.sf.json.JSONObject jo)
Specified by:
createValue in class hudson.model.ParameterDefinition

getAllowMultiNodeSelection

public boolean getAllowMultiNodeSelection()
Returns:
the allowMultiNodeSelection

isTriggerConcurrentBuilds

public boolean isTriggerConcurrentBuilds()
Returns:
the triggerConcurrentBuilds


Copyright © 2004-2011. All Rights Reserved.