Package org.apache.pulsar.shell
Interface ShellCommandsProvider
- All Known Implementing Classes:
AdminShell,ClientShell,ConfigShell
public interface ShellCommandsProvider
Commands provider for Pulsar shell.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcleanupState(Properties properties) Cleanup state after a command is executed.Current admin url for connecting to pulsar admin.com.beust.jcommander.JCommanderReturn JCommander instance, if exists.getName()Name of the commands.Current service url for connecting to brokers.booleanrunCommand(String[] args) Run command for the passed args.voidsetupState(Properties properties) Init state before a command is executed.
-
Method Details
-
getName
String getName()Name of the commands. This will be used as program name.- Returns:
-
getServiceUrl
String getServiceUrl()Current service url for connecting to brokers. If the provider doesn't need brokers connection or the service url is not set it must return null.- Returns:
- service url
-
getAdminUrl
String getAdminUrl()Current admin url for connecting to pulsar admin. If the provider doesn't need brokers connection or the admin url is not set it must return null.- Returns:
- admin url
-
setupState
Init state before a command is executed. If the implementing class rely on JCommander, it's suggested to not recycle JCommander objects because they are meant to single-shot usage.- Parameters:
properties-
-
cleanupState
Cleanup state after a command is executed. If the implementing class rely on JCommander, it's suggested to not recycle JCommander objects because they are meant to single-shot usage.- Parameters:
properties-
-
getJCommander
com.beust.jcommander.JCommander getJCommander()Return JCommander instance, if exists.- Returns:
-
runCommand
Run command for the passed args.- Parameters:
args- arguments for the command. Note that the first word of the user command is omitted.- Throws:
Exception- if any error occurs. The shell session will not be closed.
-