edg.workload.userinterface.jclient
Class Shadow

java.lang.Object
  extended byedg.workload.userinterface.jclient.Shadow
All Implemented Interfaces:
java.lang.Runnable

public class Shadow
extends java.lang.Object
implements java.lang.Runnable

This class provides the core management for interactive jobs. once the edg-grid-console-shadow has started successfully and the job is running the user should interact with the submitted job (or might have attached to a previous job) At the end of the interaction the background bypass process should be killed and the I/O pipes have to be removed. This is done automatically by the 'detach' method. The shadow class must be used togheter with an implementation of the Listener interface, which actually performs the final visual interactivity with the user.

See Also:
Listener

Method Summary
 void detach()
          Finalize the Shadow instance.
 java.lang.String emptyOut()
          Read any possible message stored inside the output pipeline
 void finalize()
          Class Destructor
static java.lang.String getHost()
          Retrieve the Name of the host
 JobId getJobId()
          Return the JobId instance linked to the Shadow
 int getPid()
          Retrieve the process id corresponding to the shadow background process
 java.lang.String getPipeIn()
          Retrieve the name of the pipe that listens for the standard input
 java.lang.String getPipeOut()
          Retrieve the name of the pipe that listens for the standard output
 int getPort()
          retrieve the port where the shadow proces is listening to
 void run()
           
 void writeIn(java.lang.String str)
          Write into the input stream pipeline
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

finalize

public void finalize()
Class Destructor


run

public void run()
Specified by:
run in interface java.lang.Runnable

writeIn

public void writeIn(java.lang.String str)
             throws java.io.IOException,
                    java.lang.NoSuchFieldException
Write into the input stream pipeline

Parameters:
str - the string to be written
Throws:
throws - IOException If any error occurred while writing in the pipe
java.lang.NoSuchFieldException - if the inputPipe has not been created yet
java.io.IOException

emptyOut

public java.lang.String emptyOut()
                          throws java.io.IOException,
                                 java.lang.NoSuchFieldException
Read any possible message stored inside the output pipeline

Throws:
throws - IOException If any error occurred while reading in the pipe
java.lang.NoSuchFieldException - if the outputPipe has not been created yet
java.io.IOException

detach

public void detach()
            throws java.lang.NoSuchFieldException
Finalize the Shadow instance. Kill the background shadow process and delete the named pipes from the hard disc

Throws:
java.lang.NoSuchFieldException - if the pipes have not been created yet

getPipeIn

public java.lang.String getPipeIn()
                           throws java.lang.NoSuchFieldException
Retrieve the name of the pipe that listens for the standard input

Throws:
java.lang.NoSuchFieldException - the pipe has not been created yet

getPipeOut

public java.lang.String getPipeOut()
                            throws java.lang.NoSuchFieldException
Retrieve the name of the pipe that listens for the standard output

Throws:
java.lang.NoSuchFieldException - the pipe has not been created yet

getPid

public int getPid()
           throws java.lang.NoSuchFieldException,
                  java.io.IOException
Retrieve the process id corresponding to the shadow background process

Throws:
java.lang.NoSuchFieldException - the process has not been launched yet
java.io.IOException

getHost

public static java.lang.String getHost()
                                throws java.net.UnknownHostException
Retrieve the Name of the host

Throws:
java.net.UnknownHostException - the system is unable to retrieve host information

getPort

public int getPort()
            throws java.lang.NoSuchFieldException
retrieve the port where the shadow proces is listening to

Throws:
java.lang.NoSuchFieldException - the process has not been launched yet

getJobId

public JobId getJobId()
Return the JobId instance linked to the Shadow