001    //$HeadURL: svn+ssh://developername@svn.wald.intevation.org/deegree/base/trunk/src/org/deegree/ogcwebservices/wms/configuration/DatabaseDataSource.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.wms.configuration;
037    
038    import java.util.Map;
039    
040    import org.deegree.datatypes.QualifiedName;
041    import org.deegree.io.JDBCConnection;
042    import org.deegree.model.crs.CoordinateSystem;
043    import org.deegree.model.spatialschema.Geometry;
044    import org.deegree.ogcwebservices.OGCWebService;
045    import org.deegree.ogcwebservices.OGCWebServiceException;
046    import org.deegree.ogcwebservices.wms.capabilities.ScaleHint;
047    
048    /**
049     *
050     *
051     *
052     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
053     * @author last edited by: $Author: poth $
054     *
055     * @version $Revision: 6251 $, $Date: 2007-03-19 16:59:28 +0100 (Mo, 19 Mrz 2007) $
056     */
057    public class DatabaseDataSource extends AbstractDataSource {
058    
059        private JDBCConnection jdbc;
060    
061        private String sqlTemplate;
062    
063        private String geomeryField;
064    
065        private CoordinateSystem nativeCRS;
066    
067        private final boolean customSQL;
068    
069        /**
070         *
071         * @param queryable
072         * @param failOnException
073         * @param name
074         * @param scaleHint
075         * @param validArea
076         * @param reqTimeLimit
077         * @param jdbc
078         * @param sqlTemplate
079         * @param geomeryField
080         * @param nativeCRS
081         */
082        public DatabaseDataSource( boolean queryable, boolean failOnException, QualifiedName name, ScaleHint scaleHint,
083                                   Geometry validArea, int reqTimeLimit, JDBCConnection jdbc, String sqlTemplate,
084                                   String geomeryField, CoordinateSystem nativeCRS ) {
085            this( queryable, failOnException, name, scaleHint, validArea, reqTimeLimit, jdbc, sqlTemplate, geomeryField,
086                  nativeCRS, false );
087        }
088    
089        /**
090         * @param queryable
091         * @param failOnException
092         * @param name
093         * @param scaleHint
094         * @param validArea
095         * @param reqTimeLimit
096         * @param jdbc
097         * @param sqlTemplate
098         * @param geometryField
099         * @param nativeCRS
100         * @param customSQL
101         */
102        public DatabaseDataSource( boolean queryable, boolean failOnException, QualifiedName name, ScaleHint scaleHint,
103                                   Geometry validArea, int reqTimeLimit, JDBCConnection jdbc, String sqlTemplate,
104                                   String geometryField, CoordinateSystem nativeCRS, boolean customSQL ) {
105            this( queryable, failOnException, name, scaleHint, validArea, reqTimeLimit, jdbc, sqlTemplate, geometryField,
106                  nativeCRS, customSQL, null );
107        }
108    
109        /**
110         * @param queryable
111         * @param failOnException
112         * @param name
113         * @param scaleHint
114         * @param validArea
115         * @param reqTimeLimit
116         * @param jdbc
117         * @param sqlTemplate
118         * @param geomeryField
119         * @param nativeCRS
120         * @param customSQL
121         * @param dimProps
122         */
123        public DatabaseDataSource( boolean queryable, boolean failOnException, QualifiedName name, ScaleHint scaleHint,
124                                   Geometry validArea, int reqTimeLimit, JDBCConnection jdbc, String sqlTemplate,
125                                   String geomeryField, CoordinateSystem nativeCRS, boolean customSQL,
126                                   Map<String, String> dimProps ) {
127            super( queryable, failOnException, name, DATABASE, null, null, scaleHint, validArea, null, reqTimeLimit,
128                   dimProps );
129            this.jdbc = jdbc;
130            this.sqlTemplate = sqlTemplate;
131            this.geomeryField = geomeryField;
132            this.nativeCRS = nativeCRS;
133            this.customSQL = customSQL;
134        }
135    
136        /*
137         * (non-Javadoc)
138         *
139         * @see org.deegree.ogcwebservices.wms.configuration.AbstractDataSource#getOGCWebService()
140         */
141        @Override
142        public OGCWebService getOGCWebService()
143                                throws OGCWebServiceException {
144            return null;
145        }
146    
147        /**
148         *
149         * @return database connection description
150         */
151        public JDBCConnection getJDBCConnection() {
152            return jdbc;
153        }
154    
155        /**
156         * @return the geomeryField
157         */
158        public String getGeometryFieldName() {
159            return geomeryField;
160        }
161    
162        /**
163         * @return the sqlTemplate
164         */
165        public String getSqlTemplate() {
166            return sqlTemplate;
167        }
168    
169        /**
170         * @return the nativeCRS
171         */
172        public CoordinateSystem getNativeCRS() {
173            return nativeCRS;
174        }
175    
176        /**
177         * @return true, if sending custom SQL templates is allowed
178         */
179        public boolean isCustomSQLAllowed() {
180            return customSQL;
181        }
182    
183    }