001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/ogcwebservices/wps/capabilities/WPSGetCapabilities.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/deegree/
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: Aennchenstr. 19
030: 53115 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.capabilities;
045:
046: import java.util.Map;
047:
048: import org.deegree.framework.util.KVP2Map;
049: import org.deegree.ogcwebservices.InvalidParameterValueException;
050: import org.deegree.ogcwebservices.MissingParameterValueException;
051: import org.deegree.ogcwebservices.OGCWebServiceException;
052: import org.deegree.ogcwebservices.OperationNotSupportedException;
053: import org.deegree.ogcwebservices.getcapabilities.GetCapabilities;
054: import org.w3c.dom.Element;
055:
056: /**
057: * WPSGetCapabilitiesRequest.java
058: *
059: *
060: * Created on 08.03.2006. 22:15:18h
061: *
062: * @author <a href="mailto:christian@kiehle.org">Christian Kiehle</a>
063: * @author <a href="mailto:christian.heier@gmx.de">Christian Heier</a>
064: * @author last edited by: $Author:wanhoff$
065: *
066: * @version $Revision: 10197 $, $Date:20.03.2007$
067: */
068: public class WPSGetCapabilities extends GetCapabilities {
069:
070: /**
071: *
072: */
073: private static final long serialVersionUID = -3610123737583333339L;
074:
075: /**
076: *
077: * @param id
078: * @param version
079: * @param updateSequence
080: * @param acceptVersions
081: * @param sections
082: * @param acceptFormats
083: * @param vendoreSpec
084: */
085: protected WPSGetCapabilities(String id, String version,
086: String updateSequence, String[] acceptVersions,
087: String[] sections, String[] acceptFormats,
088: Map<String, String> vendoreSpec) {
089: super (id, version, updateSequence, acceptVersions, sections,
090: acceptFormats, vendoreSpec);
091: }
092:
093: /**
094: * creates a <tt>WFSGetCapabilitiesRequest</tt> object.
095: *
096: * @param id
097: * id of the request
098: * @param version
099: * @param updateSequence
100: * @param acceptVersions
101: * @param sections
102: * @param acceptFormats
103: * @param vendoreSpec
104: * @param vendorSpecificParameter
105: * none standadized parameters as name-value pairs
106: * @param native_
107: * is intended to allow access to vendor specific capabilities
108: * @return
109: */
110: public static WPSGetCapabilities create(String id, String version,
111: String updateSequence, String[] acceptVersions,
112: String[] sections, String[] acceptFormats,
113: Map<String, String> vendoreSpec) {
114: return new WPSGetCapabilities(id, version, updateSequence,
115: acceptVersions, sections, acceptFormats, vendoreSpec);
116: }
117:
118: /**
119: * creates a WPS GetCapabilities request class representation from a key-value-pair encoded
120: * request
121: *
122: * @param id
123: * @param request
124: * @return
125: */
126: @SuppressWarnings("unchecked")
127: public static WPSGetCapabilities create(String id, String request)
128: throws InvalidParameterValueException,
129: MissingParameterValueException {
130: Map map = KVP2Map.toMap(request);
131: map.put("ID", id);
132: return create(map);
133: }
134:
135: /**
136: * creates a WPS GetCapabilities request class representation form a key-value-pair encoded
137: * request
138: *
139: * @param request
140: * @return
141: * @throws InvalidParameterValueException
142: * @throws MissingParameterValueException
143: */
144: public static WPSGetCapabilities create(Map<String, String> request)
145: throws InvalidParameterValueException,
146: MissingParameterValueException {
147:
148: String id = request.remove("ID");
149: String service = request.remove("SERVICE");
150: if (null == service) {
151: throw new MissingParameterValueException(
152: "WPSGetCapabilities",
153: "'service' parameter is missing");
154: }
155: if (!"WPS".equals(service)) {
156: throw new InvalidParameterValueException(
157: "WPSGetCapabilities",
158: "service attribute must equal 'WPS'");
159: }
160: String updateSeq = request.remove("UPDATESEQUENCE");
161: String version = request.remove("VERSION");
162:
163: // accept versions, sections, accept formats not supported
164: return new WPSGetCapabilities(id, version, updateSeq, null,
165: null, null, request);
166: }
167:
168: /**
169: * XML-coded get capabilities request not supported.
170: *
171: * @see "OGC 05-007r4 Subclause 8.2"
172: *
173: * @param id
174: * @param element
175: * @return
176: * @throws OGCWebServiceException
177: * @throws MissingParameterValueException
178: * @throws InvalidParameterValueException
179: */
180: public static WPSGetCapabilities create(String id, Element element)
181: throws OGCWebServiceException {
182: throw new OperationNotSupportedException(
183: "HTTP post transfer of XML encoded get capabilities request not supported.");
184:
185: }
186:
187: /*
188: * (non-Javadoc)
189: *
190: * @see org.deegree.ogcwebservices.OGCWebServiceRequest#getServiceName()
191: */
192: public String getServiceName() {
193: return "WPS";
194: }
195:
196: }
|