Revision 11926 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/DBLayerDefinition.java

View differences:

DBLayerDefinition.java
2 2
 * Created on 26-oct-2005
3 3
 *
4 4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 * 
5
 *
6 6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 * 
7
 *
8 8
 * This program is free software; you can redistribute it and/or
9 9
 * modify it under the terms of the GNU General Public License
10 10
 * as published by the Free Software Foundation; either version 2
11 11
 * of the License, or (at your option) any later version.
12
 *  
12
 *
13 13
 * This program is distributed in the hope that it will be useful,
14 14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 16
 * GNU General Public License for more details.
17
 * 
17
 *
18 18
 * You should have received a copy of the GNU General Public License
19 19
 * along with this program; if not, write to the Free Software
20 20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
 *  
21
 *
22 22
 * For more information, contact:
23 23
 *
24 24
 *  Generalitat Valenciana
......
30 30
 *      +34 963862235
31 31
 *   gvsig@gva.es
32 32
 *      www.gvsig.gva.es
33
 * 
33
 *
34 34
 *    or
35
 * 
35
 *
36 36
 *   IVER T.I. S.A
37 37
 *   Salamanca 50
38 38
 *   46005 Valencia
39 39
 *   Spain
40
 * 
40
 *
41 41
 *   +34 963163400
42 42
 *   dac@iver.es
43 43
 */
44 44
package com.iver.cit.gvsig.fmap.drivers;
45 45

  
46 46
import java.awt.geom.Rectangle2D;
47
import java.sql.Connection;
47
//import java.sql.Connection;
48
import java.sql.Types;
48 49

  
49 50
public class DBLayerDefinition extends LayerDefinition {
50
	private Connection conn;
51
	private IConnection conn;
51 52
    private String catalogName;
52 53
    private String schema;
53 54
    private String tableName;
54 55
    // private String[] fieldNames; // GeometryField not included
55
    private String fieldID; // Estos 2 campos en PostGIS los sabremos 
56
    private String fieldID; // Estos 2 campos en PostGIS los sabremos
56 57
    private String fieldGeometry; // (gid y the_geom), pero por si acaso se cambian
57 58
    private String whereClause;
58 59
    private Rectangle2D workingArea;
59 60
    private String SRID_EPSG;
60 61
    private String classToInstantiate;
61
    
62

  
62 63
    // private int idFieldGeometry = -1;
63 64
    private int idFieldID = -1;
64 65
	private int dimension = 2;
65
    
66
	private String host;
67
	private int port;
68
	private String database;
69
	private String user;
70
	private String password;
71
	private String connectionname;
72

  
66 73
    public String getCatalogName() {
67 74
        return catalogName;
68 75
    }
......
155 162
    public void setWorkingArea(Rectangle2D workingArea) {
156 163
        this.workingArea = workingArea;
157 164
    }
158
    
165

  
159 166
    /**
160 167
     * @param fieldName
161 168
     * @return index of field (0 based). -1 if not found
......
173 180
        }
174 181
        return result;
175 182
    }
176
    
183

  
177 184
    /**
178 185
     * 0 based index of the ID field
179 186
     * @return Returns the idFieldID.
180 187
     */
181 188
    public int getIdFieldID() {
182 189
        if (idFieldID == -1)
183
            idFieldID = getIdField(fieldID);        
190
            idFieldID = getIdField(fieldID);
184 191
        return idFieldID;
185 192
    }
186 193
    /**
......
207 214
    public void setClassToInstantiate(String classToInstantiate) {
208 215
        this.classToInstantiate = classToInstantiate;
209 216
    }
210
    
217

  
211 218
    public int getFieldIdByName(String name)
212 219
    {
213 220
        int resul = -1;
......
221 228
        }
222 229
        return resul;
223 230
    }
224
	public Connection getConnection() {
231
	public IConnection getConnection() {
225 232
		return conn;
226 233
	}
227
	
228
	public void setConnection(Connection connection) {
234

  
235
	public void setConnection(IConnection connection) {
229 236
		conn = connection;
230 237
	}
231 238
	public int getDimension() {
......
235 242
	public void setDimension(int dim) {
236 243
		dimension = dim;
237 244
	}
245
	public String getHost() {
246
		return host;
247
	}
248
	public void setHost(String host){
249
		this.host=host;
250
	}
251
	public int getPort() {
252
		return port;
253
	}
254
	public void setPort(int port){
255
		this.port=port;
256
	}
257
	public String getDataBase() {
258
		return database;
259
	}
260
	public void setDataBase(String database){
261
		this.database=database;
262
	}
263
	public String getUser() {
264
		return user;
265
	}
266
	public void setUser(String user){
267
		this.user=user;
268
	}
269
	public String getPassword() {
270
		return password;
271
	}
272
	public void setPassword(String password){
273
		this.password=password;
274
	}
275
	public void setConnectionName(String stringProperty) {
276
		this.connectionname=stringProperty;
277
	}
278
	public String getConnectionName() {
279
		return connectionname;
280
	}
238 281
	public void setSchema(String schema) {
239 282
		this.schema = schema; 	
240 283
	}
......
248 291
		String compoundTable = getSchema()!=null?(getSchema() + "." + getTableName()):getTableName();
249 292
		return compoundTable;
250 293
	}
251
	
252 294
}

Also available in: Unified diff