Class Application
- java.lang.Object
-
- sqlline.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.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_APP_INFO_MESSAGE
-
Constructor Summary
Constructors Constructor Description Application()
Creates an Application.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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".Map<String,HighlightStyle>
getName2HighlightStyle()
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.String
getVersion()
Collection<String>
initDrivers()
Returns the set of known JDBC drivers.
-
-
-
Field Detail
-
DEFAULT_APP_INFO_MESSAGE
public static final String DEFAULT_APP_INFO_MESSAGE
- See Also:
- Constant Field Values
-
-
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
-
getName2HighlightStyle
public Map<String,HighlightStyle> getName2HighlightStyle()
-
-