View Javadoc

1   /*$Id: ConstantToolLocator.java,v 1.10 2005/03/13 07:13:39 clq2 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 new String[]{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.10  2005/03/13 07:13:39  clq2
76  merging jes-nww-686 common-nww-686 workflow-nww-996 scripting-nww-995 cea-nww-994
77  
78  Revision 1.9.92.1  2005/03/11 15:21:35  nw
79  adjusted locator so that it returns a list of endpoints to connect to.
80  we can get round-robin by shuffling the list.
81  dispatcher tries each endpoint in the list until can connect to one wihout throwing an exception.
82  
83  Revision 1.9  2004/08/13 09:07:26  nw
84  tidied imports
85  
86  Revision 1.8  2004/08/03 16:31:25  nw
87  simplified interface to dispatcher and locator components.
88  removed redundant implementations.
89  
90  Revision 1.7  2004/07/01 21:15:00  nw
91  added results-listener interface to jes
92  
93  Revision 1.6  2004/04/08 14:43:26  nw
94  added delete and abort job functionality
95  
96  Revision 1.5  2004/03/15 23:45:07  nw
97  improved javadoc
98  
99  Revision 1.4  2004/03/15 01:30:45  nw
100 factored component descriptor out into separate package
101 
102 Revision 1.3  2004/03/07 21:04:38  nw
103 merged in nww-itn05-pico - adds picocontainer
104 
105 Revision 1.2.4.1  2004/03/07 20:41:06  nw
106 added component descriptor interface impl,
107 refactored any primitive types passed into constructor
108 
109 Revision 1.2  2004/03/04 01:57:35  nw
110 major refactor.
111 upgraded to latest workflow object model.
112 removed internal facade
113 replaced community snippet with objects
114 
115 Revision 1.1  2004/03/03 01:13:42  nw
116 updated jes to work with regenerated workflow object model
117  
118 */