com.seitenbau.jenkins.plugins.dynamicparameter
Class BaseParameterDefinition

java.lang.Object
  extended by hudson.model.ParameterDefinition
      extended by hudson.model.SimpleParameterDefinition
          extended by com.seitenbau.jenkins.plugins.dynamicparameter.BaseParameterDefinition
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.model.ParameterDefinition>, Serializable
Direct Known Subclasses:
ScriptlerParameterDefinition, ScriptParameterDefinition

public abstract class BaseParameterDefinition
extends hudson.model.SimpleParameterDefinition

Base class for all script parameter definition classes.

See Also:
Serialized Form

Nested Class Summary
 
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
protected static Logger logger
          Logger.
 
Fields inherited from class hudson.model.ParameterDefinition
LIST
 
Constructor Summary
protected BaseParameterDefinition(String name, String description, String uuid, boolean remote)
          Constructor.
 
Method Summary
protected  hudson.model.StringParameterValue checkParameterValue(hudson.model.StringParameterValue value)
          Checks the validity of the given parameter value.
 hudson.model.ParameterValue createValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)
           
 hudson.model.ParameterValue createValue(String value)
          Return a Parameter value object for a command line parameter.
 List<Object> getScriptResultAsList()
          Get the script result as a list.
 String getScriptResultAsString()
          Get the script result as a string.
 UUID getUUID()
          Get unique id for this parameter definition.
 boolean isRemote()
          Should the script be executed to on a remote slave?
protected abstract  hudson.remoting.Callable<Object,Throwable> prepareLocalCall()
          Prepare a local call.
protected abstract  hudson.remoting.Callable<Object,Throwable> prepareRemoteCall(hudson.remoting.VirtualChannel channel)
          Prepare a remote call.
 
Methods inherited from class hudson.model.SimpleParameterDefinition
createValue, createValue
 
Methods inherited from class hudson.model.ParameterDefinition
all, copyWithDefaultValue, getDefaultParameterValue, getDescription, getDescriptor, getName, getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
Logger.

Constructor Detail

BaseParameterDefinition

protected BaseParameterDefinition(String name,
                                  String description,
                                  String uuid,
                                  boolean remote)
Constructor.

Parameters:
name - parameter name
description - parameter description
uuid - UUID of the parameter definition
remote - flag showing if the script should be executed remotely
Method Detail

createValue

public hudson.model.ParameterValue createValue(String value)
Return a Parameter value object for a command line parameter.

Specified by:
createValue in class hudson.model.SimpleParameterDefinition

isRemote

public final boolean isRemote()
Should the script be executed to on a remote slave?

Returns:
true if the script should be executed remotely

getUUID

public final UUID getUUID()
Get unique id for this parameter definition.

Returns:
the _uuid

getScriptResultAsList

public final List<Object> getScriptResultAsList()
Get the script result as a list.

Returns:
list of values if the script returns a non-null list; Collections.EMPTY_LIST, otherwise

getScriptResultAsString

public final String getScriptResultAsString()
Get the script result as a string.

Returns:
the default value generated by the script or null

createValue

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

checkParameterValue

protected hudson.model.StringParameterValue checkParameterValue(hudson.model.StringParameterValue value)
Checks the validity of the given parameter value. The default implementation does nothing and should be overridden.

Parameters:
value - parameter value to check
Returns:
if the value is valid the same parameter value
Throws:
IllegalArgumentException - if the value in not valid

prepareLocalCall

protected abstract hudson.remoting.Callable<Object,Throwable> prepareLocalCall()
                                                                        throws Exception
Prepare a local call.

Returns:
call instance
Throws:
Exception - if a call instance cannot be created

prepareRemoteCall

protected abstract hudson.remoting.Callable<Object,Throwable> prepareRemoteCall(hudson.remoting.VirtualChannel channel)
                                                                         throws Exception
Prepare a remote call.

Parameters:
channel - channel to the remote slave where the call will be executed
Returns:
call instance
Throws:
Exception - if a call instance cannot be created


Copyright © 2004-2012. All Rights Reserved.