public interface CommandClient
| Modifier and Type | Method and Description |
|---|---|
void |
connectRemoteCommunicator()
Provides a mechanism by which users can notify this object that the user is about to issue commands and that a
remoting communicator should be created and should connect to the remote server.
|
Command |
createNewCommand(Map<String,Object> params)
Creates a new
Command object that can be used by this client. |
void |
disconnectRemoteCommunicator()
Provides a mechanism by which users can notify this object that the user is no longer interested in issuing
commands to the remote server.
|
RemoteCommunicator |
getRemoteCommunicator()
Gets the object that encapsulates the underlying remote framework implementation.
|
CommandResponse |
invoke(Command command)
Invokes the actual command by utilizing the remoting communicator to transport the command to the server.
|
CommandResponse |
invoke(Map<String,Object> params)
Invokes the actual command by utilizing the remoting communicator to transport the command to the server.
|
void |
setRemoteCommunicator(RemoteCommunicator remoteCommunicator)
Sets the object that encapsulates the underlying remote framework implementation.
|
RemoteCommunicator getRemoteCommunicator()
void setRemoteCommunicator(RemoteCommunicator remoteCommunicator)
remoteCommunicator - the remote communicator object that is specific to a particular underlying remote
framework.void connectRemoteCommunicator()
throws Exception
Exception - if failed to connect to the remote server for any reasondisconnectRemoteCommunicator()void disconnectRemoteCommunicator()
Note that the user may later on change its mind and reconnect simply by calling
connectRemoteCommunicator(). Calling that method will reconnect the remoting communicator.
CommandResponse invoke(Map<String,Object> params) throws Throwable
This method is typically used in conjunction with CmdlineClient to invoke commands that are unknown at
compile-time. In this case, params typically contain values of type String - these are
text-based parameters that were entered via a script or cmdline. That text-based data will be
converted to meaningful Java types in order to be able to build
the proper Command objects.
params - a set of command parameters that are to be used to execute the proper command (may be
null)Throwable - on any error (either during the sending or execution of the command)createNewCommand(Map)CommandResponse invoke(Command command) throws Throwable
This is the prefered method for clients to call when it needs to invoke commands since each Command is
strongly typed and provides compile-time error checking. However, in order to be able to invoke this method on
subclasses, concrete implementations must be used and hence the actual command that is to be issued must be known
at compile time. Should a dynamic runtime client be needed to invoke commands unknown at compile time (see
CmdlineClient), the use of invoke(Map) will be required.
command - encapsulates the command that is to be executed (must not be null)Throwable - on any error (either during the sending or execution of the command)Command createNewCommand(Map<String,Object> params)
Command object that can be used by this client. The client can take this new command
instance, fill it in with parameter values and execute it. The given map of parameters is optional; if non-
null, all parameters found in the map will be added to the command.params - contains parameter values keyed on the parameter names (may be null)Command instanceCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.