Пример #1
0
  /**
   * 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);
    }
  }
Пример #2
0
 /**
  * Stream bundle job log
  *
  * @param request servlet request
  * @param response servlet response
  * @throws XServletException
  */
 private void streamBundleJob(HttpServletRequest request, HttpServletResponse response)
     throws XServletException, IOException {
   BundleEngine bundleEngine =
       Services.get()
           .get(BundleEngineService.class)
           .getBundleEngine(getUser(request), getAuthToken(request));
   String jobId = getResourceName(request);
   try {
     bundleEngine.streamLog(jobId, response.getWriter());
   } catch (BundleEngineException ex) {
     throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
   }
 }
Пример #3
0
 /**
  * Change a bundle job
  *
  * @param request servlet request
  * @param response servlet response
  * @throws XServletException
  */
 private void changeBundleJob(HttpServletRequest request, HttpServletResponse response)
     throws XServletException {
   BundleEngine bundleEngine =
       Services.get()
           .get(BundleEngineService.class)
           .getBundleEngine(getUser(request), getAuthToken(request));
   String jobId = getResourceName(request);
   String changeValue = request.getParameter(RestConstants.JOB_CHANGE_VALUE);
   try {
     bundleEngine.change(jobId, changeValue);
   } catch (BundleEngineException ex) {
     throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
   }
 }
Пример #4
0
 /**
  * Get bundle job definition
  *
  * @param request servlet request
  * @param response servlet response
  * @return String bundle definition
  * @throws XServletException
  */
 private String getBundleJobDefinition(HttpServletRequest request, HttpServletResponse response)
     throws XServletException {
   BundleEngine bundleEngine =
       Services.get()
           .get(BundleEngineService.class)
           .getBundleEngine(getUser(request), getAuthToken(request));
   String bundleDefinition;
   String jobId = getResourceName(request);
   try {
     bundleDefinition = bundleEngine.getDefinition(jobId);
   } catch (BundleEngineException ex) {
     throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
   }
   return bundleDefinition;
 }
Пример #5
0
  /**
   * Get bundle job info
   *
   * @param request servlet request
   * @param response servlet response
   * @return JsonBean bundle job bean
   * @throws XServletException
   * @throws BaseEngineException
   */
  private JsonBean getBundleJob(HttpServletRequest request, HttpServletResponse response)
      throws XServletException, BaseEngineException {
    JsonBean jobBean = null;
    BundleEngine bundleEngine =
        Services.get()
            .get(BundleEngineService.class)
            .getBundleEngine(getUser(request), getAuthToken(request));
    String jobId = getResourceName(request);

    try {
      jobBean = (JsonBean) bundleEngine.getBundleJob(jobId);

      return jobBean;
    } catch (BundleEngineException ex) {
      throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
    }
  }