java/sql-dk/src/info/globalcode/sql/dk/configuration/DatabaseDefinition.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 22 Dec 2013 18:19:38 +0100
branchv_0
changeset 29 d66858b4b563
parent 27 24aa5199bfd6
child 30 b7ea47b2d4ca
permissions -rw-r--r--
more configuration, more JAXB, more formatters
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * SQL-DK
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, either version 3 of the License, or
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 * (at your option) any later version.
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 *
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 * GNU General Public License for more details.
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 *
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
 */
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
package info.globalcode.sql.dk.configuration;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    20
import static info.globalcode.sql.dk.Constants.XMLNS_CONFIGURATION;
27
24aa5199bfd6 DatabaseConnection: just change package
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    21
import info.globalcode.sql.dk.DatabaseConnection;
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    22
import java.sql.SQLException;
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
import javax.xml.bind.annotation.XmlElement;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
/**
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
 *
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
 * @author Ing. František Kučera (frantovo.cz)
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
 */
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
public class DatabaseDefinition implements NameIdentified {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	private String name;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	private String url;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	private String userName;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	private String password;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    36
	@XmlElement(name = "name", namespace = XMLNS_CONFIGURATION)
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	@Override
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	public String getName() {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
		return name;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
	public void setName(String name) {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
		this.name = name;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    46
	@XmlElement(name = "url", namespace = XMLNS_CONFIGURATION)
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
	public String getUrl() {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
		return url;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
	public void setUrl(String url) {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
		this.url = url;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    55
	@XmlElement(name = "userName", namespace = XMLNS_CONFIGURATION)
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
	public String getUserName() {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
		return userName;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
	public void setUserName(String userName) {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
		this.userName = userName;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    64
	@XmlElement(name = "password", namespace = XMLNS_CONFIGURATION)
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
	public String getPassword() {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
		return password;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    68
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    69
	public void setPassword(String password) {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    70
		this.password = password;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    71
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    72
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    73
	public DatabaseConnection connect() throws SQLException {
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    74
		return new DatabaseConnection(this);
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    75
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    76
}