1
2
3
4
5
6
7
8
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118