org.glite.wmsui.apij
Class Shadow

java.lang.Object
  extended byorg.glite.wmsui.apij.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 glite-wms-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.

Version:
0.1
Author:
Alessandro Maraschini
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()
          Retrieve the id of the Job for the current 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 shadow port
 void run()
          Run the listener
 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()
Run the listener

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

Returns:
the message read in the pipe (if any)
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

Returns:
the string representation of the input pipe name for the current job
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

Returns:
the string representation of the output pipe name for the current job
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

Returns:
the id of the process related to the running shadow
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

Returns:
the string representation of the current host
Throws:
java.net.UnknownHostException - the system is unable to retrieve host information

getPort

public int getPort()
            throws java.lang.NoSuchFieldException
Retrieve the shadow port

Returns:
the port where the shadow proces is listening to
Throws:
java.lang.NoSuchFieldException - the process has not been launched yet

getJobId

public JobId getJobId()
Retrieve the id of the Job for the current Shadow

Returns:
the JobId instance linked to the Shadow