Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / SelectableDataSource.java @ 10977

History | View | Annotate | Download (15.7 KB)

1 1100 fjp
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41 460 fernando
package com.iver.cit.gvsig.fmap.layers;
42
43 1828 fernando
import java.io.IOException;
44
45
import org.apache.log4j.Logger;
46 1836 fernando
import org.xml.sax.SAXException;
47 1828 fernando
48 5569 jmvivo
import com.hardcode.driverManager.Driver;
49 1828 fernando
import com.hardcode.driverManager.DriverLoadException;
50 10627 caballero
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
51
import com.hardcode.gdbms.driver.exceptions.ReloadDriverException;
52
import com.hardcode.gdbms.driver.exceptions.WriteDriverException;
53 460 fernando
import com.hardcode.gdbms.engine.data.DataSource;
54 546 fernando
import com.hardcode.gdbms.engine.data.DataSourceFactory;
55 6323 fjp
import com.hardcode.gdbms.engine.data.IDataSourceListener;
56 546 fernando
import com.hardcode.gdbms.engine.data.NoSuchTableException;
57 4863 fjp
import com.hardcode.gdbms.engine.data.SourceInfo;
58 1828 fernando
import com.hardcode.gdbms.engine.data.driver.DriverException;
59 2217 fernando
import com.hardcode.gdbms.engine.data.edition.DataWare;
60 1836 fernando
import com.hardcode.gdbms.engine.data.persistence.Memento;
61
import com.hardcode.gdbms.engine.data.persistence.MementoContentHandler;
62
import com.hardcode.gdbms.engine.data.persistence.MementoException;
63 2217 fernando
import com.hardcode.gdbms.engine.instruction.EvaluationException;
64 460 fernando
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException;
65 1828 fernando
import com.hardcode.gdbms.engine.instruction.SemanticException;
66 460 fernando
import com.hardcode.gdbms.engine.values.Value;
67 2183 fernando
import com.hardcode.gdbms.engine.values.ValueCollection;
68 1828 fernando
import com.hardcode.gdbms.parser.ParseException;
69 4875 fjp
import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
70 3963 caballero
import com.iver.cit.gvsig.fmap.layers.layerOperations.Selectable;
71 4875 fjp
import com.iver.utiles.NumberUtilities;
72 581 vcaballero
import com.iver.utiles.XMLEntity;
73 460 fernando
74
75 527 vcaballero
/**
76 1034 vcaballero
 * DataSource seleccionable.
77 527 vcaballero
 *
78 546 fernando
 * @author Fernando Gonz?lez Cort?s
79 527 vcaballero
 */
