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