View Javadoc

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