    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/ogcwebservices/wpvs/operation/WPVSGetCapabilities.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
    037    package org.deegree.ogcwebservices.wpvs.operation;
    038
    039    import java.util.Map;
    040
    041    import org.deegree.framework.util.StringTools;
    042    import org.deegree.ogcwebservices.InvalidParameterValueException;
    043    import org.deegree.ogcwebservices.MissingParameterValueException;
    044    import org.deegree.ogcwebservices.getcapabilities.GetCapabilities;
    045
    046    /**
    047     * ...
    048     *
    049     * @author <a href="mailto:taddei@lat-lon.de">Ugo Taddei</a>
    050     * @author last edited by: $Author: mschneider $
    051     *
    052     * @version 2.0, $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
    053     *
    054     * @since 2.0
    055     */
    056    public class WPVSGetCapabilities extends GetCapabilities {
    057
    058        /**
    059         *
    060         */
    061        private static final long serialVersionUID = 4226522219910647235L;
    062
    063        private static final String WPVS_SERVICE_NAME = "WPVS";
    064
    065        /**
    066         * Creates a <code>WPVSGetCapabilities</code> object.
    067         *
    068         * @param id
    069         * @param version
    070         * @param updateSeq
    071         * @param acceptedVersions
    072         * @param sections
    073         * @param acceptedFormats
    074         * @param vendoreSpec
    075         * TODO check if all pars are needed for WPV Service
    076         */
    077        public WPVSGetCapabilities( String id, String version, String updateSeq,
    078                                    String[] acceptedVersions, String[] sections,
    079                                    String[] acceptedFormats, Map<String,String> vendoreSpec) {
    080            super( id, version, updateSeq, acceptedVersions, sections, acceptedFormats, vendoreSpec);
    081        }
    082
    083        /**
    084         * Creates a <code>WPVSGetCapabilites</code> request from a key-value-pairs in
    085         * <code>paramMap</code>.
    086         * @param paramMap Map containing te request parameters
    087         * @return an new instance of a WPVSGetCapabilities request.
    088         * @throws MissingParameterValueException if there is a parameter missing
    089         * @throws InvalidParameterValueException if one of the parameters has an invalid value
    090         */
    091        public static WPVSGetCapabilities create( Map<String,String> paramMap )
    092            throws  MissingParameterValueException,
    093                            InvalidParameterValueException {
    094
    095            String id = paramMap.remove( "ID" );
    096            String service = paramMap.remove( "SERVICE" );
    097
    098            if ( !service.equals( WPVS_SERVICE_NAME ) ) {
    099                throw new MissingParameterValueException( "WPVSGetCapabilities",
    100                    "'service' parameter is missing" );
    101            }
    102            if ( !service.equals( WPVS_SERVICE_NAME ) ) {
    103                throw new InvalidParameterValueException( "WPVSGetCapabilities",
    104                    "service attribute must equal 'WPVS'" );
    105            }
    106
    107            String updateSeq = paramMap.remove( "UPDATESEQUENCE" );
    108            String version = paramMap.remove( "VERSION" );
    109            String tmp = paramMap.remove( "SECTION" );
    110
    111            String[] sections = null;
    112            if ( tmp != null ) {
    113                sections = StringTools.toArray( tmp, ",", true );
    114            }
    115
    116            return new WPVSGetCapabilities( id, service, updateSeq, new String[] { version },
    117                                                                    sections, null, paramMap);
    118        }
    119
    120        /**
    121         * returns 'WPVS' as service name.
    122         */
    123        public String getServiceName() {
    124            return WPVS_SERVICE_NAME;
    125        }
    126    }