genDevs.devsBridge
Class RemoteServerHelper

java.lang.Object
  extended by genDevs.devsBridge.RemoteServerHelper

public class RemoteServerHelper
extends java.lang.Object

Provides methods for starting Programmes by command line within a Tread and aborting them by interrupting this thread. It captures the first line of output to the first entry of the String array ior. By this servers can output the IOR and the calling programm can recieve it in a variable.

Author:
twutz

Constructor Summary
RemoteServerHelper()
           
 
Method Summary
static java.lang.Thread commandServerThread(java.lang.String[] cargs, java.lang.String abortCmd, java.io.PrintStream out, java.lang.String[] ior)
          Invokes server by creating a process and catches its output.
static java.lang.Thread commandServerThread(java.lang.String[] cargs, java.lang.String abortCmd, java.lang.String label, java.io.PrintWriter out, java.lang.String[] ior)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteServerHelper

public RemoteServerHelper()
Method Detail

commandServerThread

public static java.lang.Thread commandServerThread(java.lang.String[] cargs,
                                                   java.lang.String abortCmd,
                                                   java.io.PrintStream out,
                                                   java.lang.String[] ior)
Invokes server by creating a process and catches its output. The server should ouptut its IOR in the first line. This ior is returned as ior[0]. The server should listen for inputs and abort after an abort command (e.g. x ) has been entered. When the returned thread is interrupted, the abort command is send to the server and 500ms is is forced to stop.

Parameters:
cargs - The Command and its arguments.
abortCmd - The input to send to the server when it should abort.
out - The printStream, that servers output is written to.
ior - The IOR of the server (first line of output) is stored at ior[0]
Returns:
the A waiting thread, ready to abort the server on notify or intterupt.

commandServerThread

public static java.lang.Thread commandServerThread(java.lang.String[] cargs,
                                                   java.lang.String abortCmd,
                                                   java.lang.String label,
                                                   java.io.PrintWriter out,
                                                   java.lang.String[] ior)