org.opengts.war.ctracgts
Class Response

java.lang.Object
  extended by org.opengts.war.ctracgts.Response

public class Response
extends java.lang.Object


Field Summary
static java.lang.String ERROR
           
static java.lang.String JSON_message
           
static java.lang.String JSON_success
           
static java.lang.String JSON_type
           
static java.lang.String OK
           
static java.lang.String RESP_ERR_
           
static java.lang.String RESP_ERR_ACCOUNT
           
static java.lang.String RESP_ERR_COMMAND
           
static java.lang.String RESP_ERR_DEVICE
           
static java.lang.String RESP_ERR_DEVICE_CMD
           
static java.lang.String RESP_ERR_EXPIRED
           
static java.lang.String RESP_ERR_GROUP
           
static java.lang.String RESP_ERR_INTERNAL
           
static java.lang.String RESP_ERR_JSON
           
static java.lang.String RESP_ERR_LOGIN
           
static java.lang.String RESP_ERR_MESSAGE
           
static java.lang.String RESP_ERR_MOBILEID
           
static java.lang.String RESP_ERR_NO_GET
           
static java.lang.String RESP_ERR_NO_POST
           
static java.lang.String RESP_ERR_NO_RTP
           
static java.lang.String RESP_ERR_NO_SUPPORT
           
static java.lang.String RESP_ERR_NOT_AUTH
           
static java.lang.String RESP_ERR_PARK
           
static java.lang.String RESP_ERR_SYNTAX
           
static java.lang.String RESP_OK_
           
static java.lang.String RESP_OK_AUTH
           
static java.lang.String RESP_OK_EVENTS
           
static java.lang.String RESP_OK_JSON
           
static java.lang.String RESP_OK_LOGIN
           
static java.lang.String RESP_OK_MESSAGE
           
static java.lang.String RESP_OK_MOBILEID
           
static java.lang.String RESP_OK_NEWVERS
           
static java.lang.String RESP_OK_NOTICE
           
static java.lang.String RESP_OK_SUCCESS
           
static java.lang.String RESP_OK_UNITS
           
static java.lang.String RESP_OK_VERSION
           
static java.lang.String TYPE_JSON
           
 
Constructor Summary
Response()
           
 
Method Summary
static java.lang.String AUTH(boolean json, java.lang.String m)
           
static java.lang.String CreateResponse(boolean isJSON, java.lang.String resp, RTProperties rtp)
          Creates/Returns a Response String
static java.lang.String CreateResponse(boolean isJSON, java.lang.String resp, java.lang.String msg)
          Creates/Returns a Response String
static JSON._Object CreateResponseJSON(java.lang.String success, java.lang.String type, java.lang.String message)
          Creates/Returns a Response JSON object
static java.lang.String ERR_ACCOUNT(boolean json, java.lang.String m)
           
static java.lang.String ERR_COMMAND(boolean json, java.lang.String m)
           
static java.lang.String ERR_DEVICE_CMD(boolean json, java.lang.String m)
           
static java.lang.String ERR_DEVICE(boolean json, java.lang.String m)
           
static java.lang.String ERR_EXPIRED(boolean json, java.lang.String m)
           
static java.lang.String ERR_GROUP(boolean json, java.lang.String m)
           
static java.lang.String ERR_INTERNAL(boolean json, java.lang.String m)
           
static java.lang.String ERR_JSON(boolean json, java.lang.String j)
           
static java.lang.String ERR_LOGIN(boolean json, java.lang.String m)
           
static java.lang.String ERR_MESSAGE(boolean json, java.lang.String m)
           
static java.lang.String ERR_MOBILEID(boolean json, RTProperties m)
           
static java.lang.String ERR_NO_GET(boolean json, java.lang.String m)
           
static java.lang.String ERR_NO_POST(boolean json, java.lang.String m)
           
static java.lang.String ERR_NO_RTP(boolean json, java.lang.String m)
           
static java.lang.String ERR_NO_SUPPORT(boolean json, java.lang.String m)
           
static java.lang.String ERR_NOT_AUTH(boolean json, java.lang.String m)
           
static java.lang.String ERR_PARK(boolean json, java.lang.String m)
           
static java.lang.String ERR_SYNTAX(boolean json, java.lang.String m)
           
static java.lang.String EVENTS(boolean json, RTProperties m)
           
static java.lang.String GetMessage(java.lang.String code)
          Extracts and returns the text message from the Response Code
static boolean IsError(java.lang.String code)
          Returns true if the specified Response Code represents an Error
static boolean IsExpired(java.lang.String resp)
          Returns true if the specified Response Code represents an "Expired" error
