View Javadoc

1   /*$Id: ConstantToolLocator.java,v 1.9 2004/08/13 09:07:26 nw Exp $
2    * Created on 27-Feb-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.jobscheduler.locator;
12  
13  import org.astrogrid.component.descriptor.ComponentDescriptor;
14  import org.astrogrid.jes.JesException;
15  import org.astrogrid.jes.jobscheduler.Locator;
16  import org.astrogrid.workflow.beans.v1.Tool;
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  
21  import java.net.URL;
22  
23  import junit.framework.Test;
24  
25  /*** Constant tool locator - always resolves tool names to the same, constant endpoint.
26   * @author Noel Winstanley nw@jb.man.ac.uk 27-Feb-2004
27   *
28   */
29  public class ConstantToolLocator implements Locator , ComponentDescriptor{
30      private static final Log logger = LogFactory.getLog(ConstantToolLocator.class);
31      /*** Construct a new ConstantToolLocator
32       * 
33       */
34      public ConstantToolLocator(URL endpoint,String interfaceName) {
35          this.endpoint = endpoint;
36          this.interfaceName = interfaceName;
37      }
38      
39      protected final URL endpoint;
40      protected final String interfaceName;
41      /***
42       * @see org.astrogrid.jes.jobscheduler.Locator#locateTool(org.astrogrid.jes.job.JobStep)
43       */
44      public String locateTool(Tool tool) throws JesException {
45          logger.debug("constant tool locator: for " + tool.getName() + " returning " + endpoint.toString());
46          return endpoint.toString();
47          
48      }
49  
50      /***
51       * @see org.astrogrid.jes.component.ComponentDescriptor#getName()
52       */
53      public String getName() {
54          return "ConstantToolLocator";
55      }
56      /***
57       * @see org.astrogrid.jes.component.ComponentDescriptor#getDescription()
58       */
59      public String getDescription() {
60          return "Always returns the same tool location\n" + 
61              "set to\n endpoint: " + endpoint.toString() + "\n" + 
62              "interface: " + interfaceName ;
63      }
64      /***
65       * @see org.astrogrid.jes.component.ComponentDescriptor#getInstallationTest()
66       */
67      public Test getInstallationTest() {
68          return null;
69      }
70  }
71  
72  
73  /* 
74  $Log: ConstantToolLocator.java,v $
75  Revision 1.9  2004/08/13 09:07:26  nw
76  tidied imports
77  
78  Revision 1.8  2004/08/03 16:31:25  nw
79  simplified interface to dispatcher and locator components.
80  removed redundant implementations.
81  
82  Revision 1.7  2004/07/01 21:15:00  nw
83  added results-listener interface to jes
84  
85  Revision 1.6  2004/04/08 14:43:26  nw
86  added delete and abort job functionality
87  
88  Revision 1.5  2004/03/15 23:45:07  nw
89  improved javadoc
90  
91  Revision 1.4  2004/03/15 01:30:45  nw
92  factored component descriptor out into separate package
93  
94  Revision 1.3  2004/03/07 21:04:38  nw
95  merged in nww-itn05-pico - adds picocontainer
96  
97  Revision 1.2.4.1  2004/03/07 20:41:06  nw
98  added component descriptor interface impl,
99  refactored any primitive types passed into constructor
100 
101 Revision 1.2  2004/03/04 01:57:35  nw
102 major refactor.
103 upgraded to latest workflow object model.
104 removed internal facade
105 replaced community snippet with objects
106 
107 Revision 1.1  2004/03/03 01:13:42  nw
108 updated jes to work with regenerated workflow object model
109  
110 */