1 package org.astrogrid.jes.delegate.impl;
2
3 import org.astrogrid.community.beans.v1.Account;
4 import org.astrogrid.jes.delegate.JesDelegateException;
5 import org.astrogrid.jes.delegate.JobSummary;
6 import org.astrogrid.workflow.beans.v1.execution.WorkflowSummaryType;
7
8
9 /***
10 * Abstract class for a job controller delegate.
11 */
12 public abstract class JobControllerDelegate extends AbstractDelegate implements org.astrogrid.jes.delegate.JobController {
13
14 public static JobControllerDelegate buildDelegate( String targetEndPoint ){
15 return JobControllerDelegate.buildDelegate( targetEndPoint, DEFAULT_TIMEOUT ) ;
16 }
17
18
19 public static JobControllerDelegate buildDelegate( String targetEndPoint
20 , int timeout ) {
21
22 if( AbstractDelegate.isTestDelegateRequired(targetEndPoint)){
23 return new TestJobControllerDelegateImpl( ) ;
24 } else {
25 return new JobControllerDelegateImpl(targetEndPoint, timeout ) ;
26 }
27 }
28
29
30
31 /*** @deprecated just here for backwards compatabiltiy. implemented in terms of listJobs*/
32 public final JobSummary[] readJobList(Account acc) throws JesDelegateException {
33 WorkflowSummaryType[] arr = listJobs(acc);
34 JobSummary[] results = new JobSummary[arr.length];
35 for (int i = 0; i < arr.length; i++) {
36 results[i] = new JobSummary(arr[i]);
37 }
38 return results;
39 }
40 }