001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/portal/context/Server.java $
002 /*---------------- FILE HEADER ------------------------------------------
003
004 This file is part of deegree.
005 Copyright (C) 2001-2008 by:
006 EXSE, Department of Geography, University of Bonn
007 http://www.giub.uni-bonn.de/deegree/
008 lat/lon GmbH
009 http://www.lat-lon.de
010
011 This library is free software; you can redistribute it and/or
012 modify it under the terms of the GNU Lesser General Public
013 License as published by the Free Software Foundation; either
014 version 2.1 of the License, or (at your option) any later version.
015
016 This library is distributed in the hope that it will be useful,
017 but WITHOUT ANY WARRANTY; without even the implied warranty of
018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019 Lesser General Public License for more details.
020
021 You should have received a copy of the GNU Lesser General Public
022 License along with this library; if not, write to the Free Software
023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024
025 Contact:
026
027 Andreas Poth
028 lat/lon GmbH
029 Aennchenstr. 19
030 53115 Bonn
031 Germany
032 E-Mail: poth@lat-lon.de
033
034 Prof. Dr. Klaus Greve
035 Department of Geography
036 University of Bonn
037 Meckenheimer Allee 166
038 53115 Bonn
039 Germany
040 E-Mail: greve@giub.uni-bonn.de
041
042
043 ---------------------------------------------------------------------------*/
044 package org.deegree.portal.context;
045
046 import java.net.URL;
047
048 import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities;
049
050 /**
051 * encapsulates the server description as defined in the OGC Web Map Context specification 1.0.0
052 *
053 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
054 * @author last edited by: $Author: apoth $
055 *
056 * @version $Revision: 9346 $, $Date: 2007-12-27 17:39:07 +0100 (Do, 27 Dez 2007) $
057 */
058 public class Server {
059 private String service = null;
060
061 private String title = null;
062
063 private String version = null;
064
065 private URL onlineResource = null;
066
067 private OGCCapabilities capabilities = null;
068
069 /**
070 * Creates a new Server object.
071 *
072 * @param title
073 * the title of the service
074 * @param version
075 * Version number of the OGC interface specification which corresponds to the service
076 * @param service
077 * the type of the service according to OGC interfaces, such as WMS, WFS.
078 * @param onlineResource
079 * the link to the online resource
080 * @param capabilities
081 *
082 * @throws ContextException
083 */
084 public Server( String title, String version, String service, URL onlineResource,
085 OGCCapabilities capabilities ) throws ContextException {
086 setTitle( title );
087 setVersion( version );
088 setService( service );
089 setOnlineResource( onlineResource );
090 setCapabilities( capabilities );
091 }
092
093 /**
094 * the title of the service (extracted from the Capabilities by the Context document creator)
095 *
096 * @return the title of the service (extracted from the Capabilities by the Context document
097 * creator)
098 */
099 public String getTitle() {
100 return title;
101 }
102
103 /**
104 * Version number of the OGC interface specification which corresponds to the service
105 *
106 * @return Version number of the OGC interface specification which corresponds to the service
107 */
108 public String getVersion() {
109 return version;
110 }
111
112 /**
113 * the type of the service according to OGC interfaces, such as WMS, WFS.
114 *
115 * @return the type of the service according to OGC interfaces, such as WMS, WFS.
116 */
117 public String getService() {
118 return service;
119 }
120
121 /**
122 * link to the online resource
123 *
124 * @return link to the online resource
125 */
126 public URL getOnlineResource() {
127 return onlineResource;
128 }
129
130 /**
131 * @see org.deegree.clients.context.Server#getTitle()
132 *
133 * @param title
134 */
135 public void setTitle( String title ) {
136 this.title = title;
137 }
138
139 /**
140 * @see org.deegree.clients.context.Server#getFeatureVersion()
141 *
142 * @param version
143 *
144 * @throws ContextException
145 */
146 public void setVersion( String version )
147 throws ContextException {
148 if ( version == null ) {
149 throw new ContextException( "version isn't allowed to be null" );
150 }
151 this.version = version;
152 }
153
154 /**
155 * @see org.deegree.clients.context.Server#getService()
156 *
157 * @param service
158 *
159 * @throws ContextException
160 */
161 public void setService( String service )
162 throws ContextException {
163 if ( service == null ) {
164 throw new ContextException( "service isn't allowed to be null" );
165 }
166 this.service = service;
167 }
168
169 /**
170 * @see org.deegree.clients.context.Server#getOnlineResource()
171 *
172 * @param onlineResource
173 *
174 * @throws ContextException
175 */
176 public void setOnlineResource( URL onlineResource )
177 throws ContextException {
178 if ( onlineResource == null ) {
179 throw new ContextException( "onlineResource isn't allowed to be null" );
180 }
181 this.onlineResource = onlineResource;
182 }
183
184 /**
185 * returns the capabilities of the encapsulated server
186 *
187 * @return the capabilities of the encapsulated server
188 */
189 public OGCCapabilities getCapabilities() {
190 return capabilities;
191 }
192
193 /**
194 * @see #getCapabilities()
195 * @param capabilities
196 */
197 public void setCapabilities( OGCCapabilities capabilities ) {
198 this.capabilities = capabilities;
199 }
200
201 public boolean equals( Object other ) {
202 if ( other == null || !( other instanceof Server ) ) {
203 return false;
204 }
205 Server os = (Server) other;
206 return os.getOnlineResource().equals( getOnlineResource() )
207 && os.getService().equals( getService() ) && os.getVersion().equals( getVersion() );
208 }
209
210 }