public abstract class ResultMapParser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CORE_AUTH_FAIL_STRING_1
Signals access (login) needed.
|
protected static java.lang.String |
CORE_AUTH_FAIL_STRING_2
Signals access (login) needed.
|
protected static java.lang.String |
CORE_AUTH_FAIL_STRING_3
Signals ticket has expired.
|
protected static java.lang.String |
CORE_AUTH_FAIL_STRING_4
Signals ticket has expired.
|
Constructor and Description |
---|
ResultMapParser() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getErrorOrInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
Gets the info/warning/error/fatal message from the passed-in Perforce
command results map.
|
static java.lang.String |
getErrorStr(java.util.Map<java.lang.String,java.lang.Object> map)
RPC impl errors come across the wire as a map in the form usually like
this:
|
static java.lang.String |
getInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
Gets the info message from the passed-in Perforce command results map.
|
static java.lang.String |
getWarningStr(java.util.Map<java.lang.String,java.lang.Object> map) |
static boolean |
handleErrorOrInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
Handle error or info str.
|
static boolean |
handleErrorStr(java.util.Map<java.lang.String,java.lang.Object> map)
Tests the map for errors and throws an exception if found.
|
static java.lang.String |
handleFileErrorStr(java.util.Map<java.lang.String,java.lang.Object> map)
Handle file error str.
|
static boolean |
handleWarningStr(java.util.Map<java.lang.String,java.lang.Object> map)
Tests the map for warnings and throws an exception if found.
|
static boolean |
isAuthFail(java.lang.String errStr)
Checks to see if an error String is as a result of an auth fail.
|
static boolean |
isExistClientOrLabelOrUser(java.util.Map<java.lang.String,java.lang.Object> map)
Unfortunately, the p4 command version returns a valid map for
non-existent clients/labels/users; the only way we can detect that the
client/label/user doesn't exist is to see if the Update or Access map
entries exist -- if they do, the client/label/user is (most likely) a
valid client/label/user on this server.
|
static boolean |
isInfoMessage(java.util.Map<java.lang.String,java.lang.Object> map)
Checks for a info message.
|
static boolean |
isNonExistClientOrLabelOrUser(java.util.Map<java.lang.String,java.lang.Object> map)
Unfortunately, the p4 command version returns a valid map for
non-existent clients/labels/users; the only way we can detect that the
client/label/user doesn't exist is to see if the Update or Access map
entries exist -- if they do, the client/label/user is (most likely) a
valid client/label/user on this server.
|
static boolean |
isWarningMessage(java.util.Map<java.lang.String,java.lang.Object> map)
Checks for a warning message.
|
static java.util.List<IExtendedFileSpec> |
parseCommandResultMapAsExtendedFileSpecs(int id,
IServer server,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
Parses the command result map as file specs.
|
static java.util.List<IFileSpec> |
parseCommandResultMapAsFileSpecs(int id,
IServer server,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
Parses the command result map as file specs.
|
static java.lang.String |
parseCommandResultMapAsString(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
Parses the command result map as string.
|
static java.lang.String |
parseCommandResultMapIfIsInfoMessageAsString(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
Parses the command result map to return a String of info messages.
|
static java.util.List<IFileSpec> |
parseGraphCommandResultMapAsFileSpecs(IServer server,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
Parses the graph command result map as file specs.
|
static void |
throwRequestExceptionIfErrorMessageFound(java.util.Map<java.lang.String,java.lang.Object> map)
Throw request exception if error message found.
|
protected static final java.lang.String CORE_AUTH_FAIL_STRING_1
protected static final java.lang.String CORE_AUTH_FAIL_STRING_2
protected static final java.lang.String CORE_AUTH_FAIL_STRING_3
protected static final java.lang.String CORE_AUTH_FAIL_STRING_4
public static java.lang.String parseCommandResultMapIfIsInfoMessageAsString(@Nonnull java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps) throws AccessException, RequestException
resultMaps
- the result mapsAccessException
- the access exceptionRequestException
- the request exceptionpublic static boolean isInfoMessage(java.util.Map<java.lang.String,java.lang.Object> map)
map
- the mappublic static boolean isWarningMessage(java.util.Map<java.lang.String,java.lang.Object> map)
map
- the mappublic static boolean handleErrorStr(java.util.Map<java.lang.String,java.lang.Object> map) throws RequestException, AccessException
map
- the mapRequestException
- the request exceptionAccessException
- the access exceptionpublic static boolean handleWarningStr(java.util.Map<java.lang.String,java.lang.Object> map) throws RequestException, AccessException
map
- the mapRequestException
- the request exceptionAccessException
- the access exceptionpublic static java.lang.String getErrorStr(java.util.Map<java.lang.String,java.lang.Object> map)
fmt0=Access for user '%user%' has not been enabled by 'p4 protect'.,
func=client-Message, user=nouser, code0=822483067
With tags being used for non-error payloads, we can just basically pick
up the presence of the code0 entry; if it's there, use fmt0 as the format
and the other args as appropriate...
FIXME: work with multiple code/fmt sets... -- HR.
map
- the mappublic static java.lang.String getWarningStr(java.util.Map<java.lang.String,java.lang.Object> map)
public static boolean isAuthFail(java.lang.String errStr)
errStr
- the err strpublic static java.lang.String getInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
Note that the severity code is MessageSeverityCode.E_INFO. Therefore, only message with severity code = MessageSeverityCode.E_INFO will be returned.
RPC impl errors come across the wire as a map in the form usually like this:
fmt0=Access for user '%user%' has not been enabled by 'p4 protect'.,
func=client-Message, user=nouser, code0=822483067
Note that the code0 entry will be used to get the severity level; the
fmt0 entry contains the message.
map
- Perforce command results mappublic static java.lang.String getErrorOrInfoStr(java.util.Map<java.lang.String,java.lang.Object> map)
Note that the minimum severity code is MessageSeverityCode.E_INFO. Therefore, only message with severity code >= MessageSeverityCode.E_INFO will be returned.
RPC impl errors come across the wire as a map in the form usually like this:
fmt0=Access for user '%user%' has not been enabled by 'p4 protect'.,
func=client-Message, user=nouser, code0=822483067
Note that the code0 entry will be used to get the severity level; the
fmt0 entry contains the message.
map
- Perforce command results mappublic static void throwRequestExceptionIfErrorMessageFound(java.util.Map<java.lang.String,java.lang.Object> map) throws RequestException
map
- the mapRequestException
- the request exceptionpublic static boolean handleErrorOrInfoStr(java.util.Map<java.lang.String,java.lang.Object> map) throws RequestException, AccessException
map
- the mapRequestException
- the request exceptionAccessException
- the access exceptionpublic static java.lang.String parseCommandResultMapAsString(@Nonnull java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps) throws AccessException, RequestException
resultMaps
- the result mapsAccessException
- the access exceptionRequestException
- the request exceptionpublic static java.util.List<IFileSpec> parseCommandResultMapAsFileSpecs(int id, IServer server, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
id
- the idserver
- the serverresultMaps
- the result mapspublic static java.util.List<IExtendedFileSpec> parseCommandResultMapAsExtendedFileSpecs(int id, IServer server, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
id
- the idserver
- the serverresultMaps
- the result mapspublic static java.util.List<IFileSpec> parseGraphCommandResultMapAsFileSpecs(IServer server, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> resultMaps)
server
- the serverresultMaps
- the result mapspublic static java.lang.String handleFileErrorStr(java.util.Map<java.lang.String,java.lang.Object> map) throws ConnectionException, AccessException
map
- the mapConnectionException
- the connection exceptionAccessException
- the access exceptionpublic static boolean isExistClientOrLabelOrUser(java.util.Map<java.lang.String,java.lang.Object> map)
map
- the mappublic static boolean isNonExistClientOrLabelOrUser(java.util.Map<java.lang.String,java.lang.Object> map)
map
- the map