80 3963 caballero
public class SelectableDataSource implements DataSource,Selectable {
81 527 vcaballero
        private static Logger logger = Logger.getLogger(SelectableDataSource.class.getName());
82 460 fernando
        private SelectionSupport selectionSupport = new SelectionSupport();
83
        private DataSource dataSource;
84 10627 caballero
85 4863 fjp
        private int[] mapping = null;
86 527 vcaballero
87 460 fernando
        /**
88 1034 vcaballero
         * Crea un nuevo SelectableDataSource.
89 527 vcaballero
         *
90 1034 vcaballero
         * @param name
91 460 fernando
         * @param ds
92 10627 caballero
         * @throws ReadDriverException TODO
93 460 fernando
         */
94 10627 caballero
        public SelectableDataSource(DataSource ds) throws ReadDriverException {
95 460 fernando
                dataSource = ds;
96 5663 fjp
                dataSource.start();
97 4863 fjp
                // Creamos el mapping de campos externos que no muestran el PK.
98 6259 fjp
                mapExternalFields();
99
100
101
        }
102
103
        /**
104 6335 fjp
         * Maps real fields or "external" fields. We don't want to see virtual fields.
105 10665 caballero
         * @throws ReadDriverException
106 6259 fjp
         */
107 10627 caballero
        public void mapExternalFields() throws ReadDriverException {
108 4863 fjp
                int numExternalFields = 0;
109
                for (int i=0; i < dataSource.getFieldCount(); i++)
110
                {
111
                        if (!dataSource.isVirtualField(i))
112
                                numExternalFields++;
113 10627 caballero
114 4863 fjp
                }
115 3963 caballero
116 4863 fjp
                mapping = new int[numExternalFields];
117
                int j=0;
118
                for (int i=0; i < dataSource.getFieldCount(); i++)
119
                {
120
                        if (!dataSource.isVirtualField(i))
121
                                mapping[j++] = i;
122 10627 caballero
123 4863 fjp
                }
124 460 fernando
        }
125 527 vcaballero
126 10627 caballero
        public static SelectableDataSource createSelectableDataSource(XMLEntity xml) throws DriverLoadException, XMLException{
127 3963 caballero
128 1828 fernando
                SelectionSupport ss = new SelectionSupport();
129
                ss.setXMLEntity(xml.getChild(0));
130
                XMLEntity xmlDS = xml.getChild(1);
131 1836 fernando
                GDBMSParser parser = new GDBMSParser(xmlDS);
132
                MementoContentHandler gdbmsHandler = new MementoContentHandler();
133
                parser.setContentHandler(gdbmsHandler);
134
                try {
135
                        parser.parse();
136
                } catch (SAXException e) {
137
                        throw new XMLException(e);
138 1828 fernando
                }
139 2217 fernando
                SelectableDataSource sds;
140
        try {
141 5663 fjp
            sds = new SelectableDataSource(gdbmsHandler.getDataSource(LayerFactory.getDataSourceFactory(), DataSourceFactory.MANUAL_OPENING));
142 2217 fernando
        } catch (EvaluationException e1) {
143
            throw new XMLException(e1);
144 10627 caballero
        } catch (ReadDriverException e) {
145
                 throw new XMLException(e);
146
                } catch (DriverLoadException e) {
147
                         throw new XMLException(e);
148
                } catch (SemanticException e) {
149
                         throw new XMLException(e);
150
                } catch (ParseException e) {
151
                         throw new XMLException(e);
152
                } catch (NoSuchTableException e) {
153
                         throw new XMLException(e);
154
                }
155 2217 fernando
        sds.selectionSupport=ss;
156 2183 fernando
                return sds;
157 1828 fernando
        }
158 1836 fernando
159 1828 fernando
        public void setDataSourceFactory(DataSourceFactory dsf) {
160
                dataSource.setDataSourceFactory(dsf);
161
        }
162 2217 fernando
        public void setSourceInfo(SourceInfo sourceInfo) {
163 1828 fernando
                dataSource.setSourceInfo(sourceInfo);
164
        }
165 460 fernando
        /**
166 1034 vcaballero
         * A?ade el soporte para la selecci?n.
167 527 vcaballero
         *
168 460 fernando
         * @param selectionSupport
169
         */
170
        public void setSelectionSupport(SelectionSupport selectionSupport) {
171
                this.selectionSupport = selectionSupport;
172
        }
173
174 527 vcaballero
        /**
175 1034 vcaballero
         * Devuelve el n?mero de campos.
176 527 vcaballero
         *
177 1034 vcaballero
         * @return N?mero de campos.
178 527 vcaballero
         *
179 1034 vcaballero
         * @throws DriverException
180 527 vcaballero
         */
181 10627 caballero
        public int getFieldCount() throws ReadDriverException {
182 4863 fjp
                // return dataSource.getFieldCount()-numVirtual;
183 6478 fjp
//                if (mapping.length != dataSource.getFieldCount())
184
//                {
185
//                        mapExternalFields();
186
//                        RuntimeException e = new RuntimeException("Recalculamos los campos de recordset!!");
187
//                        e.printStackTrace();
188
//                }
189 4863 fjp
                return mapping.length;
190 460 fernando
        }
191 527 vcaballero
192
        /**
193 7631 fjp
         * Return index field searching by its name
194 527 vcaballero
         *
195 7631 fjp
         * @param arg0 field name.
196 527 vcaballero
         *
197 7631 fjp
         * @return field index. -1 if not found
198 527 vcaballero
         *
199 1034 vcaballero
         * @throws DriverException
200
         * @throws FieldNotFoundException
201 527 vcaballero
         */
202
        public int getFieldIndexByName(String arg0)
203 10627 caballero
                throws ReadDriverException {
204 4863 fjp
                int internal = dataSource.getFieldIndexByName(arg0);
205
                for (int i=0; i < mapping.length; i++)
206
                {
207
                        if (mapping[i] == internal)
208
                                return i;
209
                }
210
                return -1;
211 460 fernando
        }
212 527 vcaballero
213
        /**
214 1034 vcaballero
         * Devuelve el nombre del campo a partir del ?ndice.
215 527 vcaballero
         *
216 1034 vcaballero
         * @param arg0 ?ndice.
217 527 vcaballero
         *
218 1034 vcaballero
         * @return nombre del campo.
219 527 vcaballero
         *
220 1034 vcaballero
         * @throws DriverException
221 527 vcaballero
         */
222 10627 caballero
        public String getFieldName(int arg0) throws ReadDriverException {
223 4863 fjp
            // return dataSource.getFieldName(arg0);
224
                return dataSource.getFieldName(mapping[arg0]);
225 460 fernando
        }
226 527 vcaballero
227
        /**
228 1034 vcaballero
         * Devuelve el valor a partir del n?mro de fila y columna.
229 527 vcaballero
         *
230 1034 vcaballero
         * @param arg0 n?mero de registro.
231
         * @param arg1 n?mero de campo.
232 527 vcaballero
         *
233 1034 vcaballero
         * @return Valor.
234 527 vcaballero
         *
235 1034 vcaballero
         * @throws DriverException
236 527 vcaballero
         */
237 10627 caballero
        public Value getFieldValue(long arg0, int arg1) throws ReadDriverException {
238 4863 fjp
                return dataSource.getFieldValue(arg0, mapping[arg1]);
239
                // return dataSource.getFieldValue(arg0, arg1);
240 460 fernando
        }
241 527 vcaballero
242
        /**
243 1034 vcaballero
         * Devuelve el nombre del DataSource.
244 527 vcaballero
         *
245 1034 vcaballero
         * @return Nombre.
246 527 vcaballero
         */
247 460 fernando
        public String getName() {
248
                return dataSource.getName();
249
        }
250 527 vcaballero
251
        /**
252 2565 fernando
         * Devuelve el n?mero de filas en total.
253 527 vcaballero
         *
254 1034 vcaballero
         * @return n?mero de filas.
255 527 vcaballero
         *
256 1034 vcaballero
         * @throws DriverException
257 527 vcaballero
         */
258 10627 caballero
        public long getRowCount() throws ReadDriverException {
259 460 fernando
                return dataSource.getRowCount();
260
        }
261 527 vcaballero
262
        /**
263 1034 vcaballero
         * Inicializa el dataSource.
264 527 vcaballero
         *
265 1034 vcaballero
         * @throws DriverException
266 527 vcaballero
         */
267 10627 caballero
        public void start() throws ReadDriverException {
268 3076 fjp
                // logger.debug("dataSource.start()");
269 460 fernando
                dataSource.start();
270
        }
271 527 vcaballero
272
        /**
273 1034 vcaballero
         * Finaliza el DataSource.
274 527 vcaballero
         *
275 1034 vcaballero
         * @throws DriverException
276 527 vcaballero
         */
277 10627 caballero
        public void stop() throws ReadDriverException {
278 3076 fjp
                // logger.debug("dataSource.stop()");
279 460 fernando
                dataSource.stop();
280
        }
281
282
        /**
283 2183 fernando
         * A partir del XMLEntity se rellenan los atributos del DataSource.
284
         *
285
         * @param child
286
         */
287
        public void setXMLEntity03(XMLEntity child) {
288
                selectionSupport.setXMLEntity(child.getChild(0));
289
        }
290
291
        /**
292 527 vcaballero
         * Cuando ocurre un evento de cambio en la selecci?n, ?ste puede ser uno de
293
         * una gran cantidad de eventos. Con el fin de no propagar todos estos
294
         * eventos, se realiza la propagaci?n de manera manual al final de la
295
         * "r?faga" de eventos
296 460 fernando
         */
297
        public void fireSelectionEvents() {
298
                selectionSupport.fireSelectionEvents();
299
        }
300
301 527 vcaballero
        /**
302 1034 vcaballero
         * A?ade un nuevo Listener al SelectionSupport.
303 527 vcaballero
         *
304 1034 vcaballero
         * @param listener SelectionListener.
305 527 vcaballero
         */
306 460 fernando
        public void addSelectionListener(SelectionListener listener) {
307
                selectionSupport.addSelectionListener(listener);
308
        }
309
310 527 vcaballero
        /**
311 1034 vcaballero
         * Borra un Listener al SelectionSupport.
312 527 vcaballero
         *
313 1034 vcaballero
         * @param listener Listener a borrar.
314 527 vcaballero
         */
315 460 fernando
        public void removeSelectionListener(SelectionListener listener) {
316
                selectionSupport.removeSelectionListener(listener);
317
        }
318 527 vcaballero
319
        /**
320 1034 vcaballero
         * Borra la selecci?n.
321 527 vcaballero
         */
322 460 fernando
        public void clearSelection() {
323
                selectionSupport.clearSelection();
324
        }
325 527 vcaballero
326
        /**
327 1034 vcaballero
         * Develve un FBitSet con los ?ndices de los elementos seleccionados.
328 527 vcaballero
         *
329 1034 vcaballero
         * @return FBitset con los elementos seleccionados.
330 527 vcaballero
         */
331 884 fernando
        public FBitSet getSelection() {
332 460 fernando
                return selectionSupport.getSelection();
333
        }
334 1034 vcaballero
335
        /**
336
         * Devuelve el SelectionSupport.
337
         *
338
         * @return SelectinSuport.
339
         */
340
        public SelectionSupport getSelectionSupport() {
341 581 vcaballero
                return selectionSupport;
342
        }
343 1034 vcaballero
344 527 vcaballero
        /**
345 1034 vcaballero
         * Devuelve true si el elemento est? seleccionado.
346 527 vcaballero
         *
347 1034 vcaballero
         * @param recordIndex ?ndice del registro.
348 527 vcaballero
         *
349 1034 vcaballero
         * @return True si el registro est? seleccionado.
350 527 vcaballero
         */
351 460 fernando
        public boolean isSelected(int recordIndex) {
352
                return selectionSupport.isSelected(recordIndex);
353
        }
354 527 vcaballero
355
        /**
356 1034 vcaballero
         * Inserta una nueva selecci?n.
357 527 vcaballero
         *
358 1034 vcaballero
         * @param selection FBitSet.
359 527 vcaballero
         */
360 683 fernando
        public void setSelection(FBitSet selection) {
361 460 fernando
                selectionSupport.setSelection(selection);
362
        }
363 546 fernando
364 1828 fernando
        private void putMemento(XMLEntity xml) throws XMLException {
365
                try {
366 1836 fernando
                        GDBMSHandler handler = new GDBMSHandler();
367
                        Memento m = getMemento();
368
                        m.setContentHandler(handler);
369
                        m.getXML();
370
                        XMLEntity child = handler.getXMLEntity();
371 3963 caballero
372 1828 fernando
                        xml.addChild(child);
373
                } catch (MementoException e) {
374
                        throw new XMLException(e);
375 1836 fernando
                } catch (SAXException e) {
376
                        throw new XMLException(e);
377 1828 fernando
                }
378
        }
379
380 1034 vcaballero
        /**
381
         * Devuelve el XMLEntity con la informaci?n necesaria para reproducir el
382
         * DataSource.
383
         *
384
         * @return XMLEntity.
385 1828 fernando
         * @throws XMLException
386 1034 vcaballero
         */
387 1828 fernando
        public XMLEntity getXMLEntity() throws XMLException {
388 1034 vcaballero
                XMLEntity xml = new XMLEntity();
389 1094 vcaballero
                xml.putProperty("className",this.getClass().getName());
390 581 vcaballero
                xml.addChild(selectionSupport.getXMLEntity());
391 1828 fernando
                putMemento(xml);
392 1034 vcaballero
393 581 vcaballero
                return xml;
394
        }
395 732 fernando
396
        /**
397 884 fernando
         * @see com.hardcode.gdbms.engine.data.DataSource#getWhereFilter()
398
         */
399
        public long[] getWhereFilter() throws IOException {
400
                return dataSource.getWhereFilter();
401
        }
402 1653 fernando
403
        /**
404
         * @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldType(int)
405
         */
406 10627 caballero
        public int getFieldType(int i) throws ReadDriverException {
407 4863 fjp
                // return dataSource.getFieldType(i);
408
                return dataSource.getFieldType(mapping[i]);
409 1653 fernando
        }
410 1828 fernando
411
        /**
412
         * @see com.hardcode.gdbms.engine.data.DataSource#getDataSourceFactory()
413
         */
414
        public DataSourceFactory getDataSourceFactory() {
415
                return dataSource.getDataSourceFactory();
416
        }
417
418
        /**
419
         * @see com.hardcode.gdbms.engine.data.DataSource#getAsString()
420
         */
421 10627 caballero
        public String getAsString() throws ReadDriverException {
422 1828 fernando
                return dataSource.getAsString();
423
        }
424 1831 fernando
425
        /**
426 2183 fernando
         * @throws DriverException
427 1831 fernando
         * @see com.hardcode.gdbms.engine.data.DataSource#remove()
428
         */
429 10627 caballero
        public void remove() throws WriteDriverException {
430 1831 fernando
                dataSource.remove();
431
        }
432 1836 fernando
433
        /**
434
         * @see com.hardcode.gdbms.engine.data.DataSource#getMemento()
435
         */
436
        public Memento getMemento() throws MementoException {
437
                return dataSource.getMemento();
438
        }
439
440
        /**
441
         * @see com.hardcode.gdbms.engine.data.DataSource#getSourceInfo()
442
         */
443 2217 fernando
        public SourceInfo getSourceInfo() {
444 1836 fernando
                return dataSource.getSourceInfo();
445
        }
446 2183 fernando
447
    /**
448
     * @see com.hardcode.gdbms.engine.data.DataSource#getPrimaryKeys()
449
     */
450 10627 caballero
    public int[] getPrimaryKeys() throws ReadDriverException {
451 2183 fernando
            return dataSource.getPrimaryKeys();
452
    }
453
454
    /**
455
     * @see com.hardcode.gdbms.engine.data.DataSource#getPKValue(long)
456
     */
457 10627 caballero
    public ValueCollection getPKValue(long rowIndex) throws ReadDriverException {
458 2183 fernando
        return dataSource.getPKValue(rowIndex);
459
    }
460
461
    /**
462
     * @see com.hardcode.gdbms.engine.data.DataSource#getPKName(int)
463
     */
464 10627 caballero
    public String getPKName(int fieldId) throws ReadDriverException {
465 2183 fernando
        return dataSource.getPKName(fieldId);
466
    }
467
468
    /**
469
     * @see com.hardcode.gdbms.engine.data.DataSource#getPKType(int)
470
     */
471 10627 caballero
    public int getPKType(int i) throws ReadDriverException {
472 2183 fernando
        return dataSource.getPKType(i);
473
    }
474
475
    /**
476
     * @throws DriverException
477
     * @see com.hardcode.gdbms.engine.data.DataSource#getPKCardinality()
478
     */
479 10627 caballero
    public int getPKCardinality() throws ReadDriverException {
480 2183 fernando
        return dataSource.getPKCardinality();
481
    }
482
483
    /**
484
     * @see com.hardcode.gdbms.engine.data.DataSource#getRow(long)
485
     */
486 10627 caballero
    public Value[] getRow(long rowIndex) throws ReadDriverException {
487 4863 fjp
            Value[] withoutVirtuals = new Value[mapping.length];
488
            Value[] internal = dataSource.getRow(rowIndex);
489
            for (int i=0; i < mapping.length; i++)
490
            {
491
                    withoutVirtuals[i] = internal[mapping[i]];
492 10627 caballero
493 4863 fjp
            }
494
        return withoutVirtuals;
495 2183 fernando
    }
496
497
    /**
498
     * @see com.hardcode.gdbms.engine.data.DataSource#getFieldNames()
499
     */
500 10627 caballero
    public String[] getFieldNames() throws ReadDriverException {
501 4863 fjp
            String[] fieldNames = new String[getFieldCount()];
502
                int j=0;
503
                for (int i=0; i < dataSource.getFieldCount(); i++)
504
                {
505
                        if (!dataSource.isVirtualField(i))
506
                                fieldNames[j++] = dataSource.getFieldName(i);
507 10627 caballero
508 4863 fjp
                }
509
        // return dataSource.getFieldNames();
510
            return fieldNames;
511 2183 fernando
    }
512
513
    /**
514
     * @see com.hardcode.gdbms.engine.data.DataSource#getPKNames()
515
     */
516 10627 caballero
    public String[] getPKNames() throws ReadDriverException {
517 2183 fernando
        return dataSource.getPKNames();
518
    }
519
520
        public void removeLinksSelectionListener() {
521
                selectionSupport.removeLinkSelectionListener();
522
        }
523 2217 fernando
524
    /**
525 10627 caballero
     * @throws DriverException
526 2217 fernando
     * @see com.hardcode.gdbms.engine.data.DataSource#getDataWare(int)
527
     */
528 10627 caballero
    public DataWare getDataWare(int arg0) throws ReadDriverException {
529 2217 fernando
        return dataSource.getDataWare(arg0);
530
    }
531 4863 fjp
532 10627 caballero
        public int getFieldWidth(int i) throws ReadDriverException {
533 4863 fjp
                return dataSource.getFieldWidth(mapping[i]);
534
                // return dataSource.getFieldWidth(i);
535
        }
536
537 10627 caballero
        public boolean isVirtualField(int fieldId) throws ReadDriverException {
538 4863 fjp
                return dataSource.isVirtualField(fieldId);
539
        }
540 10627 caballero
541 4875 fjp
        /**
542
         * Useful to writers, to know the field definitions.
543
         * NOTE: Maximun precision: 6 decimals. (We may need to change this)
544
         * @return Description of non virtual fields
545
         * @throws DriverException
546
         */
547 10627 caballero
        public FieldDescription[] getFieldsDescription() throws ReadDriverException{
548 4875 fjp
                int numFields = getFieldCount();
549
                FieldDescription[] fieldsDescrip = new FieldDescription[numFields];
550
                for (int i = 0; i < numFields; i++) {
551
                        fieldsDescrip[i] = new FieldDescription();
552
                        int type = getFieldType(i);
553
                        fieldsDescrip[i].setFieldType(type);
554
                        fieldsDescrip[i].setFieldName(getFieldName(i));
555
                        fieldsDescrip[i].setFieldLength(getFieldWidth(i));
556 6483 fjp
                        if (NumberUtilities.isNumeric(type))
557
                        {
558
                                if (!NumberUtilities.isNumericInteger(type))
559
                                        // TODO: If there is a lost in precision, this should be changed.
560
                                        fieldsDescrip[i].setFieldDecimalCount(6);
561
                        }
562
                        else
563 4875 fjp
                                fieldsDescrip[i].setFieldDecimalCount(0);
564 6628 fjp
                        // TODO: ?DEFAULTVALUE?
565
                        // fieldsDescrip[i].setDefaultValue(get)
566 4875 fjp
                }
567
                return fieldsDescrip;
568
        }
569 5569 jmvivo
570 10627 caballero
        public Driver getDriver() {
571 5569 jmvivo
                return this.dataSource.getDriver();
572
        }
573 6323 fjp
574 10627 caballero
        public void reload() throws ReloadDriverException {
575 6323 fjp
                dataSource.reload();
576 10627 caballero
                try {
577
                        mapExternalFields();
578
                } catch (ReadDriverException e) {
579
                        throw new ReloadDriverException(getDriver().getName(),e);
580
                }
581
582 6323 fjp
        }
583
584
        public void addDataSourceListener(IDataSourceListener listener) {
585
                dataSource.addDataSourceListener(listener);
586 10627 caballero
587 6323 fjp
        }
588
589
        public void removeDataSourceListener(IDataSourceListener listener) {
590
                dataSource.removeDataSourceListener(listener);
591 10627 caballero
592 6323 fjp
        }
593 460 fernando
}