private JobActionResult processAction(Application app, JobExecutionRequestEntity request, JobAction jobAction) throws Exception { ActionType actionType = jobAction.getActionType(); if (actionType.isOsCommand()) { return processOsCommand(app, request, jobAction); } else { String msg = String.format("The action type \"%s\" is not supported.", actionType); throw new UnsupportedOperationException(msg); } }
private JobActionResult processAction(Application app, JobExecutionRequestEntity request, JobAction action) throws Exception { log.info(String.format("Executing action %s for request %s", action.getLabel(), request.getJobExecutionRequestId())); ActionType actionType = action.getActionType(); JobActionExecutor executor = executors.get(actionType); if (executor == null) { String msg = String.format("The action type \"%s\" is not supported.", actionType); throw new UnsupportedOperationException(msg); } JobActionResult result; ZonedDateTime startedAt = ZonedDateTime.now(); try { result = executor.execute(request, action, startedAt); } catch (Exception ex) { log.error("Unhandled exception while processing action", ex); result = JobActionResult.fail(action.getLabel(), startedAt, ex, null, null); } request.addResult(result); jobExecutionRequestStore.update(request); return result; } }
private JobActionResult processAction(Application app, JobExecutionRequestEntity request, JobAction action) throws Exception { log.info(String.format("Executing action %s for request %s", action.getLabel(), request.getJobExecutionRequestId())); ActionType actionType = action.getActionType(); JobActionExecutor executor = executors.get(actionType); if (executor == null) { String msg = String.format("The action type \"%s\" is not supported.", actionType); throw new UnsupportedOperationException(msg); } JobActionResult result; ZonedDateTime startedAt = ZonedDateTime.now(); try { result = executor.execute(request, action, startedAt); } catch (Exception ex) { log.error("Unhandled exception while processing action", ex); result = JobActionResult.fail(action.getLabel(), startedAt, ex, null, null); } request.addResult(result); jobExecutionRequestStore.update(request); return result; } }