001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/ogcwebservices/wass/common/OWSCapabilitiesBaseType_1_0.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    
037    package org.deegree.ogcwebservices.wass.common;
038    
039    import java.util.ArrayList;
040    
041    import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities;
042    import org.deegree.ogcwebservices.getcapabilities.ServiceIdentification;
043    import org.deegree.ogcwebservices.getcapabilities.ServiceProvider;
044    
045    /**
046     * Encapsulates: OWS capabilities according to V1.0
047     *
048     * Namespace: http://www.opengis.net/ows
049     *
050     * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a>
051     * @author last edited by: $Author: mschneider $
052     *
053     * @version 2.0, $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
054     *
055     * @since 2.0
056     */
057    public class OWSCapabilitiesBaseType_1_0 extends OGCCapabilities {
058    
059        private static final long serialVersionUID = -7316008493729217865L;
060    
061        private ServiceIdentification serviceIdentification = null;
062    
063        private ServiceProvider serviceProvider = null;
064    
065        private OperationsMetadata_1_0 operationsMetadata = null;
066    
067        private ArrayList<SupportedAuthenticationMethod> authenticationMethods = null;
068    
069        private boolean passwordAuthenticationSupported = false;
070    
071        private boolean sessionAuthenticationSupported = false;
072    
073        private boolean wasAuthenticationSupported = false;
074    
075        private boolean anonymousAuthenticationSupported = false;
076    
077        /**
078         * Creates new instance from the given data.
079         *
080         * @param version
081         * @param updateSequence
082         * @param serviceIdentification
083         * @param serviceProvider
084         * @param operationsMetadata
085         * @param authenticationMethods
086         */
087        public OWSCapabilitiesBaseType_1_0(
088                                           String version,
089                                           String updateSequence,
090                                           ServiceIdentification serviceIdentification,
091                                           ServiceProvider serviceProvider,
092                                           OperationsMetadata_1_0 operationsMetadata,
093                                           ArrayList<SupportedAuthenticationMethod> authenticationMethods ) {
094            super( version, updateSequence );
095            this.serviceIdentification = serviceIdentification;
096            this.serviceProvider = serviceProvider;
097            this.operationsMetadata = operationsMetadata;
098            this.authenticationMethods = authenticationMethods;
099    
100            for( SupportedAuthenticationMethod method: this.authenticationMethods ){
101                if (method.getMethod().isWellformedGDINRW() && method.getMethod().getAuthenticationMethod().equals( "password" ) )
102                    passwordAuthenticationSupported = true;
103                if (method.getMethod().isWellformedGDINRW() && method.getMethod().getAuthenticationMethod().equals( "session" ) )
104                    sessionAuthenticationSupported = true;
105                if (method.getMethod().isWellformedGDINRW() && method.getMethod().getAuthenticationMethod().equals( "was" ) )
106                    wasAuthenticationSupported = true;
107                if (method.getMethod().isWellformedGDINRW() && method.getMethod().getAuthenticationMethod().equals( "anonymous" ) )
108                    anonymousAuthenticationSupported = true;
109            }
110    
111    
112        }
113    
114        /**
115         * @return the OperationsMetadata
116         */
117        public OperationsMetadata_1_0 getOperationsMetadata() {
118            return operationsMetadata;
119        }
120    
121        /**
122         * @return the ServiceIdentification
123         */
124        public ServiceIdentification getServiceIdentification() {
125            return serviceIdentification;
126        }
127    
128        /**
129         * @return the ServiceProvider
130         */
131        public ServiceProvider getServiceProvider() {
132            return serviceProvider;
133        }
134    
135        /**
136         * @return Returns the SupportedAuthenticationMethods.
137         */
138        public ArrayList<SupportedAuthenticationMethod> getAuthenticationMethods() {
139            return authenticationMethods;
140        }
141    
142        /**
143         * @param authMethod the method to check for.
144         * @return true if the method is supported
145         */
146        public boolean isAuthenticationMethodSupported( String authMethod ){
147            for ( SupportedAuthenticationMethod method : authenticationMethods ){
148                if( method.getMethod().getAuthenticationMethod().equals( authMethod ) )
149                    return true;
150            }
151            return false;
152        }
153    
154        /**
155         * @return Returns true if anonymousAuthentication is Supported.
156         */
157        public boolean isAnonymousAuthenticationSupported() {
158            return anonymousAuthenticationSupported;
159        }
160    
161        /**
162         * @return Returns true if passwordAuthentication is Supported.
163         */
164        public boolean isPasswordAuthenticationSupported() {
165            return passwordAuthenticationSupported;
166        }
167    
168        /**
169         * @return Returns true if sessionAuthentication is Supported.
170         */
171        public boolean isSessionAuthenticationSupported() {
172            return sessionAuthenticationSupported;
173        }
174    
175        /**
176         * @return Returns true if wasAuthentication (SAML) is Supported.
177         */
178        public boolean isWasAuthenticationSupported() {
179            return wasAuthenticationSupported;
180        }
181    
182    }