View Javadoc

1   package fr.in2p3.jsaga.sync.job;
2   
3   import org.ogf.saga.SagaObject;
4   import org.ogf.saga.error.*;
5   import org.ogf.saga.job.*;
6   import org.ogf.saga.task.Async;
7   
8   import java.util.List;
9   
10  /**
11   * A JobService represents a resource management back-end.
12   *
13   * It allows for job creation, submission, and discovery. Deviation from the
14   * SAGA specification: the convenience method <code>runJob</code> is specified
15   * differently here, because as described in the SAGA specifications it cannot
16   * easily be specified in Java, since Java has no OUT parameters.
17   */
18  public interface SyncJobService extends SagaObject, Async {
19  
20      /**
21       * Creates a job instance as specified by the job description provided. The
22       * job is delivered in 'New' state. The provided job description is copied,
23       * so can be modified after this call.
24       *
25       * @param jd
26       *            the job description.
27       * @return the job.
28       */
29      public Job createJobSync(JobDescription jd) throws NotImplementedException,
30              AuthenticationFailedException, AuthorizationFailedException,
31              PermissionDeniedException, BadParameterException, TimeoutException,
32              NoSuccessException;
33  
34      /**
35       * Runs the specified command on the specified host. Deviation from the SAGA
36       * specification: the input, output and error stream OUT parameters are not
37       * specified here, since Java has no OUT parameters. Unfortunately, their
38       * absence, according to the SAGA specifications, implies a non-interactive
39       * job. Since interactive jobs should still be supported, a parameter is
40       * added here to specify whether the job is interactive. If interactive, the
41       * streams can be obtained from the Job using the {@link Job#getStdin()},
42       * {@link Job#getStdout()}, and {@link Job#getStderr()} methods.
43       *
44       * @param commandLine
45       *            the command to run.
46       * @param host
47       *            hostname of the host on which the command must be run. If this
48       *            is an empty string, the implementation is free to choose a
49       *            host.
50       * @param interactive
51       *            specifies whether the job is interactive.
52       * @return the job.
53       */
54      public Job runJobSync(String commandLine, String host, boolean interactive)
55              throws NotImplementedException, AuthenticationFailedException,
56              AuthorizationFailedException, PermissionDeniedException,
57              BadParameterException, TimeoutException, NoSuccessException;
58  
59      /**
60       * Runs the specified command, non-interactively, on the specified host.
61       * Deviation from the SAGA specification: the input, output and error stream
62       * OUT parameters are not specified here, since Java has no OUT parameters.
63       *
64       * @param commandLine
65       *            the command to run.
66       * @param host
67       *            hostname of the host on which the command must be run. If this
68       *            is an empty string, the implementation is free to choose a
69       *            host.
70       * @return the job.
71       */
72      public Job runJobSync(String commandLine, String host)
73              throws NotImplementedException, AuthenticationFailedException,
74              AuthorizationFailedException, PermissionDeniedException,
75              BadParameterException, TimeoutException, NoSuccessException;
76  
77      /**
78       * Runs the specified command on a host chosen by the implementation.
79       * Deviation from the SAGA specification: the input, output and error stream
80       * OUT parameters are not specified here, since Java has no OUT parameters.
81       * Unfortunately, their absence, according to the SAGA specifications,
82       * implies a non-interactive job. Since interactive jobs should still be
83       * supported, a parameter is added here to specify whether the job is
84       * interactive. If interactive, the streams can be obtained from the Job
85       * using the {@link Job#getStdin()}, {@link Job#getStdout()}, and
86       * {@link Job#getStderr()} methods.
87       *
88       * @param commandLine
89       *            the command to run.
90       * @param interactive
91       *            specifies whether the job is interactive.
92       * @return the job.
93       */
94      public Job runJobSync(String commandLine, boolean interactive)
95              throws NotImplementedException, AuthenticationFailedException,
96              AuthorizationFailedException, PermissionDeniedException,
97              BadParameterException, TimeoutException, NoSuccessException;
98  
99      /**
100      * Runs the specified command, non-interactively, on a host chosen by the
101      * implementation. Deviation from the SAGA specification: the input, output
102      * and error stream OUT parameters are not specified here, since Java has no
103      * OUT parameters.
104      *
105      * @param commandLine
106      *            the command to run.
107      * @return the job.
108      */
109     public Job runJobSync(String commandLine) throws NotImplementedException,
110             AuthenticationFailedException, AuthorizationFailedException,
111             PermissionDeniedException, BadParameterException, TimeoutException,
112             NoSuccessException;
113 
114     /**
115      * Obtains the list of jobs that are currently known to the resource
116      * manager.
117      *
118      * @return a list of job identifications.
119      */
120     public List<String> listSync() throws NotImplementedException,
121             AuthenticationFailedException, AuthorizationFailedException,
122             PermissionDeniedException, TimeoutException, NoSuccessException;
123 
124     /**
125      * Returns the job instance associated with the specified job
126      * identification.
127      *
128      * @param jobId
129      *            the job identification.
130      * @return the job instance.
131      */
132     public Job getJobSync(String jobId) throws NotImplementedException,
133             AuthenticationFailedException, AuthorizationFailedException,
134             PermissionDeniedException, BadParameterException,
135             DoesNotExistException, TimeoutException, NoSuccessException;
136 
137     /**
138      * Returns a job instance representing the calling application.
139      *
140      * @return the job instance.
141      */
142     public JobSelf getSelfSync() throws NotImplementedException,
143             AuthenticationFailedException, AuthorizationFailedException,
144             PermissionDeniedException, TimeoutException, NoSuccessException;
145 }