java/sql-dk/src/info/globalcode/sql/dk/configuration/Configuration.java
author František Kučera <franta-hg@frantovo.cz>
Sat, 28 Dec 2013 12:19:39 +0100
branchv_0
changeset 88 102ba0fcb07f
parent 80 c4635ab3a7af
child 89 98d18e9a357b
permissions -rw-r--r--
TabularPrefetchingFormatter: prefetch whole result set to avoid value overflow the cell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * SQL-DK
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
e225bdcd260e refactor, configuration
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
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, either version 3 of the License, or
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 * (at your option) any later version.
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 *
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 * GNU General Public License for more details.
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 *
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
 */
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    18
package info.globalcode.sql.dk.configuration;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    19
30
b7ea47b2d4ca class for xmlns constants
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    20
import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    21
import static info.globalcode.sql.dk.Functions.findByName;
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    22
import info.globalcode.sql.dk.formatting.SilentFormatter;
60
d4e88172a363 SingleValueFormatter
František Kučera <franta-hg@frantovo.cz>
parents: 32
diff changeset
    23
import info.globalcode.sql.dk.formatting.SingleValueFormatter;
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    24
import info.globalcode.sql.dk.formatting.TabularFormatter;
88
102ba0fcb07f TabularPrefetchingFormatter: prefetch whole result set to avoid value overflow the cell
František Kučera <franta-hg@frantovo.cz>
parents: 80
diff changeset
    25
import info.globalcode.sql.dk.formatting.TabularPrefetchingFormatter;
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    26
import info.globalcode.sql.dk.formatting.XmlFormatter;
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    27
import java.util.ArrayList;
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    28
import java.util.Collection;
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    29
import java.util.Collections;
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    30
import java.util.List;
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    31
import javax.xml.bind.annotation.XmlElement;
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    32
import javax.xml.bind.annotation.XmlRootElement;
67
10c9b9e54622 option --list-formatters – list configured and built-in formatters
František Kučera <franta-hg@frantovo.cz>
parents: 60
diff changeset
    33
import javax.xml.bind.annotation.XmlTransient;
20
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
/**
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
 *
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
 * @author Ing. František Kučera (frantovo.cz)
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
 */
