Statistics
| Revision:

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

History | View | Annotate | Download (3.83 KB)

1
package org.gvsig.gpe;
2
import java.io.File;
3

    
4

    
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
/* CVS MESSAGES:
46
 *
47
 * $Id: GPEParser.java 11302 2007-04-20 12:04:10Z csanchez $
48
 * $Log$
49
 * Revision 1.10  2007-04-20 12:04:10  csanchez
50
 * Actualizacion protoripo libGPE, A?adidos test para el parser, parseo con XSOM
51
 *
52
 * Revision 1.9  2007/04/19 11:50:20  csanchez
53
 * Actualizacion protoripo libGPE
54
 *
55
 * Revision 1.8  2007/04/19 07:23:20  jorpiell
56
 * Add the add methods to teh contenhandler and change the register mode
57
 *
58
 * Revision 1.7  2007/04/14 16:06:13  jorpiell
59
 * The writer handler has been updated
60
 *
61
 * Revision 1.6  2007/04/13 07:17:54  jorpiell
62
 * Add the writting tests for the simple geometries
63
 *
64
 * Revision 1.5  2007/04/12 17:06:42  jorpiell
65
 * First GML writing tests
66
 *
67
 * Revision 1.4  2007/04/12 10:21:29  jorpiell
68
 * Add the getWriter() method
69
 *
70
 * Revision 1.3  2007/04/11 11:18:15  csanchez
71
 * Actualizacion protoripo libGPE
72
 *
73
 * Revision 1.2  2007/04/11 08:46:21  csanchez
74
 * Actualizacion protoripo libGPE
75
 *
76
 * Revision 1.1  2007/04/11 08:19:32  csanchez
77
 * actualizacion
78
 *
79
 *
80
 */
81
/**
82
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
83
 */
84

    
85

    
86
public abstract class GPEParser {
87
        private GPEErrorHandler errorHandler;
88
        private GPEContentHandler contentHandler;
89
        private File mainFile;
90
        
91
        /** 
92
         * All the GPE parser must implement a constructor without 
93
         * arguments.
94
         **/
95
        public GPEParser(){
96
        
97
        }
98
        
99
        /**
100
         * Method to parse a file. It have to be implemented by all 
101
         * the GPE Parsers. It cannot to throw any exception and it
102
         * cannot to return any value. In a future it could be 
103
         * implemented like a independent thread
104
         * @param contents
105
         * Application ContentHandler
106
         * @param errors
107
         * Application ErrorsHandler
108
         * @param file
109
         * File to open
110
         * @throws Exception
111
         */
112
        public void parse(GPEContentHandler contents, GPEErrorHandler errors, File file) {
113
                this.contentHandler = contents;
114
                this.errorHandler = errors;
115
                this.mainFile = file;
116
        }
117
        
118
        /**
119
         * Return if the driver can open the file
120
         * @param file
121
         * File to open
122
         * @return
123
         * True if the driver is able to open it
124
         */
125
        public abstract boolean accept(File file);
126

    
127
        /**
128
         * Return an array with all the formats that the driver
129
         * is able to read/write
130
         * @return
131
         */
132
        public abstract String[] getFormats();
133
                
134
        /**
135
         * Return an array with all the versions that the driver
136
         * is able to read/write
137
         * @return
138
         */
139
        public abstract String[] getVersions();
140
        
141
        /**
142
         * @return the contentHandler
143
         */
144
        public GPEContentHandler getContentHandler() {
145
                return contentHandler;
146
        }
147

    
148

    
149
        /**
150
         * @return the errorHandler
151
         */
152
        public GPEErrorHandler getErrorHandler() {
153
                return errorHandler;
154
        }
155

    
156
        /**
157
         * @return the file
158
         */
159
        public File getMainFile() {
160
                return mainFile;
161
        }
162

    
163
}