GeoToolsLayer extends FeatureSourceRetriever implements VectorLayer { @Override public Object read(String featureId) throws LayerException { Filter filter = filterService.createFidFilter(new String[] { featureId }); Iterator<?> iterator = getElements(filter, 0, 0); if (iterator.hasNext()) { return iterator.next(); } else { throw new LayerException(ExceptionCode.LAYER_MODEL_FEATURE_NOT_FOUND, featureId); } }  @Override String getId(); @Api void setId(String id); @Api void setUrl(String url); @Api void setDbtype(String dbtype); @Api DataSource getDataSource(); @Api void setDataSource(DataSource dataSource); @Api void setParameters(List<Parameter> parameters); @Api void setCooldownTimeBetweenInitializationRetries(long cooldownTimeBetweenInitializationRetries); @Override CoordinateReferenceSystem getCrs(); @Api void setLayerInfo(VectorLayerInfo layerInfo); @Override VectorLayerInfo getLayerInfo(); @Override boolean isCreateCapable(); @Override boolean isUpdateCapable(); @Override boolean isDeleteCapable(); @Override @Deprecated void setDataStore(DataStore dataStore); @Override @Transactional(rollbackFor = { Throwable.class }) Object create(Object feature); @Override @Transactional(rollbackFor = { Throwable.class }) void delete(String featureId); @Override @Transactional(rollbackFor = { Throwable.class }) Object saveOrUpdate(Object feature); @Override Object read(String featureId); @Override Envelope getBounds(); @Override Envelope getBounds(Filter filter); @Transactional(readOnly = true) Iterator<?> getElements(Filter filter, int offset, int maxResultSize); @Override FeatureModel getFeatureModel(); @Override DataStore getDataStore(); @Override SimpleFeatureSource getFeatureSource();  }
@Test public void testRead() throws Exception { SimpleFeature f = (SimpleFeature) layer.read(LAYER_NAME + ".2"); Assert.assertEquals("Vatican City", f.getAttribute(ATTRIBUTE_NAME)); Assert.assertEquals(562430, f.getAttribute(ATTRIBUTE_POPULATION)); }