org.deegree.protocol.wps.client.process
Class ProcessExecution

java.lang.Object
  extended by org.deegree.protocol.wps.client.process.ProcessExecution

public class ProcessExecution
extends Object

Represents an execution context for a Process that uses the ResponseDocument output mode.

NOTE: This class is not thread-safe.

Version:
$Revision: 31699 $, $Date: 2011-08-31 13:29:54 +0200 (Wed, 31 Aug 2011) $
Author:
Andrei Ionita, Markus Schneider, last edited by: $Author: mschneider $
See Also:
Process, RawProcessExecution

Field Summary
protected  WPSClient client
          Associated WPS client instance.
protected  List<ExecutionInput> inputs
          List of inputs, may be empty, but never null
protected  Process process
          Associated process instance.
 
Method Summary
 void addBBoxInput(String id, String idCodeSpace, double[] lower, double[] upper, String crs)
          Adds a bounding box input parameter.
 void addBinaryInput(String id, String idCodeSpace, InputStream inputStream, String mimeType, String encoding)
          Adds a binary-valued complex input parameter.
 void addBinaryInput(String id, String idCodeSpace, URL url, boolean byRef, String mimeType, String encoding)
          Adds a binary-valued complex input parameter.
 void addLiteralInput(String id, String idCodeSpace, String value, String type, String uom)
          Adds a literal input parameter.
 void addOutput(String id, String idCodeSpace, String uom, boolean asRef, String mimeType, String encoding, String schema)
          Adds the specified parameter to the list of explicitly requested output parameters.
 void addXMLInput(String id, String idCodeSpace, URL url, boolean byRef, String mimeType, String encoding, String schema)
          Adds an XML-valued complex input parameter.
 void addXMLInput(String id, String idCodeSpace, XMLStreamReader reader, String mimeType, String encoding, String schema)
          Adds an XML-valued complex input parameter.
 ExecutionOutputs execute()
          Executes the process and returns the outputs.
 void executeAsync()
          Executes the process asynchronously.
 String getCreationTime()
          Returns the creation time for the process execution as reported by the server.
 OWSExceptionReport getExceptionReport()
          Returns the exception report.
 ExecutionOutputs getOutputs()
          Returns the outputs of the process execution.
 Integer getPercentCompleted()
          Returns the percentage of the process that has been completed.
 WPSConstants.ExecutionState getState()
          Returns the current state of the execution.
 URL getStatusLocation()
          Returns the web-accessible URL for retrieving the execute response.
 String getStatusMessage()
          Returns the status message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

client

protected final WPSClient client
Associated WPS client instance.


process

protected final Process process
Associated process instance.


inputs

protected final List<ExecutionInput> inputs
List of inputs, may be empty, but never null

Method Detail

addOutput

public void addOutput(String id,
                      String idCodeSpace,
                      String uom,
                      boolean asRef,
                      String mimeType,
                      String encoding,
                      String schema)
Adds the specified parameter to the list of explicitly requested output parameters.

Calling this method sets the ResponseForm to ResponseDocument.

Parameters:
id - identifier of the output parameter, must not be null
idCodeSpace - codespace of the parameter identifier, may be null (for identifiers without codespace)
uom - requested unit of measure, may be null (indicates that the default mime type from the parameter description applies). This parameter only applies for literal outputs.
asRef - if true, the output should be returned by the process as a reference, otherwise it will be embedded in the response document
mimeType - requested mime type, may be null (indicates that the default mime type from the parameter description applies)
encoding - requested encoding, may be null (indicates that the default encoding from the parameter description applies)
schema - requested schema, may be null (indicates that the default schema from the parameter description applies)

execute

public ExecutionOutputs execute()
                         throws OWSExceptionReport,
                                IOException,
                                XMLStreamException
Executes the process and returns the outputs.

Returns:
process outputs, never null
Throws:
IOException - if a communication/network problem occured
OWSException - if the server replied with an exception
XMLStreamException
OWSExceptionReport

executeAsync

public void executeAsync()
                  throws OWSExceptionReport,
                         IOException,
                         XMLStreamException
Executes the process asynchronously.

This method issues the Execute request against the server and returns immediately.

Throws:
IOException - if a communication/network problem occured
OWSException - if the server replied with an exception
XMLStreamException
OWSExceptionReport

getOutputs

public ExecutionOutputs getOutputs()
                            throws OWSExceptionReport
Returns the outputs of the process execution.

Returns:
the outputs of the process execution, or null if the current state is not WPSConstants.ExecutionState.SUCCEEDED
Throws:
OWSExceptionReport - if the server replied with an exception

getState

public WPSConstants.ExecutionState getState()
                                     throws OWSExceptionReport,
                                            IOException,
                                            XMLStreamException
Returns the current state of the execution.

Returns:
state of the execution, or null if the execution has not been started yet
Throws:
OWSExceptionReport - if the server replied with an exception
IOException - if a communication/network problem occured
XMLStreamException

