View Javadoc

1   /*$Id: AbstractDelegate.java,v 1.1 2004/05/24 17:44:29 nw Exp $
2    * Created on 06-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.common.delegate;
12  
13  
14  import org.apache.commons.logging.Log;
15  
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  $Log: AbstractDelegate.java,v $
63  Revision 1.1  2004/05/24 17:44:29  nw
64  common baseclass and interface for delegates.
65  
66  Revision 1.3  2004/03/24 07:40:18  pah
67  remove jes references
68  
69  Revision 1.2  2004/03/23 12:51:25  pah
70  result of merge of app_pah_147
71  
72  Revision 1.1.2.1  2004/03/17 17:50:26  pah
73  refactored the factory to follow noels model
74  
75  Revision 1.2  2004/02/09 11:41:44  nw
76  merged in branch nww-it05-bz#85
77  
78  Revision 1.1.2.1  2004/02/06 18:11:21  nw
79  reworked the delegate classes
80  - introduced wrapper class and interfaces, plus separate impl
81  package with abstract base class. moved delegate classes into the correct
82  packages, deprecated old methods / classes. fitted in castor object model
83   
84  */