things.thinger.service.local
Class CLIServiceTools

java.lang.Object
  extended by things.thinger.service.local.CLIServiceTools
All Implemented Interfaces:
CLIServiceConstants

public class CLIServiceTools
extends java.lang.Object
implements CLIServiceConstants

Static tools for dealing with CLIService data. These can be used outside the server itself.

Version:
1.0

Version History

EPG - Initial - 1 SEP 07
 
Author:
Erich P. Gatejen

Nested Class Summary
static class CLIServiceTools.Responses
          The specific responses.
static class CLIServiceTools.Result
          The classification of responses.
 
Field Summary
static java.lang.String RESPONSE_LEADER
           
static java.lang.String RESPONSE_MULTI_SEPERATOR
           
static java.lang.String RESPONSE_SINGLE_SEPERATOR
           
static char RESPONSE_TOKEN_SEPERATOR
           
 
Fields inherited from interface things.thinger.service.local.CLIServiceConstants
COMMAND_HELP, COMMAND_KILL, COMMAND_KILL_PID, COMMAND_KILL_PID_POSITION, COMMAND_PING, COMMAND_PING_WHISPER, COMMAND_PING_WHISPER_POSITION, COMMAND_PROCESSLIST, COMMAND_PROCESSLIST_LOG_VALUE, COMMAND_QUIT, COMMAND_RUN, COMMAND_RUN_NAME, COMMAND_RUN_NAME_POSITION, COMMAND_SETPROP, COMMAND_SETPROP_NAME, COMMAND_SETPROP_NAME_POSITION, COMMAND_SETPROP_VALUE, COMMAND_SETPROP_VALUE_POSITION, COMMAND_SHOWPROPS, COMMAND_SHOWPROPS_LOG_VALUE, HELP, POSITION_ARG1, POSITION_ARG2, POSITION_COMMAND, ROLLUP_WAIT
 
Constructor Summary
CLIServiceTools()
           
 
Method Summary
static java.lang.String getCommandNameFromResponse(java.lang.String responseString)
          Get the Command Name from the response.
static java.lang.String getCompleteResponse(CommandResponse.CompletionDisposition cd, java.lang.String commandName, Receipt finalReceipt, java.lang.String text, java.lang.String additional)
          Get a complete response string.
static Receipt.Type getReceiptFromResponse(java.lang.String responseString)
          Get the Receipt Type from the response.
static CLIServiceTools.Responses getResponse(CommandResponse.CompletionDisposition cd)
          Get the appropriate response given the disposition.
static CLIServiceTools.Result getResultFromResponse(java.lang.String responseString)
          Get the Result from the response.
static java.lang.String getTextFromResponse(java.lang.String responseString)
          Get the Receipt Type from the response.
static boolean isResponseOkAndComplete(java.lang.String responseString)
          Is the command response indicate it's complete and ok.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESPONSE_TOKEN_SEPERATOR

public static final char RESPONSE_TOKEN_SEPERATOR
See Also:
Constant Field Values

RESPONSE_SINGLE_SEPERATOR

public static final java.lang.String RESPONSE_SINGLE_SEPERATOR
See Also:
Constant Field Values

RESPONSE_MULTI_SEPERATOR

public static final java.lang.String RESPONSE_MULTI_SEPERATOR
See Also:
Constant Field Values

RESPONSE_LEADER

public static final java.lang.String RESPONSE_LEADER
See Also:
Constant Field Values
Constructor Detail

CLIServiceTools

public CLIServiceTools()
Method Detail

getResponse

public static CLIServiceTools.Responses getResponse(CommandResponse.CompletionDisposition cd)
Get the appropriate response given the disposition.

Parameters:
cd - the complesion disposition.
Returns:
the responses value

getCompleteResponse

public static java.lang.String getCompleteResponse(CommandResponse.CompletionDisposition cd,
                                                   java.lang.String commandName,
                                                   Receipt finalReceipt,
                                                   java.lang.String text,
                                                   java.lang.String additional)
Get a complete response string.

Parameters:
cd - the completion disposition.
commandName - the textual command name
finalReceipt - the final receipt. It can be null.
text - the text message. It can be null.
additional - any additional response text. It cna be null.
Returns:
the full and complete response text.

isResponseOkAndComplete

public static boolean isResponseOkAndComplete(java.lang.String responseString)
Is the command response indicate it's complete and ok.

Parameters:
responseString - the response string.
Returns:
true if complete and ok, otherwise false (including if this method fails).

getCommandNameFromResponse

public static java.lang.String getCommandNameFromResponse(java.lang.String responseString)
Get the Command Name from the response. If it can't, it'll just return null.

Parameters:
responseString - the string to examine.
Returns:
the command name or null.

getResultFromResponse

public static CLIServiceTools.Result getResultFromResponse(java.lang.String responseString)
Get the Result from the response. If it can't, it'll just return null.

Parameters:
responseString - the string to examine.
Returns:
the Result or null.

getReceiptFromResponse

public static Receipt.Type getReceiptFromResponse(java.lang.String responseString)
Get the Receipt Type from the response. If it can't, it'll just return null.

Parameters:
responseString - the string to examine.
Returns:
the Receipt Type or null.
See Also:
Receipt

getTextFromResponse

public static java.lang.String getTextFromResponse(java.lang.String responseString)
Get the Receipt Type from the response. If it can't, it'll just return null.

Parameters:
responseString - the string to examine.
Returns:
the Text or null.
See Also:
Receipt


Things.