001    /**
002     * Jetrix TetriNET Server
003     * Copyright (C) 2008  Emmanuel Bourg
004     *
005     * This program is free software; you can redistribute it and/or
006     * modify it under the terms of the GNU General Public License
007     * as published by the Free Software Foundation; either version 2
008     * of the License, or (at your option) any later version.
009     *
010     * This program is distributed in the hope that it will be useful,
011     * but WITHOUT ANY WARRANTY; without even the implied warranty of
012     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013     * GNU General Public License for more details.
014     *
015     * You should have received a copy of the GNU General Public License
016     * along with this program; if not, write to the Free Software
017     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
018     */
019    
020    package net.jetrix.config;
021    
022    import net.jetrix.DataSourceManager;
023    
024    /**
025     * Configuration for a pool of connections to a database.
026     * 
027     * @author Emmanuel Bourg
028     * @version $Revision: 797 $, $Date: 2009-02-18 15:03:17 +0100 (Wed, 18 Feb 2009) $
029     * @since 0.3
030     */
031    public class DataSourceConfig
032    {
033        private String name = DataSourceManager.DEFAULT_DATASOURCE;
034        private String url;
035        private String driver;
036        private String username;
037        private String password;
038        private int minIdle = DataSourceManager.DEFAULT_MIN_IDLE;
039        private int maxActive = DataSourceManager.DEFAULT_MAX_ACTIVE;
040    
041        /**
042         * Tells if this datasource is the default datasource.
043         */
044        public boolean isDefault()
045        {
046            return DataSourceManager.DEFAULT_DATASOURCE.equals(name);
047        }
048    
049        public String getName()
050        {
051            return name;
052        }
053    
054        public void setName(String name)
055        {
056            this.name = name;
057        }
058    
059        public String getUrl()
060        {
061            return url;
062        }
063    
064        public void setUrl(String url)
065        {
066            this.url = url;
067        }
068    
069        public String getDriver()
070        {
071            return driver;
072        }
073    
074        public void setDriver(String driver)
075        {
076            this.driver = driver;
077        }
078    
079        public String getUsername()
080        {
081            return username;
082        }
083    
084        public void setUsername(String username)
085        {
086            this.username = username;
087        }
088    
089        public String getPassword()
090        {
091            return password;
092        }
093    
094        public void setPassword(String password)
095        {
096            this.password = password;
097        }
098    
099        public int getMinIdle()
100        {
101            return minIdle;
102        }
103    
104        public void setMinIdle(int minIdle)
105        {
106            this.minIdle = minIdle;
107        }
108    
109        public int getMaxActive()
110        {
111            return maxActive;
112        }
113    
114        public void setMaxActive(int maxActive)
115        {
116            this.maxActive = maxActive;
117        }
118    }