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