getStatusMessage

public String getStatusMessage()
Returns the status message.

Returns:
status message, or null if the execution has not been started yet or no status message available

getStatusLocation

public URL getStatusLocation()
Returns the web-accessible URL for retrieving the execute response.

For asynchronous operation, this URL may provide access to a dynamic document that's changing until the process is finished.

Returns:
web-accessible URL, or null if the execution has not been started yet or no status location is available

getPercentCompleted

public Integer getPercentCompleted()
Returns the percentage of the process that has been completed.

Returns:
the completed percentage of the process, or null if the execution has not been started yet or no completion percentage provided by the process

getCreationTime

public String getCreationTime()
Returns the creation time for the process execution as reported by the server.

Returns:
creation time, or null if the execution has not been started yet

getExceptionReport

public OWSExceptionReport getExceptionReport()
Returns the exception report.

NOTE: An exception report is only available if state is WPSConstants.ExecutionState.FAILED.

Returns:
an exception report in case the execution failed, null otherwise

addLiteralInput

public void addLiteralInput(String id,
                            String idCodeSpace,
                            String value,
                            String type,
                            String uom)
Adds a literal input parameter.

Parameters:
id - identifier of the input parameter, must not be null
idCodeSpace - codespace of the parameter identifier, may be null (for identifiers without codespace)
value - value of the literal input, must not be null
type - data type in which the value should be considered, may be null (this means it matches the data type as defined by the process description)
uom - unit of measure of the value, may be null (this means it matches the data type as defined by the process description)

addBBoxInput

public void addBBoxInput(String id,
                         String idCodeSpace,
                         double[] lower,
                         double[] upper,
                         String crs)
Adds a bounding box input parameter.

Parameters:
id - identifier of the input parameter, must not be null
idCodeSpace - codespace of the parameter identifier, may be null (for identifiers without codespace)
lower - coordinates of the lower point, must not be null
upper - coordinates of the upper point, must not be null and length must match lower point
crs - coordinate system, may be null (indicates that the default crs from the parameter description applies)

addXMLInput

public void addXMLInput(String id,
                        String idCodeSpace,
                        URL url,
                        boolean byRef,
                        String mimeType,
                        String encoding,
                        String schema)
Adds an XML-valued complex input parameter.

Parameters:
id - identifier of the input parameter, must not be null
idCodeSpace - codespace of the parameter identifier, may be null (for identifiers without codespace)
url - URL reference to the xml resource, must not be null
byRef - if true, the parameter will be passed by reference to the server, otherwise it will be nested in the Execute request. If true, the url needs to be web-accessible (e.g. not a file URL)
mimeType - mime type, may be null (indicates that the default mime type from the parameter description applies)
encoding - encoding, may be null (indicates that the default encoding from the parameter description applies)
schema - schema, may be null (indicates that the default schema from the parameter description applies)

addXMLInput

public void addXMLInput(String id,
                        String idCodeSpace,
                        XMLStreamReader reader,
                        String mimeType,
                        String encoding,
                        String schema)
Adds an XML-valued complex input parameter.

Parameters:
id - identifier of the input parameter, must not be null
idCodeSpace - codespace of the parameter identifier, may be null (for identifiers without codespace)
reader - XMLStreamReader to the xml data, must not be null and point to the START_ELEMENT event
mimeType - mime type, may be null (indicates that the default mime type from the parameter description applies)
encoding - encoding, may be null (indicates that the default encoding from the parameter description applies)
schema - schema, may be null (indicates that the default schema from the parameter description applies)

addBinaryInput

public void addBinaryInput(String id,
                           String idCodeSpace,
                           URL url,
                           boolean byRef,
                           String mimeType,
                           String encoding)
Adds a binary-valued complex input parameter.

Parameters:
id - identifier of the input parameter, must not be null
idCodeSpace - codespace of the parameter identifier, may be null (for identifiers without codespace)
url - URL reference to the binary resource, must not be null (and must not be web-accessible)
byRef - if true, the parameter will be passed by reference to the server, otherwise it will be nested in the Execute request. If true, the url needs to be web-accessible (e.g. not a file URL)
mimeType - mime type, may be null (indicates that the default mime type from the parameter description applies)
encoding - encoding, may be null (indicates that the default encoding from the parameter description applies)

addBinaryInput

public void addBinaryInput(String id,
                           String idCodeSpace,
                           InputStream inputStream,
                           String mimeType,
                           String encoding)
Adds a binary-valued complex input parameter.

Parameters:
id - identifier of the input parameter, must not be null
idCodeSpace - codespace of the parameter identifier, may be null (for identifiers without codespace)
inputStream - input stream to the binary data, must not be null
mimeType - mime type, may be null (indicates that the default mime type from the parameter description applies)
encoding - encoding, may be null (indicates that the default encoding from the parameter description applies)


Copyright © 2011. All Rights Reserved.