001: /*
002: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003: * for visualizing and manipulating spatial features with geometry and attributes.
004: *
005: * Copyright (C) 2003 Vivid Solutions
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: *
021: * For more information, contact:
022: *
023: * Vivid Solutions
024: * Suite #1A
025: * 2328 Government Street
026: * Victoria BC V8T 5G5
027: * Canada
028: *
029: * (250)385-6040
030: * www.vividsolutions.com
031: */
032: package com.vividsolutions.jump.io.datasource;
033:
034: /**
035: * A wrapper for a query string that attributes it with the DataSource
036: * to apply it against.
037: */
038: public class DataSourceQuery {
039:
040: private String name;
041:
042: /**
043: * Constructs a DataSourceQuery that wraps a query string
044: * (implementation-dependent) and a DataSource to apply it against.
045: *
046: * @param query
047: * identifies the dataset; may take the form of a SQL statement,
048: * a table name, null (if there is only one dataset), or other
049: * format
050: * @param name
051: * will be used for the layer name
052: */
053: public DataSourceQuery(DataSource dataSource, String query,
054: String name) {
055: this .dataSource = dataSource;
056: this .query = query;
057: this .name = name;
058: }
059:
060: /**
061: * Parameterless constructor called by Java2XML
062: */
063: public DataSourceQuery() {
064: }
065:
066: private DataSource dataSource;
067: private String query;
068:
069: /**
070: * Returns the DataSource against which to apply the
071: * (implementation-dependent) query string.
072: */
073: public DataSource getDataSource() {
074: return dataSource;
075: }
076:
077: /**
078: * Returns the implementation-dependent query string wrapped by this
079: * DataSourceQuery
080: */
081: public String getQuery() {
082: return query;
083: }
084:
085: /**
086: * Returns the name of this DataSourceQuery, suitable for use as a layer name.
087: */
088: public String toString() {
089: return name;
090: }
091:
092: /**
093: * Called by Java2XML
094: */
095: public void setDataSource(DataSource dataSource) {
096: this .dataSource = dataSource;
097: }
098:
099: /**
100: * Called by Java2XML
101: */
102: public void setQuery(String query) {
103: this.query = query;
104: }
105:
106: }
|