View Javadoc

1   package fr.in2p3.jsaga.adaptor.job;
2   
3   import fr.in2p3.jsaga.adaptor.base.defaults.Default;
4   import fr.in2p3.jsaga.adaptor.base.usage.Usage;
5   import fr.in2p3.jsaga.adaptor.job.monitor.JobStatus;
6   import fr.in2p3.jsaga.adaptor.job.monitor.QueryIndividualJob;
7   import fr.in2p3.jsaga.adaptor.security.SecurityCredential;
8   import org.ogf.saga.error.*;
9   
10  import java.util.Map;
11  
12  /* ***************************************************
13   * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
14   * ***             http://cc.in2p3.fr/             ***
15   * ***************************************************
16   * File:   UnmonitoredJobMonitorAdaptor
17   * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
18   * Date:   24 juin 2010
19   * ***************************************************
20   * Description:                                      */
21  /**
22   *
23   */
24  public class UnmonitoredJobMonitorAdaptor implements QueryIndividualJob {
25      private boolean m_cancelled;
26  
27      public UnmonitoredJobMonitorAdaptor() {
28          m_cancelled = false;
29      }
30  
31      void cancel() {
32          m_cancelled = true;
33      }
34  
35      public String getType() {
36          return "unmonitored";
37      }
38  
39      public Usage getUsage() {
40          return null;
41      }
42      public Default[] getDefaults(Map attributes) throws IncorrectStateException {
43          return null;
44      }
45      public int getDefaultPort() {
46          return 0;
47      }
48      public Class[] getSupportedSecurityCredentialClasses() {
49          return null;
50      }
51      public void setSecurityCredential(SecurityCredential credential) {
52      }
53  
54      public void connect(String userInfo, String host, int port, String basePath, Map attributes) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, IncorrectURLException, BadParameterException, TimeoutException, NoSuccessException {
55      }
56      public void disconnect() throws NoSuccessException {
57      }
58  
59      public JobStatus getStatus(String nativeJobId) throws TimeoutException, NoSuccessException {
60          return new JobStatus(nativeJobId, null, null){
61              public String getModel() {return "unmonitored";}
62              public SubState getSubState() {
63                  if (m_cancelled) {
64                      return SubState.CANCELED;
65                  } else {
66                      return SubState.RUNNING_ACTIVE;
67                  }
68              }
69          };
70      }
71  }