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