Skip to content

02 ‐ How it Works

Michael Dick edited this page Aug 15, 2023 · 10 revisions

How db-tool Works

General Architecture

Packages Description
cli Contains the DbToolCommand, the main command for the CLI that you have to enter (db-tool). It's extensions are in the subcommands directory. They form the available command set create-profile, grep, list-profiles and list-tables. This directory also contains the definitions for the different command options like -tr and the SupportedDatabases enum.
console Package of the ConsolePrinter class, which is used to pipe through all console output for uniform formatting and styling.
database Home of most database related code. Contains a factory for creating database instances, a database interface with a default implementation (DefaultDatabase) and the Query class for building database querys which are then processed in the QueryProcessor.
drivers Provides a DriverWrapper to wrap different database drivers for Java and a JDBCDriverLoader.
exceptions Path of the widely used DbToolException.
files All the profile and file system handling happens in the ProfileHandler. The Profile schema defines the requirements for a profile file. Profile saves are stored as .json files.
utils All util classes that are used in the rest of the code. ASCIIArt contains the db-tool ASCII logo, TablePrinter uses the freva.asciitable package to generate beautiful and clean customizable CLI tables, SearchUtils provids a List<String> search method with regex support. The FileSystem methods are used in the profile creation unit tests.

CLI

For the command line interface, db-tool uses the framework picocli. It supports subcommands, colors, auto-completion and much more.

JDBC

Database connections are established using JDBC.

Clone this wiki locally