org.jvnet.hudson.remcom
Class WindowsRemoteProcessLauncher

java.lang.Object
  extended by org.jvnet.hudson.remcom.WindowsRemoteProcessLauncher

public class WindowsRemoteProcessLauncher
extends Object

Start a Windows process remotely.

This mechanism depends on the RPC and DCOM. We first remotely create a service on the target machine and starts it. This service will accept a named pipe connection, which is used to launch the process and shuttle back and forth stdin and stdout+stderr.

Author:
Kohsuke Kawaguchi

Constructor Summary
WindowsRemoteProcessLauncher(String hostName, org.jinterop.dcom.common.IJIAuthInfo credential)
           
 
Method Summary
 String getHostName()
          Host that this launcher represents.
 Process launch(String command, String workingDirectory)
          Launches a process remotely.
 void setConnectionTimeout(int milliseconds)
          Sets the connection timeout in milli-seconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowsRemoteProcessLauncher

public WindowsRemoteProcessLauncher(String hostName,
                                    org.jinterop.dcom.common.IJIAuthInfo credential)
Parameters:
hostName - Remote Windows host name or IP address to connect to.
credential - User account on the target Windows machine. This needs to have sufficient privilege to access administrative shares and install a service. Normally you have to be an administrator to be able to do this.
Method Detail

setConnectionTimeout

public void setConnectionTimeout(int milliseconds)
Sets the connection timeout in milli-seconds. Default is 5000.


getHostName

public String getHostName()
Host that this launcher represents.


launch

public Process launch(String command,
                      String workingDirectory)
               throws IOException,
                      org.jinterop.dcom.common.JIException,
                      InterruptedException
Launches a process remotely.

The resulting Process behaves slightly differently from a normal local Process in the following ways:

The communication channel to the remote Windows machine is terminated only when you check the exit code or when you destroy the process, so make sure to do so.

Parameters:
command - Command to execute. Note that on Windows the command line argument is a single string, unlike Unix. The implementation executes this through cmd.exe, so one can execute cmd.exe internal commands, such as echo, copy, etc.
workingDirectory - The working directory to launch the process with.
Throws:
IOException
org.jinterop.dcom.common.JIException
InterruptedException


Copyright © 2004-2011. All Rights Reserved.