Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
0
 /**
  * Returns the web-accessible URL for retrieving the execute response.
  *
  * <p>For asynchronous operation, this URL may provide access to a dynamic document that's
  * changing until the process is finished.
  *
  * @return web-accessible URL, or <code>null</code> if the execution has not been started yet or
  *     no status location is available
  */
 public URL getStatusLocation() {
   if (lastResponse == null) {
     return null;
   }
   return lastResponse.getStatusLocation();
 }