@Override
 protected void fullRefresh() {
   try {
     HPCCFileSprayClient fileSprayClient = platform.getFileSprayClient();
     GetDFUWorkunitResponse response = fileSprayClient.getDFUWorkunit(info.getID());
     if (response.getResult() == null) { // Call succeeded, but no response...
       for (EspException e : response.getExceptions().getException()) {
         if (e.getCode().equals("20082")) { // No longer exists...
           info.setState(999);
           setChanged();
           notifyObservers(Notification.LOGICALFILEWORKUNIT);
           break;
         }
       }
     } else {
       update(response.getResult());
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Пример #2
0
  private boolean handleSprayResponse(ProgressResponse sprayResponse) throws Exception {
    boolean success = false;

    org.hpccsystems.ws.client.gen.filespray.v1_13.ArrayOfEspException exceptions =
        sprayResponse.getExceptions();
    if (exceptions != null) {
      for (EspException espexception : exceptions.getException()) {
        Utils.println(
            System.out,
            "Error spraying file: " + espexception.getSource() + espexception.getMessage(),
            false,
            verbosemode);
      }
    } else {
      HPCCFileSprayClient fileSprayClient = getFileSprayClient();

      if (fileSprayClient == null)
        throw new Exception("Could not initialize HPCC FileSpray Client");

      ProgressRequest dfuprogressparams = new ProgressRequest();
      dfuprogressparams.setWuid(sprayResponse.getWuid());
      Utils.println(System.out, "Spray file DWUID: " + sprayResponse.getWuid(), true, verbosemode);
      ProgressResponse progressResponse =
          fileSprayClient.fileSprayServiceSoapProxy.getDFUProgress(dfuprogressparams);

      if (progressResponse.getExceptions() != null) {
        Utils.println(System.out, "Spray progress status fetch failed.", false, verbosemode);
      } else {
        String state = progressResponse.getState();
        Utils.println(System.out, progressResponse.getState(), true, verbosemode);
        if (!state.equalsIgnoreCase("FAILED")) {
          // this should be in a dedicated thread.
          for (int i = 0;
              i < 10
                  && progressResponse.getPercentDone() < 100
                  && !progressResponse.getState().equalsIgnoreCase("FAILED");
              i++) {
            Utils.println(System.out, progressResponse.getProgressMessage(), true, verbosemode);
            progressResponse =
                fileSprayClient.fileSprayServiceSoapProxy.getDFUProgress(dfuprogressparams);

            try {
              Thread.sleep(100);
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
          }
          Utils.println(System.out, progressResponse.getProgressMessage(), true, verbosemode);
          success = true;
        } else {
          Utils.println(System.out, "Spray failed.", false, verbosemode);
        }
        Utils.println(
            System.out,
            "Final summary from server: " + progressResponse.getSummaryMessage(),
            true,
            verbosemode);

        Utils.println(
            System.out,
            "Spray attempt completed, verify DWUID: " + sprayResponse.getWuid(),
            false,
            verbosemode);
      }
    }
    return success;
  }