001 //$HeadURL: http://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/portal/context/Server.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.portal.context;
037
038 import java.net.URL;
039
040 import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities;
041
042 /**
043 * encapsulates the server description as defined in the OGC Web Map Context specification 1.0.0
044 *
045 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
046 * @author last edited by: $Author: apoth $
047 *
048 * @version $Revision: 30711 $, $Date: 2011-05-06 14:54:17 +0200 (Fri, 06 May 2011) $
049 */
050 public class Server {
051 private String service = null;
052
053 private String title = null;
054
055 private String version = null;
056
057 private URL onlineResource = null;
058
059 private OGCCapabilities capabilities = null;
060
061 /**
062 * Creates a new Server object.
063 *
064 * @param title
065 * the title of the service
066 * @param version
067 * Version number of the OGC interface specification which corresponds to the service
068 * @param service
069 * the type of the service according to OGC interfaces, such as WMS, WFS.
070 * @param onlineResource
071 * the link to the online resource
072 * @param capabilities
073 *
074 * @throws ContextException
075 */
076 public Server( String title, String version, String service, URL onlineResource, OGCCapabilities capabilities )
077 throws ContextException {
078 setTitle( title );
079 setVersion( version );
080 setService( service );
081 setOnlineResource( onlineResource );
082 setCapabilities( capabilities );
083 }
084
085 /**
086 * the title of the service (extracted from the Capabilities by the Context document creator)
087 *
088 * @return the title of the service (extracted from the Capabilities by the Context document creator)
089 */
090 public String getTitle() {
091 return title;
092 }
093
094 /**
095 * Version number of the OGC interface specification which corresponds to the service
096 *
097 * @return Version number of the OGC interface specification which corresponds to the service
098 */
099 public String getVersion() {
100 return version;
101 }
102
103 /**
104 * the type of the service according to OGC interfaces, such as WMS, WFS.
105 *
106 * @return the type of the service according to OGC interfaces, such as WMS, WFS.
107 */
108 public String getService() {
109 return service;
110 }
111
112 /**
113 * link to the online resource
114 *
115 * @return link to the online resource
116 */
117 public URL getOnlineResource() {
118 return onlineResource;
119 }
120
121 /**
122 * see also org.deegree.clients.context.Server#getTitle()
123 *
124 * @param title
125 */
126 public void setTitle( String title ) {
127 this.title = title;
128 }
129
130 /**
131 * see also org.deegree.clients.context.Server#getFeatureVersion()
132 *
133 * @param version
134 *
135 * @throws ContextException
136 */
137 public void setVersion( String version )
138 throws ContextException {
139 if ( version == null ) {
140 throw new ContextException( "version isn't allowed to be null" );
141 }
142 this.version = version;
143 }
144
145 /**
146 * see also org.deegree.clients.context.Server#getService()
147 *
148 * @param service
149 *
150 * @throws ContextException
151 */
152 public void setService( String service )
153 throws ContextException {
154 if ( service == null ) {
155 throw new ContextException( "service isn't allowed to be null" );
156 }
157 this.service = service;
158 }
159
160 /**
161 * see also org.deegree.clients.context.Server#getOnlineResource()
162 *
163 * @param onlineResource
164 *
165 * @throws ContextException
166 */
167 public void setOnlineResource( URL onlineResource )
168 throws ContextException {
169 if ( onlineResource == null ) {
170 throw new ContextException( "onlineResource isn't allowed to be null" );
171 }
172 this.onlineResource = onlineResource;
173 }
174
175 /**
176 * returns the capabilities of the encapsulated server
177 *
178 * @return the capabilities of the encapsulated server
179 */
180 public OGCCapabilities getCapabilities() {
181 return capabilities;
182 }
183
184 /**
185 * @see #getCapabilities()
186 * @param capabilities
187 */
188 public void setCapabilities( OGCCapabilities capabilities ) {
189 this.capabilities = capabilities;
190 }
191
192 @Override
193 public boolean equals( Object other ) {
194 if ( other == null || !( other instanceof Server ) ) {
195 return false;
196 }
197 Server os = (Server) other;
198 return os.getOnlineResource().equals( getOnlineResource() ) && os.getService().equals( getService() )
199 && os.getVersion().equals( getVersion() );
200 }
201
202 }