001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/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: 9345 $, $Date:20.03.2007$
067 */
068 public class WPSGetCapabilities extends GetCapabilities {
069
070 /**
071 *
072 * @param id
073 * @param version
074 * @param updateSequence
075 * @param acceptVersions
076 * @param sections
077 * @param acceptFormats
078 * @param vendoreSpec
079 */
080 protected WPSGetCapabilities( String id, String version, String updateSequence,
081 String[] acceptVersions, String[] sections,
082 String[] acceptFormats, Map<String, String> vendoreSpec ) {
083 super( id, version, updateSequence, acceptVersions, sections, acceptFormats, vendoreSpec );
084 }
085
086 /**
087 * creates a <tt>WFSGetCapabilitiesRequest</tt> object.
088 *
089 * @param id
090 * id of the request
091 * @param version
092 * @param updateSequence
093 * @param acceptVersions
094 * @param sections
095 * @param acceptFormats
096 * @param vendoreSpec
097 * @param vendorSpecificParameter
098 * none standadized parameters as name-value pairs
099 * @param native_
100 * is intended to allow access to vendor specific capabilities
101 * @return
102 */
103 public static WPSGetCapabilities create( String id, String version, String updateSequence,
104 String[] acceptVersions, String[] sections,
105 String[] acceptFormats, Map<String, String> vendoreSpec ) {
106 return new WPSGetCapabilities( id, version, updateSequence, acceptVersions, sections,
107 acceptFormats, vendoreSpec );
108 }
109
110 /**
111 * creates a WPS GetCapabilities request class representation from a key-value-pair encoded
112 * request
113 *
114 * @param id
115 * @param request
116 * @return
117 */
118 @SuppressWarnings("unchecked")
119 public static WPSGetCapabilities create( String id, String request )
120 throws InvalidParameterValueException, MissingParameterValueException {
121 Map map = KVP2Map.toMap( request );
122 map.put( "ID", id );
123 return create( map );
124 }
125
126 /**
127 * creates a WPS GetCapabilities request class representation form a key-value-pair encoded
128 * request
129 *
130 * @param request
131 * @return
132 * @throws InvalidParameterValueException
133 * @throws MissingParameterValueException
134 */
135 public static WPSGetCapabilities create( Map<String, String> request )
136 throws InvalidParameterValueException, MissingParameterValueException {
137
138 String id = request.remove( "ID" );
139 String service = request.remove( "SERVICE" );
140 if ( null == service ) {
141 throw new MissingParameterValueException( "WPSGetCapabilities",
142 "'service' parameter is missing" );
143 }
144 if ( !"WPS".equals( service ) ) {
145 throw new InvalidParameterValueException( "WPSGetCapabilities",
146 "service attribute must equal 'WPS'" );
147 }
148 String updateSeq = request.remove( "UPDATESEQUENCE" );
149 String version = request.remove( "VERSION" );
150
151 // accept versions, sections, accept formats not supported
152 return new WPSGetCapabilities( id, version, updateSeq, null, null, null, request );
153 }
154
155 /**
156 * XML-coded get capabilities request not supported.
157 *
158 * @see "OGC 05-007r4 Subclause 8.2"
159 *
160 * @param id
161 * @param element
162 * @return
163 * @throws OGCWebServiceException
164 * @throws MissingParameterValueException
165 * @throws InvalidParameterValueException
166 */
167 public static WPSGetCapabilities create( String id, Element element )
168 throws OGCWebServiceException {
169 throw new OperationNotSupportedException(
170 "HTTP post transfer of XML encoded get capabilities request not supported." );
171
172 }
173
174 /*
175 * (non-Javadoc)
176 *
177 * @see org.deegree.ogcwebservices.OGCWebServiceRequest#getServiceName()
178 */
179 public String getServiceName() {
180 return "WPS";
181 }
182
183 }