01: package org.geotools.data.sql;
02:
03: import java.io.IOException;
04:
05: import net.sf.jsqlparser.statement.select.PlainSelect;
06: import net.sf.jsqlparser.statement.select.SelectBody;
07: import net.sf.jsqlparser.statement.select.Union;
08:
09: import org.geotools.data.DataStore;
10:
11: /**
12: * An extension to the {@link org.geotools.data.DataStore} interface that adds
13: * the ability of registering a FeatureType as a SQL SELECT construct
14: * against featuretypes and/or normal table like data that the DataStore could deal with.
15: * <p>
16: * A DataStore implementing this interface does not necesarilly has to be backed
17: * by a RDBMS. Implementing this interface only means that the DataStore _is able_ to
18: * expose a non existent FeatureType in its backend, by somehow executing the
19: * SQL STATEMENT represented by the sql selct object model passed to {@link #registerView(String, PlainSelect)}
20: * or {@link #registerView(String, Union)}.
21: * </p>
22: * <p>
23: * Implementing datastores are free to support only a subset of the SQL constructs
24: * that may be used to create a full SELECT statement.
25: * </p>
26: *
27: * @author Gabriel Roldan, Axios Engineering
28: * @version $Id: SqlDataStore.java 25699 2007-05-31 15:55:07Z desruisseaux $
29: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/community-schemas/sql-datastore/src/org/geotools/data/sql/SqlDataStore.java $
30: * @since 2.3.x
31: */
32: public interface SqlDataStore extends DataStore {
33:
34: /**
35: * Creates an in-process data view against one or more actual FeatureTypes
36: * of this DataStore, which will be advertised as <code>typeName</code>
37: *
38: * @param typeName the name of the view's FeatureType.
39: * @param sqlQuery a full SQL query which will act as the view definition.
40: * @throws IOException
41: */
42: void registerView(String typeName, String sqlQuery)
43: throws IOException, UnsupportedOperationException;
44:
45: /**
46: * Indicates to this DataStore that it has to expose a FeatureType named
47: * <code>typeName</code> whose schema is to be determined by the sql like
48: * query <code>select</code>, and that query has to be used to retrieve
49: * content, plus any filter given over the feature type.
50: *
51: * <p>
52: * On registering a view, an implementing datastore must ensure that it
53: * supports all the constructs provided in the query definition and that
54: * it is valid against its domain of AttributeTypes (i.e., could execute
55: * the query to ensure the backend can deal with it)
56: * </p>
57: *
58: * @param typeName
59: * @param select either an instance of {@link PlainSelect} or {@link Union}
60: * @throws IOException
61: * @throws UnsupportedOperationException if the <code>select</code> construct
62: * type is not supported or contains components that are not supported
63: * (for example, subselects, etc)
64: */
65: void registerView(String typeName, SelectBody select)
66: throws IOException, UnsupportedOperationException;
67: }
|