public class Application extends Object
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.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_APP_INFO_MESSAGE |
Constructor and Description |
---|
Application()
Creates an Application.
|
Modifier and Type | Method and Description |
---|---|
Collection<CommandHandler> |
getCommandHandlers(SqlLine sqlLine)
Override this method to modify supported commands.
|
Collection<String> |
getConnectionUrlExamples()
Override this method to modify connection url examples.
|
String |
getInfoMessage()
Returns the information message, by default "sqlline version x.x".
|
SqlLineOpts |
getOpts(SqlLine sqlLine)
Override this method to modify session options.
|
Map<String,OutputFormat> |
getOutputFormats(SqlLine sqlLine)
Override this method to modify known output formats implementations.
|
Collection<String> |
initDrivers()
Returns the set of known JDBC drivers.
|
public static final String DEFAULT_APP_INFO_MESSAGE
public String getInfoMessage() throws Exception
Override this method to return a custom information message.
Exception
- in case of errors during
obtaining application info messageDEFAULT_APP_INFO_MESSAGE
public Collection<String> initDrivers()
Override this method to modify set of supported known drivers.
DEFAULT_DRIVERS
public Map<String,OutputFormat> getOutputFormats(SqlLine sqlLine)
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.
sqlLine
- SQLLine instancepublic Collection<String> getConnectionUrlExamples()
When overriding connection url examples, connect / open command should be re-initialized unless default commands handlers are used.
public Collection<CommandHandler> getCommandHandlers(SqlLine sqlLine)
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()
.
sqlLine
- SQLLine instancepublic SqlLineOpts getOpts(SqlLine sqlLine)
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()
.
sqlLine
- SQLLine instanceCopyright © 2002–2018 Julian Hyde. All rights reserved.