java/sql-dk/src/info/globalcode/sql/dk/configuration/Property.java
author František Kučera <franta-hg@frantovo.cz>
Tue, 26 Feb 2019 18:19:49 +0100
branchv_0
changeset 236 a3ec71fa8e17
parent 105 39d8b427e20f
permissions -rw-r--r--
Avoid reusing/rewriting the DB connection properties.
There was weird random errors while testing connection to multiple DB in parallel when one of them was meta connection to same DB connection.
Two kinds of exception: 1) missing password 2) „Passing DB password as CLI parameter is insecure!“
franta-hg@104
     1
/**
franta-hg@104
     2
 * SQL-DK
franta-hg@104
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
franta-hg@104
     4
 *
franta-hg@104
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@104
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@104
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@104
     8
 * (at your option) any later version.
franta-hg@104
     9
 *
franta-hg@104
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@104
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@104
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@104
    13
 * GNU General Public License for more details.
franta-hg@104
    14
 *
franta-hg@104
    15
 * You should have received a copy of the GNU General Public License
franta-hg@104
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@104
    17
 */
franta-hg@104
    18
package info.globalcode.sql.dk.configuration;
franta-hg@104
    19
franta-hg@104
    20
import javax.xml.bind.annotation.XmlAttribute;
franta-hg@104
    21
import javax.xml.bind.annotation.XmlValue;
franta-hg@104
    22
franta-hg@104
    23
/**
franta-hg@104
    24
 * One configurable
franta-hg@104
    25
 *
franta-hg@104
    26
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@104
    27
 */
franta-hg@105
    28
public class Property implements NameIdentified, Cloneable {
franta-hg@104
    29
franta-hg@104
    30
	private String name;
franta-hg@104
    31
	private String value;
franta-hg@104
    32
franta-hg@104
    33
	public Property() {
franta-hg@104
    34
	}
franta-hg@104
    35
franta-hg@104
    36
	public Property(String name, String value) {
franta-hg@104
    37
		this.name = name;
franta-hg@104
    38
		this.value = value;
franta-hg@104
    39
	}
franta-hg@104
    40
franta-hg@104
    41
	@XmlAttribute(name = "name")
franta-hg@104
    42
	@Override
franta-hg@104
    43
	public String getName() {
franta-hg@104
    44
		return name;
franta-hg@104
    45
	}
franta-hg@104
    46
franta-hg@104
    47
	public void setName(String name) {
franta-hg@104
    48
		this.name = name;
franta-hg@104
    49
	}
franta-hg@104
    50
franta-hg@104
    51
	@XmlValue
franta-hg@104
    52
	public String getValue() {
franta-hg@104
    53
		return value;
franta-hg@104
    54
	}
franta-hg@104
    55
franta-hg@104
    56
	public void setValue(String value) {
franta-hg@104
    57
		this.value = value;
franta-hg@104
    58
	}
franta-hg@104
    59
franta-hg@104
    60
	@Override
franta-hg@104
    61
	public String toString() {
franta-hg@104
    62
		return name + "='" + value + "'";
franta-hg@104
    63
	}
franta-hg@105
    64
franta-hg@105
    65
	@Override
franta-hg@105
    66
	protected Property clone() {
franta-hg@105
    67
		return new Property(name, value);
franta-hg@105
    68
	}
franta-hg@104
    69
}