View Javadoc

1   /*$Id: JesResultsListener.java,v 1.3 2004/07/09 09:30:28 nw Exp $
2    * Created on 01-Jul-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.jes.resultlistener;
12  
13  import org.astrogrid.component.descriptor.ComponentDescriptor;
14  import org.astrogrid.jes.jobscheduler.JobScheduler;
15  import org.astrogrid.jes.service.v1.cearesults.ResultsListener;
16  import org.astrogrid.jes.types.v1.cea.axis.JobIdentifierType;
17  import org.astrogrid.jes.types.v1.cea.axis.ResultListType;
18  
19  import org.apache.commons.logging.Log;
20  import org.apache.commons.logging.LogFactory;
21  
22  import java.rmi.RemoteException;
23  
24  import junit.framework.Test;
25  
26  /*** Jes Implementation of CEA's results listener interface.
27   * <p>
28   * stub component - delegates message to the scheduler, where it is processed
29   * (so its entered into the task queue).
30   * @author Noel Winstanley nw@jb.man.ac.uk 01-Jul-2004
31   *
32   */
33  public class JesResultsListener implements ResultsListener, ComponentDescriptor {
34      /***
35       * Commons Logger for this class
36       */
37      private static final Log logger = LogFactory.getLog(JesResultsListener.class);
38  
39      /*** Construct a new ResultListener
40       * 
41       */
42      public JesResultsListener(JobScheduler scheduler) {
43          this.scheduler = scheduler;
44      }
45      protected final JobScheduler scheduler;
46  
47      /***
48       * @see org.astrogrid.jes.service.v1.cearesults.ResultsListener#putResults(org.astrogrid.jes.types.v1.cea.axis.JobIdentifierType, org.astrogrid.jes.types.v1.cea.axis.ResultListType)
49       */
50      public void putResults(JobIdentifierType id, ResultListType resultList) throws RemoteException {
51          if (id  == null) {
52              logger.info("null id object encountered");
53              return;
54          }
55          if (resultList == null) {
56              logger.info("null result list object encountered");
57              return;
58          }
59  
60          logger.debug("Received results for " + id.toString());
61          try {
62              scheduler.reportResults(id,resultList);
63          } catch (Exception e) {
64              // no point reporting this back to cea - it'll be ignored.
65              logger.error("Could not pass on results message",e);
66          }
67            
68      }
69  
70      /***
71       * @see org.astrogrid.component.descriptor.ComponentDescriptor#getName()
72       */
73      public String getName() {
74          return "JesResultListener";
75      }
76  
77      /***
78       * @see org.astrogrid.component.descriptor.ComponentDescriptor#getDescription()
79       */
80      public String getDescription() {
81          return "Jes Implementation of CEA Results listener web interface";
82      }
83  
84      /***
85       * @see org.astrogrid.component.descriptor.ComponentDescriptor#getInstallationTest()
86       */
87      public Test getInstallationTest() {
88          return null;
89      }
90  }
91  
92  
93  /* 
94  $Log: JesResultsListener.java,v $
95  Revision 1.3  2004/07/09 09:30:28  nw
96  merged in scripting workflow interpreter from branch
97  nww-x-workflow-extensions
98  
99  Revision 1.2  2004/07/02 09:08:52  nw
100 improved logging
101 
102 Revision 1.1  2004/07/01 21:15:00  nw
103 added results-listener interface to jes
104  
105 */