GeoToolsLayer extends FeatureSourceRetriever implements VectorLayer { @Override @Transactional(rollbackFor = { Throwable.class }) public Object create(Object feature) throws LayerException { SimpleFeatureSource source = getFeatureSource(); if (source instanceof SimpleFeatureStore) { SimpleFeatureStore store = (SimpleFeatureStore) source; DefaultFeatureCollection collection = new DefaultFeatureCollection(); collection.add((SimpleFeature) feature); transactionSynchronization.synchTransaction(store); try { List<FeatureId> ids = store.addFeatures(collection); if (ids.size() == 1) { return read(ids.get(0).getID()); } } catch (IOException ioe) { featureModelUsable = false; throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION); } return feature; } else { log.error("Don't know how to create or update " + getFeatureSourceName() + ", class " + source.getClass().getName() + " does not implement SimpleFeatureStore"); throw new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source .getClass().getName()); } }  @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 create() throws Exception { WKTReader wktReader = new WKTReader(); Point geometry = (Point) wktReader.read("POINT (0 0)"); SimpleFeatureBuilder build = new SimpleFeatureBuilder(layer.getSchema()); SimpleFeature feature = build.buildFeature("100000", new Object[] { geometry, "Tsjakamaka", 342 }); Object created = layer.create(feature); Assert.assertNotNull(created); }