java/sql-dk/src/info/globalcode/sql/dk/configuration/Configuration.java
branchv_0
changeset 30 b7ea47b2d4ca
parent 29 d66858b4b563
child 32 5e412dbd9362
equal deleted inserted replaced
29:d66858b4b563 30:b7ea47b2d4ca
    15  * You should have received a copy of the GNU General Public License
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    17  */
    18 package info.globalcode.sql.dk.configuration;
    18 package info.globalcode.sql.dk.configuration;
    19 
    19 
    20 import static info.globalcode.sql.dk.Constants.XMLNS_CONFIGURATION;
    20 import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
    21 import static info.globalcode.sql.dk.Functions.findByName;
    21 import static info.globalcode.sql.dk.Functions.findByName;
    22 import info.globalcode.sql.dk.formatting.SilentFormatter;
    22 import info.globalcode.sql.dk.formatting.SilentFormatter;
    23 import info.globalcode.sql.dk.formatting.XmlFormatter;
    23 import info.globalcode.sql.dk.formatting.XmlFormatter;
    24 import java.util.ArrayList;
    24 import java.util.ArrayList;
    25 import java.util.Collection;
    25 import java.util.Collection;
    30 
    30 
    31 /**
    31 /**
    32  *
    32  *
    33  * @author Ing. František Kučera (frantovo.cz)
    33  * @author Ing. František Kučera (frantovo.cz)
    34  */
    34  */
    35 @XmlRootElement(name = "configuration", namespace = XMLNS_CONFIGURATION)
    35 @XmlRootElement(name = "configuration", namespace = CONFIGURATION)
    36 public class Configuration {
    36 public class Configuration {
    37 
    37 
    38 	private List<DatabaseDefinition> databases = new ArrayList<>();
    38 	private List<DatabaseDefinition> databases = new ArrayList<>();
    39 	private List<FormatterDefinition> formatters = new ArrayList<>();
    39 	private List<FormatterDefinition> formatters = new ArrayList<>();
    40 	private String defaultFormatter;
    40 	private String defaultFormatter;
    48 		l.add(new FormatterDefinition(SilentFormatter.NAME, SilentFormatter.class.getName()));
    48 		l.add(new FormatterDefinition(SilentFormatter.NAME, SilentFormatter.class.getName()));
    49 		l.add(new FormatterDefinition(XmlFormatter.NAME, XmlFormatter.class.getName()));
    49 		l.add(new FormatterDefinition(XmlFormatter.NAME, XmlFormatter.class.getName()));
    50 		buildInFormatters = Collections.unmodifiableCollection(l);
    50 		buildInFormatters = Collections.unmodifiableCollection(l);
    51 	}
    51 	}
    52 
    52 
    53 	@XmlElement(name = "database", namespace = XMLNS_CONFIGURATION)
    53 	@XmlElement(name = "database", namespace = CONFIGURATION)
    54 	public List<DatabaseDefinition> getDatabases() {
    54 	public List<DatabaseDefinition> getDatabases() {
    55 		return databases;
    55 		return databases;
    56 	}
    56 	}
    57 
    57 
    58 	public void setDatabases(List<DatabaseDefinition> databases) {
    58 	public void setDatabases(List<DatabaseDefinition> databases) {
    61 
    61 
    62 	public DatabaseDefinition getDatabase(String name) {
    62 	public DatabaseDefinition getDatabase(String name) {
    63 		return findByName(databases, name);
    63 		return findByName(databases, name);
    64 	}
    64 	}
    65 
    65 
    66 	@XmlElement(name = "formatter", namespace = XMLNS_CONFIGURATION)
    66 	@XmlElement(name = "formatter", namespace = CONFIGURATION)
    67 	public List<FormatterDefinition> getFormatters() {
    67 	public List<FormatterDefinition> getFormatters() {
    68 		return formatters;
    68 		return formatters;
    69 	}
    69 	}
    70 
    70 
    71 	public void setFormatters(List<FormatterDefinition> formatters) {
    71 	public void setFormatters(List<FormatterDefinition> formatters) {
    78 	}
    78 	}
    79 
    79 
    80 	/**
    80 	/**
    81 	 * @return name of default formatter, is used if name is not specified on CLI
    81 	 * @return name of default formatter, is used if name is not specified on CLI
    82 	 */
    82 	 */
    83 	@XmlElement(name = "defaultFormatter", namespace = XMLNS_CONFIGURATION)
    83 	@XmlElement(name = "defaultFormatter", namespace = CONFIGURATION)
    84 	public String getDefaultFormatter() {
    84 	public String getDefaultFormatter() {
    85 		return defaultFormatter;
    85 		return defaultFormatter;
    86 	}
    86 	}
    87 
    87 
    88 	public void setDefaultFormatter(String defaultFormatter) {
    88 	public void setDefaultFormatter(String defaultFormatter) {