Class Application
public class Application
extends java.lang.Object
This class can be extended to allow customizations for: known drivers, output formats, commands, information message, session options, prompt handler.
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 java.lang.String
DEFAULT_APP_INFO_MESSAGE
-
Constructor Summary
Constructors Constructor Description Application()
Creates an Application. -
Method Summary
Modifier and Type Method Description java.util.List<java.lang.String>
allowedDrivers()
Returns the list of the class names of allowed JDBC drivers.java.util.Set<java.lang.String>
getAvailableScriptEngineNames()
Override this method to modify available script engine names.java.util.Collection<CommandHandler>
getCommandHandlers(SqlLine sqlLine)
Override this method to modify supported commands.java.util.Collection<java.lang.String>
getConnectInteractiveModes()
java.util.Collection<java.lang.String>
getConnectionUrlExamples()
Override this method to modify connection url examples.java.lang.String
getDefaultInteractiveMode()
java.lang.String
getInfoMessage()
Returns the information message, by default "sqlline version x.x".java.util.Map<java.lang.String,HighlightStyle>
getName2HighlightStyle()
java.util.Map<java.lang.String,sqlline.TableOutputFormatStyle>
getName2TableOutputFormatStyle()
SqlLineOpts
getOpts(SqlLine sqlLine)
Override this method to modify session options.java.util.Map<java.lang.String,OutputFormat>
getOutputFormats(SqlLine sqlLine)
Override this method to modify known output formats implementations.PromptHandler
getPromptHandler(SqlLine sqlLine)
java.lang.String
getVersion()
java.util.Collection<java.lang.String>
initDrivers()
Deprecated.
-
Field Details
-
DEFAULT_APP_INFO_MESSAGE
public static final java.lang.String DEFAULT_APP_INFO_MESSAGE- See Also:
- Constant Field Values
-
-
Constructor Details
-
Application
public Application()Creates an Application.
-
-
Method Details
-
getInfoMessage
public java.lang.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 java.lang.String getVersion() -
initDrivers
@Deprecated public java.util.Collection<java.lang.String> initDrivers()Deprecated.Deprecated, now that drivers are loaded usingServiceLoader
andMETA-INF/services/java.sql.Driver
; useallowedDrivers()
instead.- Returns:
- Collection of known drivers
-
allowedDrivers
public java.util.List<java.lang.String> allowedDrivers()Returns the list of the class names of allowed JDBC drivers.The default implementation returns null, which means there are no restrictions, and SQLLine will use all drivers on the class path.
Override this method to modify list of allowed drivers.
- Returns:
- List of allowed drivers, null if any is allowed
-
getOutputFormats
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 java.util.Collection<java.lang.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
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
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
-
getPromptHandler
-
getName2HighlightStyle
-
getConnectInteractiveModes
public java.util.Collection<java.lang.String> getConnectInteractiveModes() -
getDefaultInteractiveMode
public java.lang.String getDefaultInteractiveMode() -
getName2TableOutputFormatStyle
public java.util.Map<java.lang.String,sqlline.TableOutputFormatStyle> getName2TableOutputFormatStyle() -
getAvailableScriptEngineNames
public java.util.Set<java.lang.String> getAvailableScriptEngineNames()Override this method to modify available script engine names.If method is not overridden, current set of engine names will contain first non intersected values (ordered by abc).
- Returns:
- Set of available script engine names
-