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: import java.util.*;
18:
19: /**
20: * This class encapsulate the database object pool.
21: * The xml is <db-object-pool>...</db-object-pool>.
22: * @author Akshathkumar Shetty
23: * @since 1.3
24: */
25: public class DBObjectPoolConfig implements java.io.Serializable {
26: private DatabaseConnectionSet databaseConnectionSet;
27: private String dbPoolUtil;
28:
29: /**
30: * Returns the DatabaseConnectionSet.
31: * @return DatabaseConnectionSet
32: */
33: public DatabaseConnectionSet getDatabaseConnectionSet() {
34: return databaseConnectionSet;
35: }
36:
37: /**
38: * Sets the DatabaseConnectionSet.
39: * XML Tag: <database-connection-set></database-connection-set>
40: * @param databaseConnectionSet
41: */
42: public void setDatabaseConnectionSet(
43: DatabaseConnectionSet databaseConnectionSet) {
44: this .databaseConnectionSet = databaseConnectionSet;
45: }
46:
47: /**
48: * Sets the {@link org.quickserver.sql.DBPoolUtil} class that handles the
49: * database connection pools.
50: * XML Tag: <db-pool-util></db-pool-util>
51: * @param className the fully qualified name of the class
52: * that implements {@link org.quickserver.sql.DBPoolUtil}.
53: * @see #getDbPoolUtil
54: */
55: public void setDbPoolUtil(String className) {
56: dbPoolUtil = className;
57: }
58:
59: /**
60: * Returns the {@link org.quickserver.sql.DBPoolUtil} class that handles the
61: * database connection pools.
62: * @see #setDbPoolUtil
63: */
64: public String getDbPoolUtil() {
65: return dbPoolUtil;
66: }
67:
68: /**
69: * Returns XML config of this class.
70: * @since 1.3
71: */
72: public String toXML(String pad) {
73: if (pad == null)
74: pad = "";
75: StringBuffer sb = new StringBuffer();
76:
77: sb.append(pad + "<db-object-pool>\n");
78: if (getDatabaseConnectionSet() != null)
79: sb.append(getDatabaseConnectionSet().toXML(pad + "\t"));
80: sb.append(pad + "\t<db-pool-util>" + getDbPoolUtil()
81: + "</db-pool-util>\n");
82: sb.append(pad + "</db-object-pool>\n");
83: return sb.toString();
84: }
85: }
|