franta-hg@26: /** franta-hg@26: * SQL-DK franta-hg@26: * Copyright © 2013 František Kučera (frantovo.cz) franta-hg@26: * franta-hg@26: * This program is free software: you can redistribute it and/or modify franta-hg@26: * it under the terms of the GNU General Public License as published by franta-hg@26: * the Free Software Foundation, either version 3 of the License, or franta-hg@26: * (at your option) any later version. franta-hg@26: * franta-hg@26: * This program is distributed in the hope that it will be useful, franta-hg@26: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@26: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@26: * GNU General Public License for more details. franta-hg@26: * franta-hg@26: * You should have received a copy of the GNU General Public License franta-hg@26: * along with this program. If not, see . franta-hg@26: */ franta-hg@26: package info.globalcode.sql.dk.configuration; franta-hg@26: franta-hg@30: import static info.globalcode.sql.dk.Xmlns.CONFIGURATION; franta-hg@27: import info.globalcode.sql.dk.DatabaseConnection; franta-hg@29: import java.sql.SQLException; franta-hg@26: import javax.xml.bind.annotation.XmlElement; franta-hg@26: franta-hg@26: /** franta-hg@155: * Configured (but not yet connected) database connection. franta-hg@26: * franta-hg@26: * @author Ing. František Kučera (frantovo.cz) franta-hg@26: */ franta-hg@26: public class DatabaseDefinition implements NameIdentified { franta-hg@26: franta-hg@26: private String name; franta-hg@26: private String url; franta-hg@26: private String userName; franta-hg@26: private String password; franta-hg@104: private Properties properties = new Properties(); franta-hg@26: franta-hg@30: @XmlElement(name = "name", namespace = CONFIGURATION) franta-hg@26: @Override franta-hg@26: public String getName() { franta-hg@26: return name; franta-hg@26: } franta-hg@26: franta-hg@26: public void setName(String name) { franta-hg@26: this.name = name; franta-hg@26: } franta-hg@26: franta-hg@30: @XmlElement(name = "url", namespace = CONFIGURATION) franta-hg@26: public String getUrl() { franta-hg@26: return url; franta-hg@26: } franta-hg@26: franta-hg@26: public void setUrl(String url) { franta-hg@26: this.url = url; franta-hg@26: } franta-hg@26: franta-hg@30: @XmlElement(name = "userName", namespace = CONFIGURATION) franta-hg@26: public String getUserName() { franta-hg@26: return userName; franta-hg@26: } franta-hg@26: franta-hg@26: public void setUserName(String userName) { franta-hg@26: this.userName = userName; franta-hg@26: } franta-hg@26: franta-hg@30: @XmlElement(name = "password", namespace = CONFIGURATION) franta-hg@26: public String getPassword() { franta-hg@26: return password; franta-hg@26: } franta-hg@26: franta-hg@26: public void setPassword(String password) { franta-hg@26: this.password = password; franta-hg@26: } franta-hg@26: franta-hg@104: @XmlElement(name = "property", namespace = CONFIGURATION) franta-hg@104: public Properties getProperties() { franta-hg@104: return properties; franta-hg@104: } franta-hg@104: franta-hg@104: public void setProperties(Properties properties) { franta-hg@104: this.properties = properties; franta-hg@104: } franta-hg@104: franta-hg@106: /** franta-hg@155: * @param properties ad-hoc properties from CLI options (for the JDBC driver) franta-hg@106: */ franta-hg@106: public DatabaseConnection connect(Properties properties) throws SQLException { franta-hg@106: return new DatabaseConnection(this, properties); franta-hg@26: } franta-hg@26: }