Class ConsoleCommand
- java.lang.Object
-
- org.eclipse.rdf4j.console.command.ConsoleCommand
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
LOGGER
-
Constructor Summary
Constructors Constructor Description ConsoleCommand(ConsoleIO consoleIO)
ConstructorConsoleCommand(ConsoleIO consoleIO, ConsoleState state)
ConstructorConsoleCommand(ConsoleIO consoleIO, ConsoleState state, Map<String,ConsoleSetting> settings)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
askProceed(String str, boolean defVal)
Ask user to proceedvoid
execute(String... parameters)
Execute the given parameters.ConsoleIO
getConsoleIO()
Get console IOMap<String,ConsoleSetting>
getConsoleSettings()
Get console settings mapConsoleState
getConsoleState()
Get console stateString
getHelpLong()
Get long descriptionString
getHelpShort()
Get short description, small enough to fit on one console rowString[]
usesSettings()
Return the names of the settings used.protected void
write(String str)
Write a string to the consoleprotected void
writeError(String str)
Write a string + newline to the console and to the log as an errorprotected void
writeError(String str, Exception e)
Write a string + message of exception + newline to the console and to the log as an errorprotected void
writeInfo(String str)
Write a string + newline to the console and to the log at level INFOprotected void
writeln(String str)
Write a string + newline to the consoleprotected void
writeUnopenedError()
Write repository not opened error
-
-
-
Constructor Detail
-
ConsoleCommand
public ConsoleCommand(ConsoleIO consoleIO)
Constructor- Parameters:
consoleIO
-
-
ConsoleCommand
public ConsoleCommand(ConsoleIO consoleIO, ConsoleState state)
Constructor- Parameters:
consoleIO
-state
-
-
ConsoleCommand
public ConsoleCommand(ConsoleIO consoleIO, ConsoleState state, Map<String,ConsoleSetting> settings)
Constructor- Parameters:
consoleIO
- console IOstate
- console statesettings
- console settings
-
-
Method Detail
-
getConsoleIO
public ConsoleIO getConsoleIO()
Get console IO- Returns:
- console IO
-
getConsoleState
public ConsoleState getConsoleState()
Get console state- Returns:
- console state
-
getConsoleSettings
public Map<String,ConsoleSetting> getConsoleSettings()
Get console settings map- Returns:
- map of console settings
-
getHelpShort
public String getHelpShort()
Get short description, small enough to fit on one console row- Specified by:
getHelpShort
in interfaceHelp
- Returns:
- help string
-
getHelpLong
public String getHelpLong()
Get long description- Specified by:
getHelpLong
in interfaceHelp
- Returns:
- string, can be multiple lines
-
usesSettings
public String[] usesSettings()
Description copied from interface:Command
Return the names of the settings used.- Specified by:
usesSettings
in interfaceCommand
- Returns:
- string array of settings
-
execute
public void execute(String... parameters) throws IOException
Description copied from interface:Command
Execute the given parameters.- Specified by:
execute
in interfaceCommand
- Parameters:
parameters
- parameters typed by user- Throws:
IOException
- if a problem occurs reading or writing
-
write
protected void write(String str)
Write a string to the console- Parameters:
str
- text
-
writeln
protected void writeln(String str)
Write a string + newline to the console- Parameters:
str
- text
-
writeInfo
protected void writeInfo(String str)
Write a string + newline to the console and to the log at level INFO- Parameters:
str
- text
-
writeError
protected void writeError(String str)
Write a string + newline to the console and to the log as an error- Parameters:
str
- text
-
writeError
protected void writeError(String str, Exception e)
Write a string + message of exception + newline to the console and to the log as an error- Parameters:
str
- texte
- exception
-
writeUnopenedError
protected void writeUnopenedError()
Write repository not opened error
-
askProceed
protected boolean askProceed(String str, boolean defVal)
Ask user to proceed- Parameters:
str
- question to askdefVal
- default value- Returns:
- true
-
-