01: /*
02: * This file is part of the QuickServer library
03: * Copyright (C) 2003-2005 QuickServer.org
04: *
05: * Use, modification, copying and distribution of this software is subject to
06: * the terms and conditions of the GNU Lesser General Public License.
07: * You should have received a copy of the GNU LGP License along with this
08: * library; if not, you can download a copy from <http://www.quickserver.org/>.
09: *
10: * For questions, suggestions, bug-reports, enhancement-requests etc.
11: * visit http://www.quickserver.org
12: *
13: */
14:
15: package org.quickserver.util.xmlreader;
16:
17: /**
18: * This class encapsulate the servers mode.
19: * The xml is <server-mode>...</server-mode>
20: * @author Akshathkumar Shetty
21: * @since 1.4.5
22: */
23: public class ServerMode implements java.io.Serializable {
24: private boolean blocking = true;
25:
26: /**
27: * Returns the blocking mode enable flag. Default is <code>true</code>.
28: * @return blocking
29: */
30: public boolean getBlocking() {
31: return blocking;
32: }
33:
34: /**
35: * Sets the blocking mode enable flag.
36: * XML Tag: <server-mode><blocking>true</blocking></server-mode>
37: * Allowed values = <code>true</code> | <code>false</code>
38: * @param blocking
39: */
40: public void setBlocking(boolean blocking) {
41: this .blocking = blocking;
42: }
43:
44: /**
45: * Returns XML config of this class.
46: */
47: public String toXML(String pad) {
48: if (pad == null)
49: pad = "";
50: StringBuffer sb = new StringBuffer();
51: sb.append(pad + "<server-mode>\n");
52: sb.append(pad + "\t<blocking>" + getBlocking()
53: + "</blocking>\n");
54: sb.append(pad + "</server-mode>\n");
55: return sb.toString();
56: }
57:
58: public String toString() {
59: if (getBlocking())
60: return "Blocking";
61: else
62: return "Non-Blocking";
63: }
64: }
|