public abstract class ResultMapParser extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
CORE_AUTH_FAIL_STRING_1
Signals access (login) needed.
|
protected static String |
CORE_AUTH_FAIL_STRING_2
Signals access (login) needed.
|
protected static String |
CORE_AUTH_FAIL_STRING_3
Signals ticket has expired.
|
protected static String |
CORE_AUTH_FAIL_STRING_4
Signals ticket has expired.
|
Constructor and Description |
---|
ResultMapParser() |
Modifier and Type | Method and Description |
---|---|
static String |
getErrorOrInfoStr(Map<String,Object> map)
Gets the info/warning/error/fatal message from the passed-in Perforce
command results map.
|
static String |
getErrorStr(Map<String,Object> map)
RPC impl errors come across the wire as a map in the form usually like
this:
|
static String |
getInfoStr(Map<String,Object> map)
Gets the info message from the passed-in Perforce command results map.
|
static boolean |
handleErrorOrInfoStr(Map<String,Object> map)
Handle error or info str.
|
static boolean |
handleErrorStr(Map<String,Object> map)
Tests the map for errors and throws an exception if found.
|
static String |
handleFileErrorStr(Map<String,Object> map)
Handle file error str.
|
static boolean |
isAuthFail(String errStr)
Checks to see if an error String is as a result of an auth fail.
|
static boolean |
isExistClientOrLabelOrUser(Map<String,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(Map<String,Object> map)
Checks if is info message.
|
static boolean |
isNonExistClientOrLabelOrUser(Map<String,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 List<IFileSpec> |
parseCommandResultMapAsFileSpecs(int id,
IServer server,
List<Map<String,Object>> resultMaps)
Parses the command result map as file specs.
|
static String |
parseCommandResultMapAsString(List<Map<String,Object>> resultMaps)
Parses the command result map as string.
|
static String |
parseCommandResultMapIfIsInfoMessageAsString(List<Map<String,Object>> resultMaps)
Parses the command result map to return a String of info messages.
|
static List<IFileSpec> |
parseGraphCommandResultMapAsFileSpecs(IServer server,
List<Map<String,Object>> resultMaps)
Parses the graph command result map as file specs.
|
static void |
throwRequestExceptionIfErrorMessageFound(Map<String,Object> map)
Throw request exception if error message found.
|
protected static final String CORE_AUTH_FAIL_STRING_1
protected static final String CORE_AUTH_FAIL_STRING_2
protected static final String CORE_AUTH_FAIL_STRING_3
protected static final String CORE_AUTH_FAIL_STRING_4
public static String parseCommandResultMapIfIsInfoMessageAsString(@Nonnull List<Map<String,Object>> resultMaps) throws AccessException, RequestException
resultMaps
- the result mapsAccessException
- the access exceptionRequestException
- the request exceptionpublic static boolean isInfoMessage(Map<String,Object> map)
map
- the mappublic static boolean handleErrorStr(Map<String,Object> map) throws RequestException, AccessException
map
- the mapRequestException
- the request exceptionAccessException
- the access exceptionpublic static String getErrorStr(Map<String,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 boolean isAuthFail(String errStr)
errStr
- the err strpublic static String getInfoStr(Map<String,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 String getErrorOrInfoStr(Map<String,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(Map<String,Object> map) throws RequestException
map
- the mapRequestException
- the request exceptionpublic static boolean handleErrorOrInfoStr(Map<String,Object> map) throws RequestException, AccessException
map
- the mapRequestException
- the request exceptionAccessException
- the access exceptionpublic static String parseCommandResultMapAsString(@Nonnull List<Map<String,Object>> resultMaps) throws AccessException, RequestException
resultMaps
- the result mapsAccessException
- the access exceptionRequestException
- the request exceptionpublic static List<IFileSpec> parseCommandResultMapAsFileSpecs(int id, IServer server, List<Map<String,Object>> resultMaps)
id
- the idserver
- the serverresultMaps
- the result mapspublic static List<IFileSpec> parseGraphCommandResultMapAsFileSpecs(IServer server, List<Map<String,Object>> resultMaps)
server
- the serverresultMaps
- the result mapspublic static String handleFileErrorStr(Map<String,Object> map) throws ConnectionException, AccessException
map
- the mapConnectionException
- the connection exceptionAccessException
- the access exceptionpublic static boolean isExistClientOrLabelOrUser(Map<String,Object> map)
map
- the mappublic static boolean isNonExistClientOrLabelOrUser(Map<String,Object> map)
map
- the mapCopyright © 2017 Perforce Software. All Rights Reserved.