1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.jes.delegate.impl;
12
13 import org.astrogrid.jes.delegate.Delegate;
14
15 import org.apache.commons.logging.Log;
16
17 /***
18 * abstract class that captures common functionality of all jes delegates
19 * (in fact, probably all astrogrid delegates).
20 * @author Noel Winstanley nw@jb.man.ac.uk 06-Feb-2004
21 *
22 */
23 public abstract class AbstractDelegate implements Delegate {
24 protected static final Log log = org.apache.commons.logging.LogFactory.getLog(AbstractDelegate.class);
25 protected static final int DEFAULT_TIMEOUT = 60000;
26
27 protected String targetEndPoint = null;
28
29 protected int timeout = DEFAULT_TIMEOUT;
30
31 public void setTargetEndPoint(String targetEndPoint) {
32 this.targetEndPoint = targetEndPoint;
33 }
34
35 public String getTargetEndPoint() {
36 return targetEndPoint;
37 }
38
39 public void setTimeout(int timeout) {
40 this.timeout = timeout;
41 }
42
43 public int getTimeout() {
44 return timeout;
45 }
46
47 /*** helper method for determining when to create a 'test' delegate */
48 protected static boolean isTestDelegateRequired(String endpoint) {
49 if (endpoint == null || endpoint.trim().length() == 0) {
50 log.warn("Null endpoint passed in - selecting test delegate. Select this delegat explicitly by using the endpoint " + TEST_URI);
51 return true;
52 }
53 if (endpoint.equalsIgnoreCase(TEST_URI)) {
54 log.info("Creating test delegate");
55 return true;
56 } else {
57 return false;
58 }
59 }
60 }
61
62
63
64
65
66
67
68
69
70
71
72