30
b7ea47b2d4ca class for xmlns constants
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    39
@XmlRootElement(name = "configuration", namespace = CONFIGURATION)
20
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
public class Configuration {
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    41
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    42
	private List<DatabaseDefinition> databases = new ArrayList<>();
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    43
	private List<FormatterDefinition> formatters = new ArrayList<>();
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    44
	/**
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    45
	 * is used if no formatter is specified on CLI nor in user configuration
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    46
	 */
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    47
	public static final String DEFAULT_FORMATTER = TabularFormatter.NAME;
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    48
	private String defaultFormatter;
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    49
	/**
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    50
	 * Default list of formatters. Is used if particular name is not found in user configuration.
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    51
	 */
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    52
	private static final Collection<FormatterDefinition> buildInFormatters;
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    53
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    54
	static {
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    55
		Collection<FormatterDefinition> l = new ArrayList<>();
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    56
		l.add(new FormatterDefinition(SilentFormatter.NAME, SilentFormatter.class.getName()));
60
d4e88172a363 SingleValueFormatter
František Kučera <franta-hg@frantovo.cz>
parents: 32
diff changeset
    57
		l.add(new FormatterDefinition(SingleValueFormatter.NAME, SingleValueFormatter.class.getName()));
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    58
		l.add(new FormatterDefinition(XmlFormatter.NAME, XmlFormatter.class.getName()));
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    59
		l.add(new FormatterDefinition(TabularFormatter.NAME, TabularFormatter.class.getName()));
88
102ba0fcb07f TabularPrefetchingFormatter: prefetch whole result set to avoid value overflow the cell
František Kučera <franta-hg@frantovo.cz>
parents: 80
diff changeset
    60
		l.add(new FormatterDefinition(TabularPrefetchingFormatter.NAME, TabularPrefetchingFormatter.class.getName()));
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    61
		buildInFormatters = Collections.unmodifiableCollection(l);
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    62
	}
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    63
30
b7ea47b2d4ca class for xmlns constants
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    64
	@XmlElement(name = "database", namespace = CONFIGURATION)
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    65
	public List<DatabaseDefinition> getDatabases() {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    66
		return databases;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    67
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    68
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    69
	public void setDatabases(List<DatabaseDefinition> databases) {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    70
		this.databases = databases;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    71
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    72
75
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    73
	/**
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    74
	 * @throws ConfigurationException if no database with this name is configured
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    75
	 */
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    76
	public DatabaseDefinition getDatabase(String name) throws ConfigurationException {
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    77
		DatabaseDefinition dd = findByName(databases, name);
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    78
		if (dd == null) {
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    79
			throw new ConfigurationException("Database is not configured: " + name);
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    80
		} else {
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    81
			return dd;
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
    82
		}
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    83
	}
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    84
80
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
    85
	/**
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
    86
	 * @return only configured formatters
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
    87
	 * @see #getBuildInFormatters()
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
    88
	 * @see #getAllFormatters()
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
    89
	 */
30
b7ea47b2d4ca class for xmlns constants
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    90
	@XmlElement(name = "formatter", namespace = CONFIGURATION)
26
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    91
	public List<FormatterDefinition> getFormatters() {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    92
		return formatters;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    93
	}
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    94
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    95
	public void setFormatters(List<FormatterDefinition> formatters) {
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    96
		this.formatters = formatters;
4ec8e5534eb9 configuration basics
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    97
	}
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
    98
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    99
	/**
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   100
	 * @param name name of desired formatter. Looking for this name in user configuration, then in
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   101
	 * buil-in formatters. If null, default from configuration or (if not configured) built-in
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   102
	 * default is used.
75
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   103
	 * @return formatter definition
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   104
	 * @throws ConfigurationException if no formatter with this name was found
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   105
	 */
75
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   106
	public FormatterDefinition getFormatter(String name) throws ConfigurationException {
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   107
		if (name == null) {
75
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   108
			return defaultFormatter == null ? getFormatter(DEFAULT_FORMATTER) : getFormatter(defaultFormatter);
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   109
		} else {
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   110
			FormatterDefinition fd = findByName(formatters, name);
75
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   111
			fd = fd == null ? findByName(buildInFormatters, name) : fd;
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   112
			if (fd == null) {
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   113
				throw new ConfigurationException("Formatter is not configured: " + name);
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   114
			} else {
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   115
				return fd;
43aa4625ab7e throw ConfigurationException instead of returning null, if database or formatter of given name is not configured
František Kučera <franta-hg@frantovo.cz>
parents: 67
diff changeset
   116
			}
32
5e412dbd9362 TabularFormatter: basics
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
   117
		}
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   118
	}
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   119
80
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   120
	/**
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   121
	 * @return only built-in formatters
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   122
	 * @see #getAllFormatters()
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   123
	 * @see #getFormatters()
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   124
	 */
67
10c9b9e54622 option --list-formatters – list configured and built-in formatters
František Kučera <franta-hg@frantovo.cz>
parents: 60
diff changeset
   125
	@XmlTransient
10c9b9e54622 option --list-formatters – list configured and built-in formatters
František Kučera <franta-hg@frantovo.cz>
parents: 60
diff changeset
   126
	public Collection<FormatterDefinition> getBuildInFormatters() {
10c9b9e54622 option --list-formatters – list configured and built-in formatters
František Kučera <franta-hg@frantovo.cz>
parents: 60
diff changeset
   127
		return buildInFormatters;
10c9b9e54622 option --list-formatters – list configured and built-in formatters
František Kučera <franta-hg@frantovo.cz>
parents: 60
diff changeset
   128
	}
10c9b9e54622 option --list-formatters – list configured and built-in formatters
František Kučera <franta-hg@frantovo.cz>
parents: 60
diff changeset
   129
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   130
	/**
80
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   131
	 * @return built-in + configured formatters
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   132
	 * @see #getFormatters()
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   133
	 */
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   134
	@XmlTransient
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   135
	public Collection<FormatterDefinition> getAllFormatters() {
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   136
		Collection<FormatterDefinition> allFormatters = new ArrayList<>();
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   137
		allFormatters.addAll(buildInFormatters);
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   138
		allFormatters.addAll(formatters);
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   139
		return allFormatters;
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   140
	}
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   141
c4635ab3a7af bash completion: generate helper files with databases and formatters from configuration
František Kučera <franta-hg@frantovo.cz>
parents: 75
diff changeset
   142
	/**
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   143
	 * @return name of default formatter, is used if name is not specified on CLI
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   144
	 */
30
b7ea47b2d4ca class for xmlns constants
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
   145
	@XmlElement(name = "defaultFormatter", namespace = CONFIGURATION)
29
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   146
	public String getDefaultFormatter() {
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   147
		return defaultFormatter;
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   148
	}
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   149
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   150
	public void setDefaultFormatter(String defaultFormatter) {
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   151
		this.defaultFormatter = defaultFormatter;
d66858b4b563 more configuration, more JAXB, more formatters
František Kučera <franta-hg@frantovo.cz>
parents: 26
diff changeset
   152
	}
20
e225bdcd260e refactor, configuration
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   153
}