001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-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: package org.geotools.data.postgis.fidmapper;
017:
018: import java.io.IOException;
019: import java.sql.Connection;
020: import java.sql.Statement;
021:
022: import org.geotools.data.jdbc.fidmapper.FIDMapper;
023: import org.geotools.feature.Feature;
024:
025: /**
026: * A custom fid mapper to be used for versioned feature collections
027: * @author Andrea Aime - TOPP
028: */
029: class VersionedFeatureCollectionFidMapper implements VersionedFIDMapper {
030: VersionedFIDMapper wrapped;
031:
032: public VersionedFeatureCollectionFidMapper(
033: VersionedFIDMapper wrapped) {
034: this .wrapped = wrapped;
035: }
036:
037: public String createID(Connection conn, Feature feature,
038: Statement statement) throws IOException {
039: throw new UnsupportedOperationException("Read only fid mapper");
040: }
041:
042: public int getColumnCount() {
043: return wrapped.getColumnCount();
044: }
045:
046: public int getColumnDecimalDigits(int colIndex) {
047: return wrapped.getColumnDecimalDigits(colIndex);
048: }
049:
050: public String getColumnName(int colIndex) {
051: return wrapped.getColumnName(colIndex);
052: }
053:
054: public int getColumnSize(int colIndex) {
055: return wrapped.getColumnSize(colIndex);
056: }
057:
058: public int getColumnType(int colIndex) {
059: return wrapped.getColumnType(colIndex);
060: }
061:
062: public String getID(Object[] attributes) {
063: return wrapped.getUnversionedFid(wrapped.getID(attributes));
064: }
065:
066: public Object[] getPKAttributes(String FID) throws IOException {
067: return wrapped.getPKAttributes(FID);
068: }
069:
070: public boolean hasAutoIncrementColumns() {
071: return wrapped.hasAutoIncrementColumns();
072: }
073:
074: public void initSupportStructures() {
075: wrapped.initSupportStructures();
076: }
077:
078: public boolean isAutoIncrement(int colIndex) {
079: return wrapped.isAutoIncrement(colIndex);
080: }
081:
082: public boolean isVolatile() {
083: return wrapped.isVolatile();
084: }
085:
086: public boolean returnFIDColumnsAsAttributes() {
087: return wrapped.returnFIDColumnsAsAttributes();
088: }
089:
090: public String createVersionedFid(String extenalFID, long revision) {
091: return wrapped.createVersionedFid(extenalFID, revision);
092: }
093:
094: public String getUnversionedFid(String versionedFID) {
095: return wrapped.getUnversionedFid(versionedFID);
096: }
097:
098: public Object[] getUnversionedPKAttributes(String FID)
099: throws IOException {
100: return wrapped.getUnversionedPKAttributes(FID);
101: }
102:
103: }
|