    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/ogcwebservices/wmps/capabilities/WMPSCapabilities.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.capabilities;
    037
    038    import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities;
    039    import org.deegree.ogcwebservices.getcapabilities.OperationsMetadata;
    040    import org.deegree.ogcwebservices.getcapabilities.ServiceIdentification;
    041    import org.deegree.ogcwebservices.getcapabilities.ServiceProvider;
    042    import org.deegree.ogcwebservices.wms.capabilities.Layer;
    043    import org.deegree.ogcwebservices.wms.capabilities.UserDefinedSymbolization;
    044
    045    /**
    046     * The purpose of the GetCapabilities operation is described in the Basic Capabilities Service
    047     * Elements section, above. In the particular case of a Web Map Print Service Capabilities Service,
    048     * the response of a GetCapabilities request is general information about the service itself and
    049     * specific information about the available maps.
    050     *
    051     * The available output formats and the online resource are listed for each operation offered by the
    052     * server,
    053
    054     *
    055     * @author <a href="mailto:deshmukh@lat-lon.de">Anup Deshmukh</a>
    056     * @version 2.0
    057     */
    058    public class WMPSCapabilities extends OGCCapabilities {
    059
    060        private static final long serialVersionUID = -5173204173366244735L;
    061
    062        private ServiceIdentification serviceIdentification;
    063
    064        private ServiceProvider serviceProvider;
    065
    066        private OperationsMetadata operationMetadata;
    067
    068        private UserDefinedSymbolization userDefinedSymbolization;
    069
    070        private Layer layer;
    071
    072        /**
    073         * Constructor initializing the class with the <code>WMPSCapabilities</code>
    074         *
    075         * @param version
    076         * @param serviceIdentification
    077         * @param serviceProvider
    078         * @param userDefinedSymbolization
    079         * @param metadata
    080         * @param layer
    081         */
    082        protected WMPSCapabilities( String version, ServiceIdentification serviceIdentification,
    083                                   ServiceProvider serviceProvider,
    084                                   UserDefinedSymbolization userDefinedSymbolization,
    085                                   OperationsMetadata metadata, Layer layer ) {
    086            super( version, null );
    087            setServiceProvider( serviceProvider );
    088            setServiceIdentification( serviceIdentification );
    089            setUserDefinedSymbolization( userDefinedSymbolization );
    090            setOperationMetadata( metadata );
    091            setLayer( layer );
    092        }
    093
    094        /**
    095         * returns the service description section
    096         *
    097         * @return ServiceIdentification
    098         */
    099        public ServiceIdentification getServiceIdentification() {
    100            return this.serviceIdentification;
    101        }
    102
    103        /**
    104         * the service description section
    105         *
    106         * @param serviceIdentification
    107         */
    108        public void setServiceIdentification( ServiceIdentification serviceIdentification ) {
    109            this.serviceIdentification = serviceIdentification;
    110        }
    111
    112        /**
    113         * returns the root layer provided by a WMPS
    114         *
    115         * @return Layer
    116         */
    117        public Layer getLayer() {
    118            return this.layer;
    119        }
    120
    121        /**
    122         * recursion over all layers to find the layer that matches the submitted name. If no layer can
    123         * be found that fullfills the condition <tt>null</tt> will be returned.
    124         *
    125         * @param name
    126         * @return Layer
    127         */
    128        public Layer getLayer( String name ) {
    129            Layer lay = null;
    130
    131            if ( name.equals( this.layer.getName() ) ) {
    132                lay = this.layer;
    133            } else {
    134                lay = getLayer( name, this.layer.getLayer() );
    135            }
    136
    137            return lay;
    138        }
    139
    140        /**
    141         * returns the layer provided by a WMPS for the submitted name. If not found null will be
    142         * returned.
    143         *
    144         * @param name
    145         *            name of the layer to be found
    146         * @param layers
    147         *            list of searchable layers
    148         *
    149         * @return a layer object or <tt>null</tt>
    150         */
    151        private Layer getLayer( String name, Layer[] layers ) {
    152            Layer lay = null;
    153
    154            if ( layers != null ) {
    155                for ( int i = 0; i < layers.length; i++ ) {
    156                    if ( name.equals( layers[i].getName() ) ) {
    157                        lay = layers[i];
    158                        break;
    159                    }
    160                    lay = getLayer( name, layers[i].getLayer() );
    161                    if ( lay != null ) break;
    162                }
    163            }
    164
    165            return lay;
    166        }
    167
    168        /**
    169         * sets the root layer provided by a WMPS
    170         *
    171         * @param layer
    172         */
    173        public void setLayer( Layer layer ) {
    174            this.layer = layer;
    175        }
    176
    177        /**
    178         * returns metadata about the offered access methods like PrintMap or GetCapabiliites
    179         *
    180         * @return OperationsMetadata
    181         */
    182        public OperationsMetadata getOperationMetadata() {
    183            return this.operationMetadata;
    184        }
    185
    186        /**
    187         * sets metadata for the offered access methods like PrintMap or GetCapabiliites
    188         *
    189         * @param operationMetadata
    190         */
    191        public void setOperationMetadata( OperationsMetadata operationMetadata ) {
    192            this.operationMetadata = operationMetadata;
    193        }
    194
    195        /**
    196         * returns informations about the provider of a WMPS
    197         *
    198         * @return ServiceProvider
    199         */
    200        public ServiceProvider getServiceProvider() {
    201            return this.serviceProvider;
    202        }
    203
    204        /**
    205         * sets informations about the provider of a WMPS
    206         *
    207         * @param serviceProvider
    208         */
    209        public void setServiceProvider( ServiceProvider serviceProvider ) {
    210            this.serviceProvider = serviceProvider;
    211        }
    212
    213        public UserDefinedSymbolization getUserDefinedSymbolization() {
    214            return this.userDefinedSymbolization;
    215        }
    216
    217        public void setUserDefinedSymbolization( UserDefinedSymbolization userDefinedSymbolization ) {
    218            this.userDefinedSymbolization = userDefinedSymbolization;
    219        }
    220    }