    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/ogcwebservices/wps/WPSRequestBaseType.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;
    037
    038    import java.util.Map;
    039
    040    import org.deegree.framework.log.ILogger;
    041    import org.deegree.framework.log.LoggerFactory;
    042    import org.deegree.ogcwebservices.AbstractOGCWebServiceRequest;
    043    import org.deegree.ogcwebservices.InvalidParameterValueException;
    044    import org.deegree.ogcwebservices.MissingParameterValueException;
    045
    046    /**
    047     * WPSRequestBaseType.java
    048     *
    049     * Created on 09.03.2006. 22:47:16h
    050     *
    051     * WPS operation request base, for all WPS operations except GetCapabilities. In this XML encoding,
    052     * no "request" parameter is included, since the element name specifies the specific operation.
    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     * @version 1.0
    057     * @since 2.0
    058     */
    059
    060    public class WPSRequestBaseType extends AbstractOGCWebServiceRequest {
    061
    062        /**
    063         *
    064         */
    065        private static final long serialVersionUID = -7671779606604745604L;
    066
    067        /**
    068         * Service type identifier.
    069         */
    070        protected static final String service = "WPS";
    071
    072        /**
    073         * Version identifier.
    074         */
    075        protected static final String supportedVersion = "0.4.0";
    076
    077        private static final ILogger LOG = LoggerFactory.getLogger( WPSRequestBaseType.class );
    078
    079        /**
    080         * @param version
    081         * @param id
    082         * @param vendorSpecificParameter
    083         */
    084        public WPSRequestBaseType( String version, String id, Map<String, String> vendorSpecificParameter ) {
    085            super( version, id, vendorSpecificParameter );
    086        }
    087
    088        /**
    089         * @return Returns the version.
    090         */
    091        @Override
    092        public String getVersion() {
    093            return supportedVersion;
    094        }
    095
    096        /**
    097         *
    098         * @param request
    099         * @return the version parameter.
    100         * @throws MissingParameterValueException
    101         * @throws InvalidParameterValueException
    102         */
    103        protected static String extractVersionParameter( Map<String, String> request )
    104                                throws MissingParameterValueException, InvalidParameterValueException {
    105            String version = request.get( "VERSION" );
    106            if ( null == version ) {
    107                String msg = "Version parameter must be set.";
    108                LOG.logError( msg );
    109                throw new MissingParameterValueException( "version", msg );
    110            } else if ( "".equals( version ) ) {
    111                String msg = "Version parameter must not be empty.";
    112                LOG.logError( msg );
    113                throw new InvalidParameterValueException( "version", msg );
    114            } else if ( !supportedVersion.equals( version ) ) {
    115                String msg = "Only version 0.4.0 is currently supported by this wpserver instance";
    116                LOG.logError( msg );
    117                throw new InvalidParameterValueException( "version", msg );
    118            }
    119            return version;
    120        }
    121
    122        /*
    123         * (non-Javadoc)
    124         *
    125         * @see org.deegree.ogcwebservices.OGCWebServiceRequest#getServiceName()
    126         */
    127        public String getServiceName() {
    128            return service;
    129        }
    130    }