/** * Rerun bundle job * * @param request servlet request * @param response servlet response * @param conf configration object * @throws XServletException */ private void rerunBundleJob( HttpServletRequest request, HttpServletResponse response, Configuration conf) throws XServletException { JSONObject json = new JSONObject(); BundleEngine bundleEngine = Services.get() .get(BundleEngineService.class) .getBundleEngine(getUser(request), getAuthToken(request)); String jobId = getResourceName(request); String coordScope = request.getParameter(RestConstants.JOB_BUNDLE_RERUN_COORD_SCOPE_PARAM); String dateScope = request.getParameter(RestConstants.JOB_BUNDLE_RERUN_DATE_SCOPE_PARAM); String refresh = request.getParameter(RestConstants.JOB_COORD_RERUN_REFRESH_PARAM); String noCleanup = request.getParameter(RestConstants.JOB_COORD_RERUN_NOCLEANUP_PARAM); XLog.getLog(getClass()) .info( "Rerun Bundle for jobId=" + jobId + ", coordScope=" + coordScope + ", dateScope=" + dateScope + ", refresh=" + refresh + ", noCleanup=" + noCleanup); try { bundleEngine.reRun( jobId, coordScope, dateScope, Boolean.valueOf(refresh), Boolean.valueOf(noCleanup)); } catch (BaseEngineException ex) { throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex); } }
/** * Rerun coordinator actions * * @param request servlet request * @param response servlet response * @param conf configuration object * @throws XServletException */ @SuppressWarnings("unchecked") private JSONObject reRunCoordinatorActions( HttpServletRequest request, HttpServletResponse response, Configuration conf) throws XServletException { JSONObject json = new JSONObject(); CoordinatorEngine coordEngine = Services.get() .get(CoordinatorEngineService.class) .getCoordinatorEngine(getUser(request), getAuthToken(request)); String jobId = getResourceName(request); String rerunType = request.getParameter(RestConstants.JOB_COORD_RERUN_TYPE_PARAM); String scope = request.getParameter(RestConstants.JOB_COORD_RERUN_SCOPE_PARAM); String refresh = request.getParameter(RestConstants.JOB_COORD_RERUN_REFRESH_PARAM); String noCleanup = request.getParameter(RestConstants.JOB_COORD_RERUN_NOCLEANUP_PARAM); XLog.getLog(getClass()) .info( "Rerun coordinator for jobId=" + jobId + ", rerunType=" + rerunType + ",scope=" + scope + ",refresh=" + refresh + ", noCleanup=" + noCleanup); try { if (!(rerunType.equals(RestConstants.JOB_COORD_RERUN_DATE) || rerunType.equals(RestConstants.JOB_COORD_RERUN_ACTION))) { throw new CommandException(ErrorCode.E1018, "date or action expected."); } CoordinatorActionInfo coordInfo = coordEngine.reRun( jobId, rerunType, scope, Boolean.valueOf(refresh), Boolean.valueOf(noCleanup)); List<CoordinatorActionBean> coordActions; if (coordInfo != null) { coordActions = coordInfo.getCoordActions(); } else { coordActions = CoordRerunXCommand.getCoordActions(rerunType, jobId, scope); } json.put( JsonTags.COORDINATOR_ACTIONS, CoordinatorActionBean.toJSONArray(coordActions, "GMT")); } catch (BaseEngineException ex) { throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex); } catch (CommandException ex) { throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex); } return json; }