Hudson supports building on distributed machines, and the SCM plugin must be able to be executed on other machines than the master. There are two ways to add support for remoting for a SCM, either through a third party library or interacting with a command-line client. Depending on what type of interaction the SCM plugin uses it will deal with remoting in two separate ways.

Using a SCM library

Since all code is being executed on the master machine, the SCM must tell Hudson what code that should be executed on the slave. To do that you need to put the code into a Callable class and supply it to the FilePath.act(Callable) method.

public class CheckoutTask implements FileCallable<Boolean> {
    public Boolean invoke(File workspace, VirtualChannel channel) throws IOException {
        // This here code is executed on the slave.
        // Call the library method to check out the files
        return true;
    }
}
 public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, 
        BuildListener listener, File changelogFile) throws IOException, InterruptedException {  
    CheckoutTask task = new CheckoutTask();
    return workspace.act(task); // The CheckoutTask.invoke() method is now invoked
}

Using a command-line client

The Launcher class hides the difference between running programs locally vs remotely.

 public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, 
        BuildListener listener, File changelogFile) throws IOException, InterruptedException {
    String[] cmd = new String[2];
    cmd[0] = "scm-tool";
    cmd[1] = "checkout";
    int cmdResult = launcher.launch(cmd, new String[0], null, listener.getLogger(), workspace).join();
    return (cmdResult == 0);
}