001: /*
002: * JMLReader.java
003: *
004: * Created on July 12, 2002, 3:00 PM
005: */
006: /*
007: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
008: * for visualizing and manipulating spatial features with geometry and attributes.
009: *
010: * Copyright (C) 2003 Vivid Solutions
011: *
012: * This program is free software; you can redistribute it and/or
013: * modify it under the terms of the GNU General Public License
014: * as published by the Free Software Foundation; either version 2
015: * of the License, or (at your option) any later version.
016: *
017: * This program is distributed in the hope that it will be useful,
018: * but WITHOUT ANY WARRANTY; without even the implied warranty of
019: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
020: * GNU General Public License for more details.
021: *
022: * You should have received a copy of the GNU General Public License
023: * along with this program; if not, write to the Free Software
024: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
025: *
026: * For more information, contact:
027: *
028: * Vivid Solutions
029: * Suite #1A
030: * 2328 Government Street
031: * Victoria BC V8T 5G5
032: * Canada
033: *
034: * (250)385-6040
035: * www.vividsolutions.com
036: */
037:
038: package com.vividsolutions.jump.io;
039:
040: import com.vividsolutions.jump.feature.FeatureCollection;
041:
042: /**
043: * JMLReader is a {@link JUMPReader} specialized to read JML.
044: *
045: * <p>
046: * This is a simple class that passes the work off to the {@link GMLReader } class which
047: * already has support for auto-generating a JML input template
048: * (see {@link GMLInputTemplate}).
049: * </p>
050: *
051: * <p>
052: * DataProperties for the JMLReader load(DataProperties) interface:<br><br>
053: * </p>
054: *
055: * <table border='1' cellspacing='0' cellpadding='4'>
056: * <tr>
057: * <th>Parameter</th>
058: * <th>Meaning</th>
059: * </tr>
060: * <tr>
061: * <td>File or DefaultValue</td>
062: * <td>File name for the input JML file</td>
063: * </tr>
064: * <tr>
065: * <td>CompressedFile</td>
066: * <td>
067: * File name (a .zip or .gz) with a .jml/.xml/.gml inside (specified by
068: * File)
069: * </td>
070: * </tr>
071: * <tr>
072: * <td>CompressedFileTemplate</td>
073: * <td>
074: * File name (.zip or .gz) with the input template in (specified by
075: * InputTemplateFile)
076: * </td>
077: * </tr>
078: * </table>
079: * <br>
080: * <br>
081: */
082: public class JMLReader implements JUMPReader {
083: /** Creates new JMLReader */
084: public JMLReader() {
085: }
086:
087: /**
088: * Read a JML file - passes the work off to {@link GMLReader}.
089: *
090: *@param dp 'InputFile' or 'DefaultValue' for the input JML file
091: */
092: public FeatureCollection read(DriverProperties dp)
093: throws IllegalParametersException, Exception {
094: GMLReader gmlReader;
095: String inputFname;
096:
097: inputFname = dp.getProperty("File");
098:
099: if (inputFname == null) {
100: inputFname = dp.getProperty("DefaultValue");
101: }
102:
103: if (inputFname == null) {
104: throw new IllegalParametersException(
105: "call to JMLReader.read() has DataProperties w/o a InputFile specified");
106: }
107:
108: gmlReader = new GMLReader();
109:
110: return gmlReader.read(dp);
111: }
112: }
|