Interface Command
-
- All Known Implementing Classes:
CommandBase
,Commands.CnxnStatResetCommand
,Commands.ConfCommand
,Commands.ConsCommand
,Commands.DigestCommand
,Commands.DirsCommand
,Commands.DumpCommand
,Commands.EnvCommand
,Commands.GetTraceMaskCommand
,Commands.InitialConfigurationCommand
,Commands.IsroCommand
,Commands.LastSnapshotCommand
,Commands.LeaderCommand
,Commands.MonitorCommand
,Commands.ObserverCnxnStatResetCommand
,Commands.RestoreCommand
,Commands.RuokCommand
,Commands.SetTraceMaskCommand
,Commands.SnapshotCommand
,Commands.SrvrCommand
,Commands.StatCommand
,Commands.StatResetCommand
,Commands.SyncedObserverConsCommand
,Commands.SystemPropertiesCommand
,Commands.VotingViewCommand
,Commands.WatchCommand
,Commands.WatchesByPathCommand
,Commands.WatchSummaryCommand
,Commands.ZabStateCommand
,GetCommand
,PostCommand
public interface Command
Interface implemented by all commands runnable by JettyAdminServer.- See Also:
CommandBase
,Commands
,JettyAdminServer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AuthRequest
getAuthRequest()
Set<String>
getNames()
The set of all names that can be used to refer to this command (e.g., "configuration", "config", and "conf").String
getPrimaryName()
The name that is returned with the command response and that appears in the list of all commands.boolean
isServerRequired()
CommandResponse
runGet(ZooKeeperServer zkServer, Map<String,String> kwargs)
Run this command for HTTP GET request.CommandResponse
runPost(ZooKeeperServer zkServer, InputStream inputStream)
Run this command for HTTP POST.
-
-
-
Method Detail
-
getNames
Set<String> getNames()
The set of all names that can be used to refer to this command (e.g., "configuration", "config", and "conf").
-
getPrimaryName
String getPrimaryName()
The name that is returned with the command response and that appears in the list of all commands. This should be a member of the set returned by getNames().
-
isServerRequired
boolean isServerRequired()
- Returns:
- true if the command requires an active ZooKeeperServer or a synced peer in order to resolve
-
getAuthRequest
AuthRequest getAuthRequest()
- Returns:
- AuthRequest associated to the command. Null means auth check is not required.
-
runGet
CommandResponse runGet(ZooKeeperServer zkServer, Map<String,String> kwargs)
Run this command for HTTP GET request. Commands take a ZooKeeperServer, String-valued keyword arguments and return a CommandResponse object containing any information constituting the response to the command. Commands are responsible for parsing keyword arguments and performing any error handling if necessary. Errors should be reported by setting the "error" entry of the returned map with an appropriate message rather than throwing an exception.- Parameters:
zkServer
- ZooKeeper serverkwargs
- keyword -> argument value mapping- Returns:
- CommandResponse representing response to command containing at minimum: - "command" key containing the command's primary name - "error" key containing a String error message or null if no error
-
runPost
CommandResponse runPost(ZooKeeperServer zkServer, InputStream inputStream)
Run this command for HTTP POST. Commands take a ZooKeeperServer and InputStream and return a CommandResponse object containing any information constituting the response to the command. Commands are responsible for parsing keyword arguments and performing any error handling if necessary. Errors should be reported by setting the "error" entry of the returned map with an appropriate message rather than throwing an exception.- Parameters:
zkServer
- ZooKeeper serverinputStream
- InputStream from request- Returns:
- CommandResponse representing response to command containing at minimum: - "command" key containing the command's primary name - "error" key containing a String error message or null if no error
-
-