public static Result getFunctionResult(ResultCollector<?, ?> rc, String commandName) { Result result; List<Object> results = (List<Object>) rc.getResult(); if (results != null) { Object resultObj = results.get(0); if (resultObj instanceof String) { result = ResultBuilder.createInfoResult((String) resultObj); } else if (resultObj instanceof Exception) { result = ResultBuilder.createGemFireErrorResult(((Exception) resultObj).getMessage()); } else { result = ResultBuilder.createGemFireErrorResult( CliStrings.format(CliStrings.COMMAND_FAILURE_MESSAGE, commandName)); } } else { result = ResultBuilder.createGemFireErrorResult( CliStrings.format(CliStrings.COMMAND_FAILURE_MESSAGE, commandName)); } return result; }
@Override public CommandResult postExecution(GfshParseResult parseResult, CommandResult commandResult, Path tempFile) { // in the command over http case, the command result is in the downloaded temp file if (tempFile != null) { Path dirPath; String dirName = parseResult.getParamValueAsString("dir"); if (StringUtils.isBlank(dirName)) { dirPath = Paths.get(System.getProperty("user.dir")).toAbsolutePath(); } else { dirPath = Paths.get(dirName).toAbsolutePath(); } String fileName = "exportedLogs_" + System.currentTimeMillis() + ".zip"; File exportedLogFile = dirPath.resolve(fileName).toFile(); try { FileUtils.copyFile(tempFile.toFile(), exportedLogFile); FileUtils.deleteQuietly(tempFile.toFile()); commandResult = (CommandResult) ResultBuilder .createInfoResult("Logs exported to: " + exportedLogFile.getAbsolutePath()); } catch (IOException e) { logger.error(e.getMessage(), e); commandResult = ResultBuilder.createGemFireErrorResult(e.getMessage()); } } else if (commandResult.getStatus() == Result.Status.OK) { commandResult = (CommandResult) ResultBuilder.createInfoResult( "Logs exported to the connected member's file system: " + commandResult.nextLine()); } return commandResult; } }
result = ResultBuilder.createGemFireErrorResult(CliStrings .format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.LIST_REGION)); } catch (Exception e) { result = ResultBuilder .createGemFireErrorResult(CliStrings.LIST_REGION__MSG__ERROR + " : " + e.getMessage());
return ResultBuilder.createGemFireErrorResult( CliStrings.format(CliStrings.LIST_CLIENT_COULD_NOT_RETRIEVE_SERVER_LIST)); return ResultBuilder.createGemFireErrorResult( CliStrings.format(CliStrings.LIST_COULD_NOT_RETRIEVE_CLIENT_LIST));
.createGemFireErrorResult(CliStrings.format(CliStrings.PDX_RENAME__EMPTY)); return ResultBuilder.createGemFireErrorResult( CliStrings.format(CliStrings.PDX_RENAME__ERROR, e.getMessage()));
.getAttribute(managerObjectName.toString(), "StatusMessage"); return (StringUtils.isNotBlank(pulseMessage) ? ResultBuilder.createGemFireErrorResult(pulseMessage) : ResultBuilder.createGemFireErrorResult(CliStrings.START_PULSE__URL__NOTFOUND));
return ResultBuilder.createGemFireErrorResult( "No members were found matching the given member IDs or groups.");
CliStrings.NETSTAT__MSG__ERROR_OCCURRED_WHILE_EXECUTING_NETSTAT_ON_0, new Object[] {Arrays.toString(members)}), e); result = ResultBuilder.createGemFireErrorResult( CliStrings.format(CliStrings.NETSTAT__MSG__ERROR_OCCURRED_WHILE_EXECUTING_NETSTAT_ON_0, new Object[] {Arrays.toString(members)}));
} catch (Throwable th) { SystemFailure.checkFailure(); return ResultBuilder.createGemFireErrorResult("Exception while attempting to list deployed: " + th.getClass().getName() + ": " + th.getMessage());
result = ResultBuilder.createGemFireErrorResult(e.getMessage());
checkForJDBCMapping(regionPath); } catch (IllegalStateException e) { return ResultBuilder.createGemFireErrorResult(e.getMessage());
} catch (Throwable th) { SystemFailure.checkFailure(); return ResultBuilder.createGemFireErrorResult("Exception while attempting to un-deploy: " + th.getClass().getName() + ": " + th.getMessage());
commandResult = ResultBuilder.createGemFireErrorResult(e.getMessage()); .createGemFireErrorResult("Unable to build commandResult using the remote response.");
} catch (Throwable th) { SystemFailure.checkFailure(); return ResultBuilder.createGemFireErrorResult( "Exception while attempting to list functions: " + th.getMessage());
result = ResultBuilder.createGemFireErrorResult(e.getMessage());