001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/ogcwebservices/wps/execute/ExecuteResponse.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2008 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/exse/
008     lat/lon GmbH
009     http://www.lat-lon.de
010    
011     This library is free software; you can redistribute it and/or
012     modify it under the terms of the GNU Lesser General Public
013     License as published by the Free Software Foundation; either
014     version 2.1 of the License, or (at your option) any later version.
015    
016     This library is distributed in the hope that it will be useful,
017     but WITHOUT ANY WARRANTY; without even the implied warranty of
018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019     Lesser General Public License for more details.
020    
021     You should have received a copy of the GNU Lesser General Public
022     License along with this library; if not, write to the Free Software
023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025     Contact:
026    
027     Andreas Poth
028     lat/lon GmbH
029     Aennchenstraße 19
030     53177 Bonn
031     Germany
032     E-Mail: poth@lat-lon.de
033    
034     Prof. Dr. Klaus Greve
035     Department of Geography
036     University of Bonn
037     Meckenheimer Allee 166
038     53115 Bonn
039     Germany
040     E-Mail: greve@giub.uni-bonn.de
041     
042     ---------------------------------------------------------------------------*/
043    
044    package org.deegree.ogcwebservices.wps.execute;
045    
046    import java.util.ArrayList;
047    import java.util.List;
048    
049    import org.deegree.datatypes.Code;
050    
051    /**
052     * ExecuteResponseType.java
053     * 
054     * Created on 09.03.2006. 23:16:26h
055     * 
056     * 
057     * WPS Execute operation response. By default, this XML document is delivered to
058     * the client in response to an Execute request. If "status" is "false" in the
059     * Execute operation request, this document is normally returned when process
060     * execution has been completed. If "status" in the Execute request is "true",
061     * this response shall be returned as soon as the Execute request has been
062     * accepted for processing. In this case, the same XML document is also made
063     * available as a web-accessible resource from the URL identified in the
064     * statusLocation, and the WPS server shall repopulate it once the process has
065     * completed. It may repopulate it on an ongoing basis while the process is
066     * executing. However, the response to an Execute request will not include this
067     * element in the special case where the output is a single complex value result
068     * and the Execute request indicates that "store" is "false". Instead, the
069     * server shall return the complex result (e.g., GIF image or GML) directly,
070     * without encoding it in the ExecuteResponse. If processing fails in this
071     * special case, the normal ExecuteResponse shall be sent, with the error
072     * condition indicated. This option is provided to simplify the programming
073     * required for simple clients and for service chaining.
074     * 
075     * @author <a href="mailto:christian@kiehle.org">Christian Kiehle</a>
076     * @author <a href="mailto:christian.heier@gmx.de">Christian Heier</a>
077     * @version 1.0.
078     * @since 2.0
079     */
080    public class ExecuteResponse {
081    
082            /**
083             * Identifier of the Process requested to be executed. This Process
084             * identifier shall be as listed in the ProcessOfferings section of the WPS
085             * Capabilities document.
086             */
087            protected Code identifier;
088    
089            /**
090             * Execution status of this process.
091             */
092            protected Status status;
093    
094            /**
095             * Inputs that were provided as part of the execute request. This element
096             * can be omitted as an implementation decision by the WPS server. However,
097             * it is often advisable to have the response include this information, so
098             * the client can confirm that the request was received correctly, and to
099             * provide a source of metadata if the client wishes to store the result for
100             * future reference.
101             */
102            protected ExecuteDataInputs dataInputs;
103    
104            /**
105             * Complete list of Output data types that were requested as part of the
106             * Execute request. This element can be omitted as an implementation
107             * decision by the WPS server. However, it is often advisable to have the
108             * response include this information, so the client can confirm that the
109             * request was received correctly, and to provide a source of metadata if
110             * the client wishes to store the result for future reference.
111             */
112            protected OutputDefinitions outputDefinitions;
113    
114            /**
115             * List of values of the Process output parameters. Normally there would be
116             * at least one output when the process has completed successfully. If the
117             * process has not finished executing, the implementer can choose to include
118             * whatever final results are ready at the time the Execute response is
119             * provided. If the reference locations of outputs are known in advance,
120             * these URLs may be provided before they are populated.
121             */
122            protected ProcessOutputs processOutputs;
123    
124            /**
125             * The URL referencing the location from which the ExecuteResponse can be
126             * retrieved. If "status" is "true" in the Execute request, the
127             * ExecuteResponse should also be found here as soon as the process returns
128             * the initial response to the client. It should persist at this location as
129             * long as the outputs are accessible from the server. The outputs may be
130             * stored for as long as the implementer of the server decides. If the
131             * process takes a long time, this URL can be repopulated on an ongoing
132             * basis in order to keep the client updated on progress. Before the process
133             * has succeeded, the ExecuteResponse contains information about the status
134             * of the process, including whether or not processing has started, and the
135             * percentage completed. It may also optionally contain the inputs and any
136             * ProcessStartedType interim results. When the process has succeeded, the
137             * ExecuteResponse found at this URL shall contain the output values or
138             * references to them.
139             */
140            protected String statusLocation;
141    
142            /**
143             * Version of the WPS interface specification implemented by the server.
144             */
145            protected String version;
146    
147            /**
148             * Convenience variable to simplify execute response handling.
149             */
150            boolean directResponse = false;
151    
152            /**
153             * 
154             * @param dataInputs
155             * @param identifier
156             * @param outputDefinitions
157             * @param processOutputs
158             * @param status
159             * @param statusLocation
160             * @param version
161             * @param directResponse
162             */
163            public ExecuteResponse( ExecuteDataInputs dataInputs, Code identifier,
164                            OutputDefinitions outputDefinitions, ProcessOutputs processOutputs, Status status,
165                            String statusLocation, String version, boolean directResponse ) {
166                    this.dataInputs = dataInputs;
167                    this.identifier = identifier;
168                    this.outputDefinitions = outputDefinitions;
169                    this.processOutputs = processOutputs;
170                    this.status = status;
171                    this.statusLocation = statusLocation;
172                    this.version = version;
173                    this.directResponse = directResponse;
174            }
175    
176            public ExecuteResponse() {
177    
178            }
179    
180            /**
181             * @return Returns the identifier.
182             */
183            public Code getIdentifier() {
184                    return identifier;
185            }
186    
187            /**
188             * @return Returns the status.
189             */
190            public Status getStatus() {
191                    return status;
192            }
193    
194            /**
195             * @return Returns the dataInputs.
196             */
197            public ExecuteDataInputs getDataInputs() {
198                    return dataInputs;
199            }
200    
201            /**
202             * @return Returns the outputDefinitions.
203             */
204            public OutputDefinitions getOutputDefinitions() {
205                    return outputDefinitions;
206            }
207    
208            /**
209             * @return Returns the processOutputs.
210             */
211            public ProcessOutputs getProcessOutputs() {
212                    return processOutputs;
213            }
214    
215            /**
216             * @return Returns the statusLocation.
217             */
218            public String getStatusLocation() {
219                    return statusLocation;
220            }
221    
222            /**
223             * @return Returns the version.
224             */
225            public String getVersion() {
226                    return version;
227            }
228    
229            /**
230             * @return Returns the directResponse.
231             */
232            public boolean isDirectResponse() {
233                    return directResponse;
234            }
235    
236            /**
237             * 
238             * @param dataInputs
239             */
240            public void setDataInputs( ExecuteDataInputs dataInputs ) {
241                    this.dataInputs = dataInputs;
242            }
243    
244            /**
245             * 
246             * @param directResponse
247             */
248            public void setDirectResponse( boolean directResponse ) {
249                    this.directResponse = directResponse;
250            }
251    
252            public void setIdentifier( Code identifier ) {
253                    this.identifier = identifier;
254            }
255    
256            public void setOutputDefinitions( OutputDefinitions outputDefinitions ) {
257                    this.outputDefinitions = outputDefinitions;
258            }
259    
260            public void setProcessOutputs( ProcessOutputs processOutputs ) {
261                    this.processOutputs = processOutputs;
262            }
263    
264            public void setStatus( Status status ) {
265                    this.status = status;
266            }
267    
268            public void setStatusLocation( String statusLocation ) {
269                    this.statusLocation = statusLocation;
270            }
271    
272            public void setVersion( String version ) {
273                    this.version = version;
274            }
275        
276            public static class ProcessOutputs {
277    
278                    private List<IOValue> outputs;
279    
280                    /**
281                     * @return Returns the output.
282                     */
283                    public List<IOValue> getOutputs() {
284                            if ( outputs == null ) {
285                                    outputs = new ArrayList<IOValue>();
286                            }
287                            return this.outputs;
288                    }
289    
290                    /**
291                     * 
292                     * @param outputs
293                     */
294                    public void setOutputs( List<IOValue> outputs ) {
295                            this.outputs = outputs;
296                    }
297    
298            }
299    
300    }