001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/ogcwebservices/sos/configuration/SOSDeegreeParams.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.sos.configuration;
037    
038    import java.util.ArrayList;
039    
040    import org.deegree.enterprise.DeegreeParams;
041    import org.deegree.model.metadata.iso19115.OnlineResource;
042    
043    /**
044     * Describe the SCSDeegreeParams, is a part of the SCSConfiguration
045     *
046     * @author <a href="mailto:mkulbe@lat-lon.de">Matthias Kulbe </a>
047     *
048     * @version 1.0
049     */
050    
051    public class SOSDeegreeParams extends DeegreeParams {
052    
053        private static final long serialVersionUID = -9133552111738123545L;
054    
055        private ArrayList<SensorConfiguration> sensorConfigs = null;
056    
057        private ArrayList<PlatformConfiguration> platformConfigs = null;
058    
059        private ArrayList<SourceServerConfiguration> sourceServerConfigs = null;
060    
061        private int sourceServerTimeLimit = 0;
062    
063        /**
064         * constructor
065         *
066         * @param defaultOnlineResource
067         * @param cacheSize
068         * @param requestTimeLimit
069         * @param characterSet
070         * @param sourceServerTimeLimit
071         * @param sensorConfigs
072         * @param platformConfigs
073         * @param sourceServerConfigs
074         */
075        public SOSDeegreeParams( OnlineResource defaultOnlineResource, int cacheSize, int requestTimeLimit,
076                                 String characterSet, int sourceServerTimeLimit, SensorConfiguration[] sensorConfigs,
077                                 PlatformConfiguration[] platformConfigs, SourceServerConfiguration[] sourceServerConfigs ) {
078    
079            super( defaultOnlineResource, cacheSize, requestTimeLimit, characterSet );
080    
081            this.sourceServerTimeLimit = sourceServerTimeLimit;
082    
083            if ( sensorConfigs != null ) {
084                this.sensorConfigs = new ArrayList<SensorConfiguration>( sensorConfigs.length );
085                for ( int i = 0; i < sensorConfigs.length; i++ ) {
086                    this.sensorConfigs.add( sensorConfigs[i] );
087                }
088            } else {
089                this.sensorConfigs = new ArrayList<SensorConfiguration>( 1 );
090            }
091    
092            if ( platformConfigs != null ) {
093                this.platformConfigs = new ArrayList<PlatformConfiguration>( platformConfigs.length );
094                for ( int i = 0; i < platformConfigs.length; i++ ) {
095                    this.platformConfigs.add( platformConfigs[i] );
096                }
097            } else {
098                this.platformConfigs = new ArrayList<PlatformConfiguration>( 1 );
099            }
100    
101            if ( sourceServerConfigs != null ) {
102                this.sourceServerConfigs = new ArrayList<SourceServerConfiguration>( sourceServerConfigs.length );
103                for ( int i = 0; i < sourceServerConfigs.length; i++ ) {
104                    this.sourceServerConfigs.add( sourceServerConfigs[i] );
105                }
106            } else {
107                this.sourceServerConfigs = new ArrayList<SourceServerConfiguration>( 1 );
108            }
109    
110        }
111    
112        /**
113         * gets the platform configuration by id
114         *
115         * @param id
116         * @return the config
117         */
118        public PlatformConfiguration getPlatformConfiguration( String id ) {
119            for ( int i = 0; i < platformConfigs.size(); i++ ) {
120                if ( platformConfigs.get( i ).getId().equals( id ) ) {
121                    return platformConfigs.get( i );
122                }
123            }
124            return null;
125        }
126    
127        /**
128         * gets the Platform Configuration by the IdPropertyValue which is set in the configuration
129         *
130         * @param id
131         * @return the config
132         */
133        public PlatformConfiguration getPlatformConfigurationByIdPropertyValue( String id ) {
134            for ( int i = 0; i < platformConfigs.size(); i++ ) {
135                String s = platformConfigs.get( i ).getIdPropertyValue();
136                if ( s.equals( id ) ) {
137                    return platformConfigs.get( i );
138                }
139            }
140    
141            return null;
142        }
143    
144        /**
145         * gets all platform configs
146         *
147         * @return the configs
148         */
149        public PlatformConfiguration[] getPlatformConfigurations() {
150            return this.platformConfigs.toArray( new PlatformConfiguration[this.platformConfigs.size()] );
151        }
152    
153        /**
154         * gets the sensor configuration by id
155         *
156         * @param id
157         * @return the config
158         */
159        public SensorConfiguration getSensorConfiguration( String id ) {
160            for ( int i = 0; i < sensorConfigs.size(); i++ ) {
161                if ( sensorConfigs.get( i ).getId().equals( id ) ) {
162                    return sensorConfigs.get( i );
163                }
164    
165            }
166    
167            return null;
168        }
169    
170        /**
171         * gets the Sensor Configuration by the IdPropertyValue which is set in the configuration
172         *
173         * @param id
174         * @return the config
175         */
176        public SensorConfiguration getSensorConfigurationByIdPropertyValue( String id ) {
177            for ( int i = 0; i < this.sensorConfigs.size(); i++ ) {
178                SensorConfiguration sc = this.sensorConfigs.get( i );
179                String s = sc.getId();
180    
181                if ( s.equals( id ) ) {
182                    return this.sensorConfigs.get( i );
183                }
184            }
185    
186            return null;
187        }
188    
189        /**
190         * gets all sensor configs
191         *
192         * @return the configs
193         */
194        public SensorConfiguration[] getSensorConfigurations() {
195            return this.sensorConfigs.toArray( new SensorConfiguration[this.sensorConfigs.size()] );
196        }
197    
198        /**
199         * @return the limit
200         */
201        public int getSourceServerTimeLimit() {
202            return sourceServerTimeLimit;
203        }
204    
205        /**
206         * gets all sourceServer Configurations
207         *
208         * @return the configs
209         */
210        public SourceServerConfiguration[] getSourceServerConfigurations() {
211            return this.sourceServerConfigs.toArray( new SourceServerConfiguration[this.sourceServerConfigs.size()] );
212        }
213    
214        /**
215         * gets the sourceServer config by the given id
216         *
217         * @param id
218         * @return the config
219         */
220        public SourceServerConfiguration getSourceServerConfiguration( String id ) {
221            for ( int i = 0; i < this.sourceServerConfigs.size(); i++ ) {
222                if ( this.sourceServerConfigs.get( i ).getId().equals( id ) ) {
223                    return this.sourceServerConfigs.get( i );
224                }
225            }
226            return null;
227        }
228    
229    }