Statistics
| Revision:

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

History | View | Annotate | Download (3.57 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 11265 2007-04-19 11:56:03Z csanchez $
48
 * $Log$
49
 * Revision 1.9  2007-04-19 11:50:20  csanchez
50
 * Actualizacion protoripo libGPE
51
 *
52
 * Revision 1.8  2007/04/19 07:23:20  jorpiell
53
 * Add the add methods to teh contenhandler and change the register mode
54
 *
55
 * Revision 1.7  2007/04/14 16:06:13  jorpiell
56
 * The writer handler has been updated
57
 *
58
 * Revision 1.6  2007/04/13 07:17:54  jorpiell
59
 * Add the writting tests for the simple geometries
60
 *
61
 * Revision 1.5  2007/04/12 17:06:42  jorpiell
62
 * First GML writing tests
63
 *
64
 * Revision 1.4  2007/04/12 10:21:29  jorpiell
65
 * Add the getWriter() method
66
 *
67
 * Revision 1.3  2007/04/11 11:18:15  csanchez
68
 * Actualizacion protoripo libGPE
69
 *
70
 * Revision 1.2  2007/04/11 08:46:21  csanchez
71
 * Actualizacion protoripo libGPE
72
 *
73
 * Revision 1.1  2007/04/11 08:19:32  csanchez
74
 * actualizacion
75
 *
76
 *
77
 */
78
/**
79
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
80
 */
81

    
82

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

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

    
143

    
144
        /**
145
         * @return the errorHandler
146
         */
147
        public GPEErrorHandler getErrorHandler() {
148
                return errorHandler;
149
        }
150
        
151

    
152
}