|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.enterprise.communications.command.client.CmdlineClient
public class CmdlineClient
A command line client that can be used to issue a command from a shell or script.
Note that using this type of client limits the types of data that can be sent to the server; specifically
parameters to the command. Since arguments are parsed from the command line, only data that can be represented as a
String can be passed to the server as command parameters.
| Constructor Summary | |
|---|---|
CmdlineClient()
|
|
| Method Summary | |
|---|---|
Command |
buildCommand(String[] args)
Simply builds and returns a command defined by the given cmdline arguments. |
CommandClient |
buildCommandClient(String[] args)
Simply builds and returns a command client defined by the given cmdline arguments. |
String |
getUsage()
Returns the help usage string. |
CommandResponse |
issueCommand(CommandType commandType,
String locatorURI)
Convienence method that invokes a given command type on the remote server found at the given URI. |
CommandResponse |
issueCommand(CommandType commandType,
String locatorURI,
Map<String,String> params)
Convienence method that invokes a given command type (with the given set of parameter values) on the remote server found at the given URI. |
CommandResponse |
issueCommand(String[] args)
Issues a command defined by the given cmdline arguments. |
static void |
main(String[] args)
Main entry point to the command line client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CmdlineClient()
| Method Detail |
|---|
public static void main(String[] args)
args - specifies the command to invoke and its parameters
public CommandClient buildCommandClient(String[] args)
throws IllegalArgumentException,
ClassNotFoundException,
InstantiationException,
IllegalAccessException,
MalformedURLException
Given the command type information and the optional package locations where command clients can be found, this
will attempt to instantiate the specific client for the specific command. If the client cannot be found, an
attempt will be made to issue the command using the generic client.
args - cmdline arguments
IllegalArgumentException - if a failure occurred while processing the cmdline arguments
ClassNotFoundException - if failed to find a valid command client class
IllegalAccessException - if failed to instantiate the command's client class
InstantiationException - if failed to instantiate the command's client class
MalformedURLException - if the given URL is invalid and cannot be used to locate an invoker
public Command buildCommand(String[] args)
throws IllegalArgumentException,
ClassNotFoundException,
InstantiationException,
IllegalAccessException,
MalformedURLException
Given the command type information and the optional package locations where command clients can be found, this
will attempt to instantiate the specific client for the specific command. If the client cannot be found, an
attempt will be made to issue the command using the generic client.
args - cmdline arguments
IllegalArgumentException - if a failure occurred while processing the cmdline arguments
ClassNotFoundException - if failed to find a valid command client class
IllegalAccessException - if failed to instantiate the command's client class
InstantiationException - if failed to instantiate the command's client class
MalformedURLException - if the given URL is invalid and cannot be used to locate an invoker
public CommandResponse issueCommand(String[] args)
throws IllegalArgumentException,
ClassNotFoundException,
InstantiationException,
IllegalAccessException,
MalformedURLException,
Throwable
Given the command type information and the optional package locations where command clients can be found, this
will attempt to instantiate the specific client for the specific command. If the client cannot be found, an
attempt will be made to issue the command using the generic client.
args - cmdline arguments
IllegalArgumentException - if a failure occurred while processing the cmdline arguments
ClassNotFoundException - if failed to find a valid command client class
IllegalAccessException - if failed to instantiate the command's client class
InstantiationException - if failed to instantiate the command's client class
MalformedURLException - if the given URL is invalid and cannot be used to locate an invoker
Throwable - any other error that was due to a failure during the invocation of the command
public CommandResponse issueCommand(CommandType commandType,
String locatorURI,
Map<String,String> params)
throws IllegalArgumentException,
MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalAccessException,
Throwable
Note that this method may or may not be the most appropriate to use. Use this method if you do not know ahead
of time the type of command you are going to issue. If you already know the type of command you are going to
issue, it is best to use the command's more strongly typed client subclass method that implements
CommandClient.invoke(Command).
commandType - the type of command to issuelocatorURI - location of the remote serverparams - set of name/value parameters sent along with the command (may be null)
IllegalArgumentException - if a failure occurred while processing the cmdline arguments
ClassNotFoundException - if failed to find the command's client class
IllegalAccessException - if failed to instantiate the command's client class
InstantiationException - if failed to instantiate the command's client class
MalformedURLException - if the given URL is invalid and cannot be used to locate an invoker
Throwable - any other error that was due to a failure during the invocation of the command
public CommandResponse issueCommand(CommandType commandType,
String locatorURI)
throws IllegalArgumentException,
MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalAccessException,
Throwable
commandType - the type of command to issuelocatorURI - location of the remote server
IllegalArgumentException - if a failure occurred while processing the cmdline arguments
ClassNotFoundException - if failed to find the command's client class
IllegalAccessException - if failed to instantiate the command's client class
InstantiationException - if failed to instantiate the command's client class
MalformedURLException - if the given URL is invalid and cannot be used to locate an invoker
Throwable - any other error that was due to a failure during the invocation of the commandpublic String getUsage()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||