Statistics
| Revision:

root / trunk / libraries / libGPE / src / org / gvsig / gpe / GPEParser.java @ 11247

History | View | Annotate | Download (3.6 KB)

1 11118 csanchez
package org.gvsig.gpe;
2
import java.io.File;
3 11156 jorpiell
import java.io.FileNotFoundException;
4
import java.io.IOException;
5 11118 csanchez
6 11178 jorpiell
import org.gvsig.gpe.writers.GPEWriterHandler;
7 11118 csanchez
8 11156 jorpiell
9 11118 csanchez
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53 11247 jorpiell
 * Revision 1.8  2007-04-19 07:23:20  jorpiell
54
 * Add the add methods to teh contenhandler and change the register mode
55
 *
56
 * Revision 1.7  2007/04/14 16:06:13  jorpiell
57 11208 jorpiell
 * The writer handler has been updated
58
 *
59
 * Revision 1.6  2007/04/13 07:17:54  jorpiell
60 11178 jorpiell
 * Add the writting tests for the simple geometries
61
 *
62
 * Revision 1.5  2007/04/12 17:06:42  jorpiell
63 11171 jorpiell
 * First GML writing tests
64
 *
65
 * Revision 1.4  2007/04/12 10:21:29  jorpiell
66 11156 jorpiell
 * Add the getWriter() method
67
 *
68
 * Revision 1.3  2007/04/11 11:18:15  csanchez
69 11121 csanchez
 * Actualizacion protoripo libGPE
70
 *
71 11128 csanchez
 * Revision 1.2  2007/04/11 08:46:21  csanchez
72
 * Actualizacion protoripo libGPE
73
 *
74 11121 csanchez
 * Revision 1.1  2007/04/11 08:19:32  csanchez
75 11118 csanchez
 * actualizacion
76
 *
77
 *
78
 */
79
/**
80
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
81
 */
82
83 11121 csanchez
84 11118 csanchez
public abstract class GPEParser {
85 11121 csanchez
        private GPEErrorHandler errorHandler;
86
        private GPEContentHandler contentHandler;
87 11118 csanchez
88
        /**
89 11247 jorpiell
         * All the GPE parser must implement a constructor without
90
         * arguments.
91 11118 csanchez
         **/
92 11247 jorpiell
        public GPEParser(){
93
94 11121 csanchez
        }
95 11128 csanchez
96 11247 jorpiell
        /**
97
         * Method to parse a file. It have to be implemented by all
98
         * the GPE Parsers. It cannot to throw any exception and it
99
         * cannot to return any value. In a future it could be
100
         * implemented like a independent thread
101
         * @param contents
102
         * Application ContentHandler
103
         * @param errors
104
         * Application ErrorsHandler
105
         * @param file
106
         * File to open
107
         * @throws Exception
108
         */
109
        public void parse(GPEContentHandler contents, GPEErrorHandler errors, File file) {
110
                this.contentHandler = contents;
111
                this.errorHandler = errors;
112 11118 csanchez
        }
113
114 11156 jorpiell
        /**
115
         * Return if the driver can open the file
116
         * @param file
117
         * File to open
118
         * @return
119
         * True if the driver is able to open it
120
         */
121
        public abstract boolean accept(File file);
122 11118 csanchez
123 11156 jorpiell
        /**
124
         * Return an array with all the formats that the driver
125
         * is able to read/write
126
         * @return
127
         */
128
        public abstract String[] getFormats();
129 11247 jorpiell
130 11156 jorpiell
        /**
131 11247 jorpiell
         * Return an array with all the versions that the driver
132
         * is able to read/write
133
         * @return
134 11156 jorpiell
         */
135 11247 jorpiell
        public abstract String[] getVersions();
136 11156 jorpiell
137
        /**
138
         * @return the contentHandler
139
         */
140
        public GPEContentHandler getContentHandler() {
141
                return contentHandler;
142
        }
143
144
145
        /**
146
         * @return the errorHandler
147
         */
148
        public GPEErrorHandler getErrorHandler() {
149
                return errorHandler;
150
        }
151
152
153 11118 csanchez
}