KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > setup > impl > config > DbAccessConfigImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.setup.impl.config;
10
11 import org.jboss.portal.setup.config.DbAccessConfig;
12 import org.jboss.portal.setup.DatabaseVendorType;
13 import org.jboss.portal.setup.PortalSetupException;
14
15 /**
16  * @author <a HREF="mailto:palber@novell.com">Polina Alber</a>
17  * Date: Apr 13, 2005; Time: 1:36:11 PM
18  * @jmx.mbean
19  * @jboss.xmbean
20  * @since JBoss portal 2.0
21  * Class org.jboss.portal.setup.impl.config.DbAccessConfigImpl
22  */

23 public class DbAccessConfigImpl extends ConfigurationImpl implements DbAccessConfig
24 {
25    private String JavaDoc m_driverClassName = "org.hsqldb.jdbcDriver"; //defaults to hsql
26
private String JavaDoc m_connUrl = "jdbc:hsqldb:test"; //"jdbc:hsqldb:hsql://localhost:1701";// localDB;//"jdbc:hsqldb:test"; //defaults to jboss portal test data base
27
private String JavaDoc m_userName = "sa";
28    private String JavaDoc m_password = "";
29    private String JavaDoc m_dataSourceName = null;
30    private DatabaseVendorType m_vendor = null;
31    private String JavaDoc m_vendorName = "hsqldb";
32
33
34    /**
35     * @return JDBC driver class name to be used for database access
36     *
37     * @jmx.managed-attribute
38     * access="read-write"
39     */

40    public String JavaDoc getDriverClassName()
41    {
42       return m_driverClassName;
43    }
44
45    /**
46     * @jmx.managed-attribute
47     * access="read-write"
48     */

49    public void setDriverClassName(String JavaDoc driverClassName)
50    {
51       m_driverClassName = driverClassName;
52    }
53
54    /**
55     * @jmx.managed-attribute
56     * access="read-write"
57     */

58    public String JavaDoc getConnUrl()
59    {
60       return m_connUrl;
61    }
62
63    /**
64     * @jmx.managed-attribute
65     * access="read-write"
66     */

67    public void setConnUrl(String JavaDoc connUrl)
68    {
69       m_connUrl = connUrl;
70    }
71
72
73    /**
74     * @jmx.managed-attribute
75     * access="read-write"
76     */

77    public String JavaDoc getUserName()
78    {
79       return m_userName;
80    }
81
82    /**
83     * @jmx.managed-attribute
84     * access="read-write"
85     */

86    public void setUserName(String JavaDoc userName)
87    {
88       m_userName = userName;
89    }
90
91    /**
92     * @jmx.managed-attribute
93     * access="read-write"
94     */

95    public String JavaDoc getPassword()
96    {
97       return m_password;
98    }
99
100    /**
101     * @jmx.managed-attribute
102     * access="read-write"
103     */

104    public void setPassword(String JavaDoc password)
105    {
106       //XXXX should be encripted
107
m_password = password;
108    }
109
110    /**
111     * @jmx.managed-attribute
112     * access="read-write"
113     */

114    public String JavaDoc getDataSourceName()
115    {
116       return m_dataSourceName;
117    }
118
119    /**
120     * @jmx.managed-attribute
121     * access="read-write"
122     */

123    public void setDataSourceName(String JavaDoc dsName)
124    {
125       m_dataSourceName = dsName;
126    }
127
128    /**
129     * @jmx.managed-attribute
130     * access="read-write"
131     */

132    public void setDbVendorName(String JavaDoc vendorName) throws PortalSetupException
133    {
134       m_vendorName = vendorName;
135       setDbVendor(vendorName);
136    }
137
138    /**
139     * @return a database vendor type to use upon processing
140     * data load action statements and generation sql.
141     * @jmx.managed-attribute
142     * access="read-write"
143     */

144    public String JavaDoc getDbVendorName()
145    {
146       return m_vendorName;
147    }
148
149    /**
150     * @return a database vendor type to use upon processing
151     * data load action statements and generation sql.
152     * Supported vendors are: MySQL, Oracle, hiperSonic, postgress
153     */

154    public DatabaseVendorType getDbVendorType() throws PortalSetupException
155    {
156       if (m_vendor == null)
157       {
158          setDbVendor(m_vendorName);
159       }
160       return m_vendor;
161    }
162
163    /**
164     * @param vendor a name of database vendor to use upon processing
165     * data load action statements and generation sql.
166     * Supported vendors are: MySQL, Oracle, hiperSonic, postgress
167     */

168    public void setDbVendor(String JavaDoc vendor) throws PortalSetupException
169    {
170       m_vendor = DatabaseVendorType.parseVendorName(vendor, false);
171    }
172 }
173
Popular Tags