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