public boolean canHandle(Object object) { try { if (!(object instanceof Feature) || object instanceof FeatureCollection) return false; Feature f = (Feature) object; FeatureTypeInfo info = catalog.getFeatureTypeInfo(f .getFeatureType().getTypeName(), f.getFeatureType() .getNamespace().toString()); return info != null && info.getFeatureSource() instanceof VersioningFeatureSource; } catch (Exception e) { LOGGER .log( Level.FINE, "Error occurred trying to determine versioning status of a feature type", e); return false; } }
DifferenceQueryType query = (DifferenceQueryType) queries.get(i); FeatureTypeInfo meta = featureTypeInfo((QName) query.getTypeName()); FeatureSource source = meta.getFeatureSource();
DifferenceQueryType query = (DifferenceQueryType) queries.get(i); FeatureTypeInfo meta = featureTypeInfo((QName) query.getTypeName()); FeatureSource source = meta.getFeatureSource();
public void checkValidity(EObject element, Map featureTypeInfos) throws WFSTransactionException { // let's check we can perfom inserts, updates and deletes if ((wfs.getServiceLevel() & WFS.SERVICE_INSERT) == 0) { throw new WFSException("Transaction INSERT support is not enabled " + "(required for rollback)"); } if ((wfs.getServiceLevel() & WFS.SERVICE_UPDATE) == 0) { throw new WFSException("Transaction UPDATE support is not enabled " + "(required for rollback)"); } if ((wfs.getServiceLevel() & WFS.SERVICE_DELETE) == 0) { throw new WFSException("Transaction DELETE support is not enabled " + "(required for rollback)"); } // then, make sure we're hitting a versioning datastore RollbackType rollback = (RollbackType) element; FeatureTypeInfo info = (FeatureTypeInfo) featureTypeInfos.get(rollback.getTypeName()); try { if (!(info.getFeatureSource() instanceof VersioningFeatureSource)) { throw new WFSTransactionException("Cannot perform a rollback on " + info.getTypeName() + " since the backing data store is not versioning", "", rollback.getHandle()); } } catch (IOException e) { throw new WFSTransactionException("Cannot get the feature source for feature type " + info.getTypeName(), e, rollback.getHandle()); } // TODO: we should check the user attribute, but for the moment // we don't have an authentication subsystem }
FeatureCollection<SimpleFeatureType, SimpleFeature> match = finfo.getFeatureSource().getFeatures(q);
source = layers[i].getFeature().getFeatureSource(true);
@Override public FeatureIterator getSortedFeatures(ReferencedEnvelope env, Connection cacheConn) throws Exception { FeatureSource fs = typeInfo.getFeatureSource(); // build the bbox filter GeometryDescriptor geom = fs.getSchema().getGeometryDescriptor(); CoordinateReferenceSystem nativeCrs = geom .getCoordinateReferenceSystem(); FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); if (!CRS.equalsIgnoreMetadata(WGS84, nativeCrs)) env = env.transform(nativeCrs, true); BBOX filter = ff.bbox(geom.getLocalName(), env.getMinX(), env.getMinY(), env.getMaxX(), env.getMaxY(), null); // build an optimized query (only the necessary attributes DefaultQuery q = new DefaultQuery(); q.setFilter(filter); // TODO: enable this when JTS learns how to compute centroids // without triggering the // generation of Coordinate[] out of the sequences... // q.setHints(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, // PackedCoordinateSequenceFactory.class)); q.setPropertyNames(new String[] { geom.getLocalName() }); // return the reader return fs.getFeatures(q).features(); }