01: /*
02: * $Id: CallConfig.java,v 1.28 2007/09/18 08:45:14 agoubard Exp $
03: *
04: * Copyright 2003-2007 Orange Nederland Breedband B.V.
05: * See the COPYRIGHT file for redistribution and use restrictions.
06: */
07: package org.xins.common.service;
08:
09: import java.io.Serializable;
10:
11: /**
12: * Configuration for a service call. Objects of this type specify certain
13: * aspects of <em>how</em> a call is executed. For example, for an HTTP
14: * service caller, a <code>CallConfig</code> object could specify what HTTP
15: * method (GET, POST, etc.) to use.
16: *
17: * <p>This base class only specifies the property <em>failOverAllowed</em>,
18: * which indicates whether fail-over is unconditionally allowed, even if the
19: * request was already received or even processed by the other end.
20: *
21: * <p>This class is not thread safe</p>
22: *
23: * @version $Revision: 1.28 $ $Date: 2007/09/18 08:45:14 $
24: * @author <a href="mailto:ernst@ernstdehaan.com">Ernst de Haan</a>
25: * @author <a href="mailto:anthony.goubard@japplis.com">Anthony Goubard</a>
26: *
27: * @since XINS 1.1.0
28: *
29: * @see ServiceCaller
30: * @see CallRequest
31: */
32: public class CallConfig implements Serializable {
33:
34: /**
35: * Flag that indicates whether fail-over is unconditionally allowed.
36: */
37: private boolean _failOverAllowed;
38:
39: /**
40: * Describes this configuration.
41: *
42: * <p>The implementation of this method in class {@link CallConfig} returns
43: * a descriptive string that contains the <em>failOverAllowed</em> setting.
44: *
45: * @return
46: * the description of this configuration, should never be <code>null</code>.
47: */
48: public String describe() {
49:
50: String description = "Call config with fail over ";
51: if (!_failOverAllowed) {
52: description += "not ";
53: }
54: description += "allowed.";
55:
56: return description;
57: }
58:
59: /**
60: * Returns a textual presentation of this object.
61: *
62: * <p>The implementation of this method in class {@link CallRequest}
63: * returns {@link #describe()}.
64: *
65: * @return
66: * a textual presentation of this object, should never be
67: * <code>null</code>.
68: */
69: public final String toString() {
70: return describe();
71: }
72:
73: /**
74: * Determines whether fail-over is unconditionally allowed.
75: *
76: * @return
77: * <code>true</code> if fail-over is unconditionally allowed, even if
78: * the request was already received or even processed by the other end,
79: * <code>false</code> otherwise.
80: */
81: public final boolean isFailOverAllowed() {
82: return _failOverAllowed;
83: }
84:
85: /**
86: * Configures whether fail-over is unconditionally allowed.
87: *
88: * @param allowed
89: * <code>true</code> if fail-over is unconditionally allowed, even if
90: * the request was already received or even processed by the other end,
91: * <code>false</code> otherwise.
92: */
93: public final void setFailOverAllowed(boolean allowed) {
94: _failOverAllowed = allowed;
95: }
96: }
|