static boolean IsInternal(java.lang.String resp)
          Returns true if the specified Response Code represents an "Internal" error
static boolean IsNoRTP(java.lang.String resp)
          Returns true if the specified Response Code represents a "RTP not supported" error
static boolean IsNotAuth(java.lang.String resp)
          Returns true if the specified Response Code represents a "Not Authorized" error
static boolean IsOK(java.lang.String code)
          Returns true if the specified Response Code represents Success/Ack
static boolean IsResponse(java.lang.String resp, java.lang.String code)
          Returns true if the specified Response starts with the specified Code
static java.lang.String LOGIN(boolean json, java.lang.String m)
           
static java.lang.String MESSAGE(boolean json, java.lang.String m)
           
static java.lang.String MOBILEID(boolean json, RTProperties m)
           
static java.lang.String NEWVERS(boolean json, RTProperties v)
           
static java.lang.String NOTICE(boolean json, java.lang.String m)
           
static java.lang.String OK_JSON(boolean json, java.lang.String j)
           
static java.lang.String[] ParseMessage(java.lang.String code)
          Parse and return the Response text into a 3-element array with the following format:
"Type", "SubType", "Message"
static java.lang.String SUCCESS(boolean json, java.lang.String m)
           
static java.lang.String UNITS(boolean json, java.lang.String m)
           
