hudson.tasks
Class CommandInterpreter

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Builder
          extended by hudson.tasks.CommandInterpreter
All Implemented Interfaces:
ExtensionPoint, Describable<Builder>, BuildStep
Direct Known Subclasses:
BatchFile, Shell

public abstract class CommandInterpreter
extends Builder

Common part between Shell and BatchFile.

Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
protected  String command
          Command to execute.
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
CommandInterpreter(String command)
           
 
Method Summary
abstract  String[] buildCommandLine(FilePath script)
           
 FilePath createScriptFile(FilePath dir)
          Creates a script file in a temporary name in the specified directory.
 String getCommand()
           
protected abstract  String getContents()
           
protected abstract  String getFileExtension()
           
 boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
          Runs the step over the given build and reports the progress to the listener.
 boolean perform(AbstractBuild<?,?> build, Launcher launcher, TaskListener listener)
           
 
Methods inherited from class hudson.tasks.Builder
all, getDescriptor, getRequiredMonitorService, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, prebuild
 

Field Detail

command

protected final String command
Command to execute. The format depends on the actual CommandInterpreter implementation.

Constructor Detail

CommandInterpreter

public CommandInterpreter(String command)
Method Detail

getCommand

public final String getCommand()

perform

public boolean perform(AbstractBuild<?,?> build,
                       Launcher launcher,
                       BuildListener listener)
                throws InterruptedException
Description copied from interface: BuildStep
Runs the step over the given build and reports the progress to the listener.

A plugin can contribute the action object to Actionable.getActions() so that a 'report' becomes a part of the persisted data of Build. This is how JUnit plugin attaches the test report to a build page, for example.

Specified by:
perform in interface BuildStep
Overrides:
perform in class BuildStepCompatibilityLayer
Returns:
true if the build can continue, false if there was an error and the build needs to be aborted.

Using the return value to indicate success/failure should be considered deprecated, and implementations are encouraged to throw AbortException to indicate a failure.

Throws:
InterruptedException - If the build is interrupted by the user (in an attempt to abort the build.) Normally the BuildStep implementations may simply forward the exception it got from its lower-level functions.

perform

public boolean perform(AbstractBuild<?,?> build,
                       Launcher launcher,
                       TaskListener listener)
                throws InterruptedException
Throws:
InterruptedException

createScriptFile

public FilePath createScriptFile(@Nonnull
                                 FilePath dir)
                          throws IOException,
                                 InterruptedException
Creates a script file in a temporary name in the specified directory.

Throws:
IOException
InterruptedException

buildCommandLine

public abstract String[] buildCommandLine(FilePath script)

getContents

protected abstract String getContents()

getFileExtension

protected abstract String getFileExtension()


Copyright © 2004-2013. All Rights Reserved.