Package sqlline

Class Application


  • public class Application
    extends Object
    Defines the configuration of a SQLLine application.

    This class can be extended to allow customizations for: known drivers, output formats, commands, information message, session options.

    You can pass the name of the sub-class to SQLLine via the -ac command-line parameter or !appconfig command.

    Use !appconfig sqlline.Application to reset SQLLine application configuration to default at runtime.

    • Constructor Detail

      • Application

        public Application()
        Creates an Application.
    • Method Detail

      • getInfoMessage

        public String getInfoMessage()
        Returns the information message, by default "sqlline version x.x".

        Override this method to return a custom information message.

        Returns:
        custom information message
        See Also:
        DEFAULT_APP_INFO_MESSAGE
      • getVersion

        public String getVersion()
      • initDrivers

        public Collection<String> initDrivers()
        Returns the set of known JDBC drivers.

        Override this method to modify set of supported known drivers.

        Returns:
        Collection of known drivers
        See Also:
        DEFAULT_DRIVERS
      • getOutputFormats

        public Map<String,​OutputFormat> getOutputFormats​(SqlLine sqlLine)
        Override this method to modify known output formats implementations.

        If method is not overridden, current state of formats will be reset to default (super.getOutputFormats(sqlLine)).

        To update / leave current state, override this method and use sqlLine.getOutputFormats().

        When overriding output formats outputformat command should be re-initialized unless default commands handlers are used.

        Parameters:
        sqlLine - SQLLine instance
        Returns:
        Map of output formats by name
      • getConnectionUrlExamples

        public Collection<String> getConnectionUrlExamples()
        Override this method to modify connection url examples.

        When overriding connection url examples, connect / open command should be re-initialized unless default commands handlers are used.

        Returns:
        Collection of connection url examples
      • getCommandHandlers

        public Collection<CommandHandler> getCommandHandlers​(SqlLine sqlLine)
        Override this method to modify supported commands.

        If method is not overridden, current state of commands will be reset to default (super.getCommandHandlers(sqlLine)).

        To update / leave current state, override this method and use sqlLine.getCommandHandlers().

        Parameters:
        sqlLine - SQLLine instance
        Returns:
        Collection of command handlers
      • getOpts

        public SqlLineOpts getOpts​(SqlLine sqlLine)
        Override this method to modify session options.

        If method is not overridden, current state of options will be reset to default (super.getOpts(sqlLine)).

        To update / leave current state, override this method and use sqlLine.getOpts().

        Parameters:
        sqlLine - SQLLine instance
        Returns:
        SQLLine session options