    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/ogcwebservices/wmps/operation/WMPSGetCapabilities.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.wmps.operation;
    037
    038    import java.util.Map;
    039
    040    import org.deegree.ogcwebservices.InconsistentRequestException;
    041    import org.deegree.ogcwebservices.getcapabilities.GetCapabilities;
    042
    043    /**
    044     * This interface desribes the access to the parameters common to a OGC GetCapabilities request. It
    045     * inherits three accessor methods from the general OGC web service request interface.
    046     *
    047     * <p>
    048     * --------------------------------------------------------
    049     * </p>
    050     *
    051     * @author <a href="mailto:deshmukh@lat-lon.de">Anup Deshmukh</a>
    052     * @version 2.0
    053     */
    054    public class WMPSGetCapabilities extends GetCapabilities {
    055
    056        private static final long serialVersionUID = -609973973617914526L;
    057
    058        /**
    059         * creates an WMPS GetCapabilities Request
    060         *
    061         * @param paramMap
    062         *            the parameters of the request
    063         * @return the GetCapabilities request
    064         * @throws InconsistentRequestException
    065         *             if the request is inconsistent
    066         */
    067        public static WMPSGetCapabilities create( Map<String,String> paramMap )
    068                                throws InconsistentRequestException {
    069
    070            String version = paramMap.remove( "VERSION" );
    071
    072            if ( version == null ) {
    073                version = paramMap.remove( "WMTVER" );
    074            }
    075
    076            String service = paramMap.remove( "SERVICE" );
    077            String updateSequence = paramMap.remove( "UPDATESEQUENCE" );
    078
    079            if ( service == null ) {
    080                throw new InconsistentRequestException( "Required parameter 'SERVICE' is missing." );
    081            }
    082
    083            if ( !service.equals( "WMPS" ) ) {
    084                throw new InconsistentRequestException( "Parameter 'SERVICE' must be 'WMPS'." );
    085            }
    086
    087            return new WMPSGetCapabilities( paramMap.remove( "ID" ), version, updateSequence,
    088                                            paramMap );
    089        }
    090
    091        /**
    092         * Creates a new WMPSGetCapabilities object.
    093         *
    094         * @param version
    095         * @param id
    096         * @param updateSequence
    097         * @param vendorSpecificParameter
    098         */
    099        WMPSGetCapabilities( String version, String id, String updateSequence,
    100                             Map<String, String> vendorSpecificParameter ) {
    101            super( version, id, updateSequence, null, null, null, vendorSpecificParameter );
    102        }
    103
    104        /**
    105         * returns the URI of a HTTP GET request.
    106         *
    107         * @return String
    108         */
    109        @Override
    110        public String getRequestParameter() {
    111            if ( getVersion().equals( "1.0.0" ) ) {
    112                return "service=WMPS&version=" + getVersion() + "&request=capabilities";
    113            }
    114            return "service=WMPS&version=" + getVersion() + "&request=GetCapabilities";
    115        }
    116
    117        /**
    118         * returns 'WMPS' as service name
    119         *
    120         * @return String
    121         */
    122        public String getServiceName() {
    123            return "WMPS";
    124        }
    125
    126
    127    }