01: /*
02: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
03: * for visualizing and manipulating spatial features with geometry and attributes.
04: *
05: * Copyright (C) 2003 Vivid Solutions
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: *
21: * For more information, contact:
22: *
23: * Vivid Solutions
24: * Suite #1A
25: * 2328 Government Street
26: * Victoria BC V8T 5G5
27: * Canada
28: *
29: * (250)385-6040
30: * www.vividsolutions.com
31: */
32: package com.vividsolutions.jump.io.datasource;
33:
34: import java.util.Collection;
35:
36: import com.vividsolutions.jump.feature.FeatureCollection;
37: import com.vividsolutions.jump.task.TaskMonitor;
38:
39: /**
40: * A channel of communication with a DataSource.
41: */
42: public interface Connection {
43: /**
44: * Returns from a DataSource a dataset specified using a query string (the format
45: * of which is implementation-dependent). Callers: be sure to call
46: * DataSource#setCoordinateSystem on the returned FeatureCollection.
47: * @param query identifies the dataset; may take the form of a SQL statement,
48: * a table name, null (if there is only one dataset), or other format
49: * @param exceptions a Collection to hold exceptions that occurred (so that processing can continue).
50: * @return null if a FeatureCollection could not be created because of a serious
51: * problem (indicated in the exceptions)
52: */
53: public FeatureCollection executeQuery(String query,
54: Collection exceptions, TaskMonitor monitor);
55:
56: /**
57: * Returns from a DataSource a dataset specified using a query string (the format
58: * of which is implementation-dependent). If an exception occurs, processing
59: * is stopped and the exception thrown. Callers: be sure to call
60: * DataSource#setCoordinateSystem on the returned FeatureCollection.
61: */
62: public FeatureCollection executeQuery(String query,
63: TaskMonitor monitor) throws Exception;
64:
65: /**
66: * Modifies data in the DataSource accordinate to a query string (the format of
67: * which is implementation-dependent).
68: */
69: public void executeUpdate(String query,
70: FeatureCollection featureCollection, TaskMonitor monitor)
71: throws Exception;
72:
73: /**
74: * Ends the connection, performing any necessary cleanup.
75: */
76: public void close();
77: }
|