View Javadoc

1   /*$Id: JesJobExecutionService.java,v 1.4 2004/12/03 14:47:41 jdt Exp $
2    * Created on 09-Mar-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10  **/
11  package org.astrogrid.portal.workflow.impl;
12  
13  import org.astrogrid.community.beans.v1.Account;
14  import org.astrogrid.jes.delegate.JesDelegateException;
15  import org.astrogrid.jes.delegate.JesDelegateFactory;
16  import org.astrogrid.jes.delegate.JobController;
17  import org.astrogrid.jes.delegate.JobSummary;
18  import org.astrogrid.portal.workflow.intf.JobExecutionService;
19  import org.astrogrid.portal.workflow.intf.WorkflowInterfaceException;
20  import org.astrogrid.workflow.beans.v1.Workflow;
21  import org.astrogrid.workflow.beans.v1.execution.JobURN;
22  import org.astrogrid.workflow.beans.v1.execution.WorkflowSummaryType;
23  
24  import java.net.URL;
25  
26  /*** Implementation of JobExecutionService over a Jes JobController delegate.
27   * @author Noel Winstanley nw@jb.man.ac.uk 09-Mar-2004
28   *
29   */
30  public class JesJobExecutionService implements JobExecutionService {
31  
32      /*** fallback constructor - let jes delegate try to find its own endpoint.
33       *  Construct a new JesJobExecutionService
34       * @param endpoint
35       */
36      public JesJobExecutionService() {
37          controller = JesDelegateFactory.createJobController();
38          assert controller != null;
39      }
40  
41      /*** Construct a new JesJobExecutionService
42       * 
43       */
44      public JesJobExecutionService(String endpoint) {
45          controller = JesDelegateFactory.createJobController(endpoint);
46      }
47      protected final JobController controller;
48      /***
49       * @see org.astrogrid.portal.workflow.intf.JobExecutionService#submitWorkflow(org.astrogrid.workflow.beans.v1.Workflow)
50       */
51      public JobURN submitWorkflow(Workflow workflow) throws WorkflowInterfaceException {
52          try {
53          return controller.submitWorkflow(workflow);
54          } catch(JesDelegateException e) {
55              throw new WorkflowInterfaceException(e);
56          }
57      }
58      /***
59       * @see org.astrogrid.portal.workflow.intf.JobExecutionService#deleteJob(org.astrogrid.workflow.beans.v1.execution.JobURN)
60       */
61      public void deleteJob(JobURN jobURN) throws WorkflowInterfaceException {
62          try {
63              controller.deleteJob(jobURN);
64          } catch (JesDelegateException e) {
65              throw new WorkflowInterfaceException(e);
66          }
67      }
68      /***
69       * @see org.astrogrid.portal.workflow.intf.JobExecutionService#cancelJob(org.astrogrid.workflow.beans.v1.execution.JobURN)
70       */
71      public void cancelJob(JobURN jobURN) throws WorkflowInterfaceException {
72          try {
73              controller.cancelJob(jobURN);
74          } catch (JesDelegateException e) {
75              throw new WorkflowInterfaceException(e);
76          }
77      }
78      /***
79       * @see org.astrogrid.portal.workflow.intf.JobExecutionService#readJob(org.astrogrid.workflow.beans.v1.execution.JobURN)
80       */
81      public Workflow readJob(JobURN jobURN) throws WorkflowInterfaceException {
82          try { 
83              return controller.readJob(jobURN);
84          } catch (JesDelegateException e) {
85              throw new WorkflowInterfaceException(e);
86          }
87      }
88      /***
89       * @see org.astrogrid.portal.workflow.intf.JobExecutionService#readJobList(org.astrogrid.community.beans.v1.Account)
90       */
91      public JobSummary[] readJobList(Account account) throws WorkflowInterfaceException {
92          try {
93              return controller.readJobList(account);
94          } catch (JesDelegateException e) {
95              throw new WorkflowInterfaceException(e);
96          }
97                     
98      }
99  
100     /***
101      * @see org.astrogrid.portal.workflow.intf.JobExecutionService#listJobs(org.astrogrid.community.beans.v1.Account)
102      */
103     public WorkflowSummaryType[] listJobs(Account account) throws WorkflowInterfaceException {
104         try {
105             return controller.listJobs(account);
106         } catch (JesDelegateException e) {
107             throw new WorkflowInterfaceException(e);
108         }
109     }
110     
111     
112 }
113 
114 
115 /* 
116 $Log: JesJobExecutionService.java,v $
117 Revision 1.4  2004/12/03 14:47:41  jdt
118 Merges from workflow-nww-776
119 
120 Revision 1.3.124.1  2004/12/01 21:08:11  nw
121 fixed to work with new summary type
122 
123 Revision 1.3  2004/03/15 17:01:01  nw
124 loosened type of endpoint for JesJobExecutionService from URL to String -
125 allows the dummy urn:test to be passed in.
126 
127 Revision 1.2  2004/03/11 13:53:36  nw
128 merged in branch bz#236 - implementation of interfaces
129 
130 Revision 1.1.2.2  2004/03/11 13:36:10  nw
131 added implementations for the workflow interfaces
132 
133 Revision 1.1.2.1  2004/03/09 17:41:59  nw
134 created a bunch of implementations,
135  
136 */