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; |
18 package info.globalcode.sql.dk; |
19 |
19 |
|
20 import info.globalcode.sql.dk.configuration.Configuration; |
20 import info.globalcode.sql.dk.configuration.ConfigurationException; |
21 import info.globalcode.sql.dk.configuration.ConfigurationException; |
21 import info.globalcode.sql.dk.configuration.ConfigurationProvider; |
22 import info.globalcode.sql.dk.configuration.ConfigurationProvider; |
22 import info.globalcode.sql.dk.configuration.DatabaseDefinition; |
23 import info.globalcode.sql.dk.configuration.DatabaseDefinition; |
|
24 import info.globalcode.sql.dk.configuration.FormatterDefinition; |
|
25 import static info.globalcode.sql.dk.Functions.rpad; |
23 import java.io.BufferedReader; |
26 import java.io.BufferedReader; |
24 import java.io.InputStreamReader; |
27 import java.io.InputStreamReader; |
25 import java.io.PrintStream; |
28 import java.io.PrintStream; |
26 import java.sql.SQLException; |
29 import java.sql.SQLException; |
27 import java.util.EnumSet; |
30 import java.util.EnumSet; |
51 switch (infoType) { |
54 switch (infoType) { |
52 /** |
55 /** |
53 * TODO: implement show info |
56 * TODO: implement show info |
54 */ |
57 */ |
55 case FORMATTERS: |
58 case FORMATTERS: |
56 println("TODO: list available formatters"); |
59 for (FormatterDefinition fd : configurationProvider.getConfiguration().getBuildInFormatters()) { |
|
60 log.log(Level.INFO, "Built-in formatter: {0} implemented by class: {1}", new Object[]{rpad(fd.getName(), 16), fd.getClassName()}); |
|
61 } |
|
62 |
|
63 List<FormatterDefinition> configuredFormatters = configurationProvider.getConfiguration().getFormatters(); |
|
64 for (FormatterDefinition fd : configuredFormatters) { |
|
65 log.log(Level.INFO, "Configured formatter: {0} implemented by class: {1}", new Object[]{rpad(fd.getName(), 16), fd.getClassName()}); |
|
66 } |
|
67 if (configuredFormatters.isEmpty()) { |
|
68 log.log(Level.INFO, "No other formatters are configured"); |
|
69 } |
|
70 |
|
71 String configuredDefaultFormatter = configurationProvider.getConfiguration().getDefaultFormatter(); |
|
72 if (configuredDefaultFormatter == null) { |
|
73 log.log(Level.INFO, "Built-in default formatter: {0}", Configuration.DEFAULT_FORMATTER); |
|
74 } else { |
|
75 log.log(Level.INFO, "Configured default formatter: {0}", configuredDefaultFormatter); |
|
76 } |
57 break; |
77 break; |
58 case HELP: |
78 case HELP: |
59 printResource(Constants.HELP_FILE); |
79 printResource(Constants.HELP_FILE); |
60 break; |
80 break; |
61 case LICENSE: |
81 case LICENSE: |