All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vfny.geoserver.global.GeoServerFeatureLocking Maven / Gradle / Ivy

There is a newer version: 1.7.0
Show newest version
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */
package org.vfny.geoserver.global;

import org.geotools.data.DataSourceException;
import org.geotools.data.FeatureLock;
import org.geotools.data.FeatureLocking;
import org.geotools.data.Query;
import org.geotools.feature.Feature;
import org.geotools.feature.FeatureType;
import org.opengis.filter.Filter;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import java.io.IOException;


/**
 * GeoServer wrapper for backend Geotools2 DataStore.
 *
 * 

* Support FeatureSource decorator for FeatureTypeInfo that takes care of * mapping the FeatureTypeInfo's FeatureSource with the schema and definition * query configured for it. *

* *

* Because GeoServer requires that attributes always be returned in the same * order we need a way to smoothly inforce this. Could we use this class to do * so? It would need to support writing and locking though. *

* * @author Gabriel Rold�n * @version $Id: GeoServerFeatureLocking.java 8032 2007-12-17 21:08:28Z aaime $ */ public class GeoServerFeatureLocking extends GeoServerFeatureStore implements FeatureLocking { /** * Creates a new DEFQueryFeatureLocking object. * * @param locking GeoTools2 FeatureSource * @param schema DOCUMENT ME! * @param definitionQuery DOCUMENT ME! * @param declaredCRS * @param srsHandling see {@link FeatureTypeInfo#FORCE} & co. */ GeoServerFeatureLocking(FeatureLocking locking, FeatureType schema, Filter definitionQuery, CoordinateReferenceSystem declaredCRS, int srsHandling) { super(locking, schema, definitionQuery, declaredCRS, srsHandling); } FeatureLocking locking() { return (FeatureLocking) source; } /** *

* Description ... *

* * @param lock * * @throws UnsupportedOperationException DOCUMENT ME! * * @see org.vfny.geoserver.global.GeoServerFeatureStore#setFeatureLock(org.geotools.data.FeatureLock) */ public void setFeatureLock(FeatureLock lock) { if (source instanceof FeatureLocking) { ((FeatureLocking) source).setFeatureLock(lock); } else { throw new UnsupportedOperationException("FeatureTypeConfig does not supports locking"); } } /** * DOCUMENT ME! * * @param query DOCUMENT ME! * * @return DOCUMENT ME! * * @throws IOException DOCUMENT ME! * @throws DataSourceException DOCUMENT ME! */ public int lockFeatures(Query query) throws IOException { if (source instanceof FeatureLocking) { return ((FeatureLocking) source).lockFeatures(query); } else { throw new DataSourceException("FeatureTypeConfig does not supports locking"); } } // /** // * A custom hack for PostgisFeatureLocking? // * // * @param feature DOCUMENT ME! // * // * @return DOCUMENT ME! // * // * @throws IOException DOCUMENT ME! // */ // public int lockFeature(Feature feature) throws IOException { // if (source instanceof PostgisFeatureLocking) { // return ((PostgisFeatureLocking) source).lockFeature(feature); // } // // throw new IOException("FeatureTypeConfig does not support single FeatureLock"); // } /** * DOCUMENT ME! * * @param filter DOCUMENT ME! * * @return DOCUMENT ME! * * @throws IOException DOCUMENT ME! */ public int lockFeatures(Filter filter) throws IOException { filter = makeDefinitionFilter(filter); return locking().lockFeatures(filter); } /** * DOCUMENT ME! * * @return DOCUMENT ME! * * @throws IOException DOCUMENT ME! */ public int lockFeatures() throws IOException { return locking().lockFeatures(); } /** * DOCUMENT ME! * * @throws IOException DOCUMENT ME! */ public void unLockFeatures() throws IOException { locking().lockFeatures(); } /** * DOCUMENT ME! * * @param filter DOCUMENT ME! * * @throws IOException DOCUMENT ME! */ public void unLockFeatures(Filter filter) throws IOException { filter = makeDefinitionFilter(filter); locking().unLockFeatures(filter); } public void unLockFeatures(Query query) throws IOException { query = makeDefinitionQuery(query, schema); locking().lockFeatures(query); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy