KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quickserver > util > xmlreader > ServerMode


1 /*
2  * This file is part of the QuickServer library
3  * Copyright (C) 2003-2005 QuickServer.org
4  *
5  * Use, modification, copying and distribution of this software is subject to
6  * the terms and conditions of the GNU Lesser General Public License.
7  * You should have received a copy of the GNU LGP License along with this
8  * library; if not, you can download a copy from <http://www.quickserver.org/>.
9  *
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 &lt;server-mode&gt;...&lt;/server-mode&gt;
20  * @author Akshathkumar Shetty
21  * @since 1.4.5
22  */

23 public class ServerMode implements java.io.Serializable JavaDoc {
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: &lt;server-mode&gt;&lt;blocking&gt;true&lt;/blocking&gt;&lt;/server-mode&gt;
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 JavaDoc toXML(String JavaDoc pad) {
48         if(pad==null) pad="";
49         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
50         sb.append(pad+"<server-mode>\n");
51         sb.append(pad+"\t<blocking>"+getBlocking()+"</blocking>\n");
52         sb.append(pad+"</server-mode>\n");
53         return sb.toString();
54     }
55
56     public String JavaDoc toString() {
57         if(getBlocking())
58             return "Blocking";
59         else
60             return "Non-Blocking";
61     }
62 }
63
Popular Tags