org.jvnet.hudson.remcom
Class WindowsRemoteProcessLauncher

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

public class WindowsRemoteProcessLauncher
extends java.lang.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(java.lang.String hostName, org.jinterop.dcom.common.IJIAuthInfo credential)
           
 
Method Summary
 java.lang.String getHostName()
          Host that this launcher represents.
 java.lang.Process launch(java.lang.String command, java.lang.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(java.lang.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 java.lang.String getHostName()
Host that this launcher represents.


launch

public java.lang.Process launch(java.lang.String command,
                                java.lang.String workingDirectory)
                         throws java.io.IOException,
                                org.jinterop.dcom.common.JIException,
                                java.lang.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:
java.io.IOException
org.jinterop.dcom.common.JIException
java.lang.InterruptedException


Copyright © 2010. All Rights Reserved.