Beispiel #1
0
  /**
   * Executes the process and returns the outputs.
   *
   * @return process outputs, never <code>null</code>
   * @throws IOException if a communication/network problem occured
   * @throws OWSException if the server replied with an exception
   * @throws XMLStreamException
   */
  public ExecutionOutputs execute() throws OWSExceptionReport, IOException, XMLStreamException {

    lastResponse = sendExecute(false);
    OWSExceptionReport report = lastResponse.getStatus().getExceptionReport();
    if (report != null) {
      throw report;
    }
    return lastResponse.getOutputs();
  }
Beispiel #2
0
 /**
  * Returns the outputs of the process execution.
  *
  * @return the outputs of the process execution, or <code>null</code> if the current state is not
  *     {@link ExecutionState#SUCCEEDED}
  * @throws OWSExceptionReport if the server replied with an exception
  */
 public ExecutionOutputs getOutputs() throws OWSExceptionReport {
   if (lastResponse == null) {
     return null;
   }
   OWSExceptionReport report = lastResponse.getStatus().getExceptionReport();
   if (report != null) {
     throw report;
   }
   return lastResponse.getOutputs();
 }
Beispiel #3
0
 /**
  * Returns the current state of the execution.
  *
  * @return state of the execution, or <code>null</code> if the execution has not been started yet
  * @throws OWSExceptionReport if the server replied with an exception
  * @throws IOException if a communication/network problem occured
  * @throws XMLStreamException
  */
 public ExecutionState getState() throws OWSExceptionReport, IOException, XMLStreamException {
   if (lastResponse == null) {
     return null;
   }
   if (lastResponse.getStatus().getState() != ExecutionState.SUCCEEDED
       && lastResponse.getStatus().getState() != ExecutionState.FAILED) {
     URL statusLocation = lastResponse.getStatusLocation();
     if (statusLocation == null) {
       throw new RuntimeException("Cannot update status. No statusLocation provided.");
     }
     LOG.debug("Polling response document from status location: " + statusLocation);
     XMLInputFactory inFactory = XMLInputFactory.newInstance();
     InputStream is = statusLocation.openStream();
     XMLStreamReader xmlReader = inFactory.createXMLStreamReader(is);
     XMLStreamUtils.nextElement(xmlReader);
     if (OWSExceptionReader.isExceptionReport(xmlReader.getName())) {
       throw OWSExceptionReader.parseExceptionReport(xmlReader);
     }
     ExecuteResponse100Reader reader = new ExecuteResponse100Reader(xmlReader);
     lastResponse = reader.parse100();
   }
   return lastResponse.getStatus().getState();
 }
Beispiel #4
0
 /**
  * Returns the exception report.
  *
  * <p>NOTE: An exception report is only available if state is {@link ExecutionState#FAILED}.
  *
  * @return an exception report in case the execution failed, <code>null</code> otherwise
  */
 public OWSExceptionReport getExceptionReport() {
   if (lastResponse == null) {
     return null;
   }
   return lastResponse.getStatus().getExceptionReport();
 }
Beispiel #5
0
 /**
  * Returns the creation time for the process execution as reported by the server.
  *
  * @return creation time, or <code>null</code> if the execution has not been started yet
  */
 public String getCreationTime() {
   if (lastResponse == null) {
     return null;
   }
   return lastResponse.getStatus().getCreationTime();
 }
Beispiel #6
0
 /**
  * Returns the percentage of the process that has been completed.
  *
  * @return the completed percentage of the process, or <code>null</code> if the execution has not
  *     been started yet or no completion percentage provided by the process
  */
 public Integer getPercentCompleted() {
   if (lastResponse == null) {
     return null;
   }
   return lastResponse.getStatus().getPercentCompleted();
 }
Beispiel #7
0
 /**
  * Returns the status message.
  *
  * @return status message, or <code>null</code> if the execution has not been started yet or no
  *     status message available
  */
 public String getStatusMessage() {
   if (lastResponse == null) {
     return null;
   }
   return lastResponse.getStatus().getStatusMessage();
 }