View Javadoc

1   package fr.in2p3.jsaga.adaptor.job;
2   
3   import org.globus.io.gass.server.JobOutputListener;
4   
5   import java.io.IOException;
6   import java.io.OutputStream;
7   
8   /* ***************************************************
9   * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
10  * ***             http://cc.in2p3.fr/             ***
11  * ***************************************************
12  * File:   GatekeeperJobOutputListener
13  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
14  * Date:   13 mai 2008
15  * ***************************************************
16  * Description:                                      */
17  /**
18   *
19   */
20  public class GatekeeperJobOutputListener implements JobOutputListener {
21      private OutputStream m_outputStream;
22  
23      public GatekeeperJobOutputListener(OutputStream stdout) {
24          m_outputStream = stdout;
25      }
26  
27      public void outputChanged(String s) {
28          if (m_outputStream != null) {
29              try {
30                  m_outputStream.write(s.getBytes());
31              } catch (IOException e) {
32              }
33          } else {
34              //todo: save to buffer
35          }
36      }
37  
38      public void outputClosed() {
39          if (m_outputStream != null) {
40              try {
41                  m_outputStream.close();
42              } catch (IOException e) {
43              }
44          } else {
45              //todo
46          }
47      }
48  }