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