001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * Created on 31-mar-2004
017: */
018: package org.geotools.data.jdbc;
019:
020: import java.util.Collections;
021: import java.util.HashMap;
022: import java.util.Map;
023:
024: import org.geotools.data.jdbc.fidmapper.FIDMapper;
025: import org.geotools.feature.FeatureType;
026:
027: /**
028: * Stores information about known FeatureTypes.
029: *
030: * @author Sean Geoghegan, Defence Science and Technology Organisation.
031: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/jdbc/src/main/java/org/geotools/data/jdbc/FeatureTypeInfo.java $
032: */
033: public class FeatureTypeInfo {
034: private String featureTypeName;
035: private FeatureType schema;
036: private Map sridMap = new HashMap();
037: private FIDMapper mapper;
038:
039: public FeatureTypeInfo(String typeName, FeatureType schema,
040: FIDMapper mapper) {
041: this .featureTypeName = typeName;
042: this .schema = schema;
043: this .mapper = mapper;
044: }
045:
046: /**
047: * DOCUMENT ME!
048: *
049: */
050: public String getFeatureTypeName() {
051: return featureTypeName;
052: }
053:
054: /**
055: * DOCUMENT ME!
056: *
057: */
058: public FeatureType getSchema() {
059: return schema;
060: }
061:
062: /**
063: * Get the DataStore specific SRID for a geometry column
064: *
065: * @param geometryAttributeName The name of the Geometry column to get the srid for.
066: *
067: * @return The srid of the geometry column. This will only be present if
068: * determineSRID(String) of JDBCDataStore has been overridden. If there is no
069: * SRID registered -1 will be returned.
070: */
071: public int getSRID(String geometryAttributeName) {
072: int srid = -1;
073:
074: Integer integer = (Integer) sridMap.get(geometryAttributeName);
075:
076: if (integer != null) {
077: srid = integer.intValue();
078: }
079:
080: return srid;
081: }
082:
083: public Map getSRIDs() {
084: return Collections.unmodifiableMap(sridMap);
085: }
086:
087: /**
088: * Puts the srid for a geometry column in the internal map.
089: *
090: * @param geometryColumnName The geometry column name.
091: * @param srid The SRID of the geometry column.
092: */
093: void putSRID(String geometryColumnName, int srid) {
094: sridMap.put(geometryColumnName, new Integer(srid));
095: }
096:
097: public String toString() {
098: return "typeName = " + featureTypeName + " schema: " + schema
099: + "srids: " + sridMap;
100: }
101:
102: /**
103: */
104: public FIDMapper getFIDMapper() {
105: return mapper;
106: }
107:
108: /**
109: * @param mapper
110: */
111: public void setFIDMapper(FIDMapper mapper) {
112: this.mapper = mapper;
113: }
114:
115: }
|