static java.lang.String VERSION(boolean json, RTProperties m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OK

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

ERROR

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

RESP_OK_

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

RESP_OK_SUCCESS

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

RESP_OK_VERSION

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

RESP_OK_MOBILEID

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

RESP_OK_LOGIN

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

RESP_OK_UNITS

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

RESP_OK_AUTH

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

RESP_OK_NEWVERS

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

RESP_OK_NOTICE

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

RESP_OK_EVENTS

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

RESP_OK_MESSAGE

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

RESP_OK_JSON

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

RESP_ERR_

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

RESP_ERR_MOBILEID

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

RESP_ERR_MESSAGE

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

RESP_ERR_NO_GET

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

RESP_ERR_NO_POST

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

RESP_ERR_NO_RTP

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

RESP_ERR_NOT_AUTH

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

RESP_ERR_EXPIRED

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

RESP_ERR_INTERNAL

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

RESP_ERR_SYNTAX

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

RESP_ERR_COMMAND

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

RESP_ERR_LOGIN

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

RESP_ERR_ACCOUNT

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

RESP_ERR_DEVICE

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

RESP_ERR_DEVICE_CMD

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

RESP_ERR_PARK

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

RESP_ERR_JSON

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

RESP_ERR_NO_SUPPORT

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

RESP_ERR_GROUP

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

JSON_success

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

JSON_type

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

JSON_message

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

TYPE_JSON

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

Response

public Response()
Method Detail

VERSION

public static java.lang.String VERSION(boolean json,
                                       RTProperties m)

MOBILEID

public static java.lang.String MOBILEID(boolean json,
                                        RTProperties m)

EVENTS

public static java.lang.String EVENTS(boolean json,
                                      RTProperties m)

MESSAGE

public static java.lang.String MESSAGE(boolean json,
                                       java.lang.String m)

NOTICE

public static java.lang.String NOTICE(boolean json,
                                      java.lang.String m)

LOGIN

public static java.lang.String LOGIN(boolean json,
                                     java.lang.String m)

UNITS

public static java.lang.String UNITS(boolean json,
                                     java.lang.String m)

AUTH

public static java.lang.String AUTH(boolean json,
                                    java.lang.String m)

NEWVERS

public static java.lang.String NEWVERS(boolean json,
                                       RTProperties v)

SUCCESS

public static java.lang.String SUCCESS(boolean json,
                                       java.lang.String m)

OK_JSON

public static java.lang.String OK_JSON(boolean json,
                                       java.lang.String j)

ERR_MOBILEID

public static java.lang.String ERR_MOBILEID(boolean json,
                                            RTProperties m)

ERR_NOT_AUTH

public static java.lang.String ERR_NOT_AUTH(boolean json,
                                            java.lang.String m)

ERR_MESSAGE

public static java.lang.String ERR_MESSAGE(boolean json,
                                           java.lang.String m)

ERR_EXPIRED

public static java.lang.String ERR_EXPIRED(boolean json,
                                           java.lang.String m)

ERR_INTERNAL

public static java.lang.String ERR_INTERNAL(boolean json,
                                            java.lang.String m)

ERR_NO_GET

public static java.lang.String ERR_NO_GET(boolean json,
                                          java.lang.String m)

ERR_NO_POST

public static java.lang.String ERR_NO_POST(boolean json,
                                           java.lang.String m)

ERR_NO_RTP

public static java.lang.String ERR_NO_RTP(boolean json,
                                          java.lang.String m)

ERR_SYNTAX

public static java.lang.String ERR_SYNTAX(boolean json,
                                          java.lang.String m)

ERR_COMMAND

public static java.lang.String ERR_COMMAND(boolean json,
                                           java.lang.String m)

ERR_LOGIN

public static java.lang.String ERR_LOGIN(boolean json,
                                         java.lang.String m)

ERR_ACCOUNT

public static java.lang.String ERR_ACCOUNT(boolean json,
                                           java.lang.String m)

ERR_DEVICE

public static java.lang.String ERR_DEVICE(boolean json,
                                          java.lang.String m)

ERR_DEVICE_CMD

public static java.lang.String ERR_DEVICE_CMD(boolean json,
                                              java.lang.String m)

ERR_JSON

public static java.lang.String ERR_JSON(boolean json,
                                        java.lang.String j)

ERR_PARK

public static java.lang.String ERR_PARK(boolean json,
                                        java.lang.String m)

ERR_NO_SUPPORT

public static java.lang.String ERR_NO_SUPPORT(boolean json,
                                              java.lang.String m)

ERR_GROUP

public static java.lang.String ERR_GROUP(boolean json,
                                         java.lang.String m)

CreateResponseJSON

public static JSON._Object CreateResponseJSON(java.lang.String success,
                                              java.lang.String type,
                                              java.lang.String message)
Creates/Returns a Response JSON object

Parameters:
success - The value of the "success" JSON tag
type - The value of the "type" JSON tag
message - The value of the "message" JSON tag
Returns:
The Response JSON object

CreateResponse

public static java.lang.String CreateResponse(boolean isJSON,
                                              java.lang.String resp,
                                              java.lang.String msg)
Creates/Returns a Response String

Parameters:
isJSON - True if response String must be a JSON object
resp - The Response Type:SubType
msg - The Response Message
Returns:
The Response String

CreateResponse

public static java.lang.String CreateResponse(boolean isJSON,
                                              java.lang.String resp,
                                              RTProperties rtp)
Creates/Returns a Response String

Parameters:
isJSON - True if response String must be a JSON object
resp - The Response Type:SubType
rtp - The RTProperties instance
Returns:
The Response String

IsResponse

public static boolean IsResponse(java.lang.String resp,
                                 java.lang.String code)
Returns true if the specified Response starts with the specified Code

Parameters:
resp - The Response to check
code - The Response Code
Returns:
True if the Response Code represents an error, false otherwise.

IsOK

public static boolean IsOK(java.lang.String code)
Returns true if the specified Response Code represents Success/Ack

Parameters:
code - The Response Code to check
Returns:
True if the Response Code represents an Success/Ack, false otherwise.

IsError

public static boolean IsError(java.lang.String code)
Returns true if the specified Response Code represents an Error

Parameters:
code - The Response Code to check
Returns:
True if the Response Code represents an error, false otherwise.

IsNoRTP

public static boolean IsNoRTP(java.lang.String resp)
Returns true if the specified Response Code represents a "RTP not supported" error

Parameters:
resp - The Response Code to check
Returns:
True if the Response Code represents a "RTP not supported" error, false otherwise.

IsNotAuth

public static boolean IsNotAuth(java.lang.String resp)
Returns true if the specified Response Code represents a "Not Authorized" error

Parameters:
resp - The Response Code to check
Returns:
True if the Response Code represents a "Not Authorized" error, false otherwise.

IsExpired

public static boolean IsExpired(java.lang.String resp)
Returns true if the specified Response Code represents an "Expired" error

Parameters:
resp - The Response Code to check
Returns:
True if the Response Code represents an "Expired" error, false otherwise.

IsInternal

public static boolean IsInternal(java.lang.String resp)
Returns true if the specified Response Code represents an "Internal" error

Parameters:
resp - The Response Code to check
Returns:
True if the Response Code represents an "Internal" error, false otherwise.

ParseMessage

public static java.lang.String[] ParseMessage(java.lang.String code)
Parse and return the Response text into a 3-element array with the following format:
"Type", "SubType", "Message"

Parameters:
code - The Response Code
Returns:
A 3-element String array.

GetMessage

public static java.lang.String GetMessage(java.lang.String code)
Extracts and returns the text message from the Response Code

Parameters:
code - The Response Code from which the text message is returned
Returns:
The text message, or a blank string if there is no text message.