/** * DOCUMENT ME! * * @param transaction DOCUMENT ME! */ public void setTransaction(Transaction transaction) { store().setTransaction(transaction); }
public void setTransaction(Transaction transaction) { featureStore().setTransaction(transaction); }
Transaction transaction = new DefaultTransaction("create"); SimpleFeatureStore featureStore = (SimpleFeatureStore) outStore.getFeatureSource(); featureStore.setTransaction(transaction); try { featureStore.addFeatures(contourFeatures);
@Override public void setTransaction(Transaction transaction) { store.setTransaction(transaction); }
public void setTransaction(Transaction transaction) { fstore.setTransaction(transaction); }
public void addGranules( final String typeName, final SimpleFeatureCollection granules, final Transaction transaction) throws IOException { Utilities.ensureNonNull("granuleMetadata", granules); final Lock lock = rwLock.writeLock(); try { lock.lock(); // check if the index has been cleared checkStore(); final SimpleFeatureStore store = (SimpleFeatureStore) slicesIndexStore.getFeatureSource(typeName); store.setTransaction(transaction); store.addFeatures(granules); } finally { lock.unlock(); } }
public void removeGranules(String typeName, Filter filter, Transaction transaction) throws IOException { Utilities.ensureNonNull("typeName", typeName); Utilities.ensureNonNull("filter", filter); Utilities.ensureNonNull("transaction", transaction); final Lock lock = rwLock.writeLock(); try { lock.lock(); // check if the index has been cleared checkStore(); final SimpleFeatureStore store = (SimpleFeatureStore) slicesIndexStore.getFeatureSource(typeName); store.setTransaction(transaction); store.removeFeatures(filter); } finally { lock.unlock(); } }
@Override public void addGranules( final String typeName, final Collection<SimpleFeature> granules, final Transaction transaction) throws IOException { Utilities.ensureNonNull("granuleMetadata", granules); // check if the index has been cleared checkStore(); SimpleFeatureStore store = (SimpleFeatureStore) getTileIndexStore().getFeatureSource(typeName); store.setTransaction(transaction); ListFeatureCollection featureCollection = new ListFeatureCollection(getTileIndexStore().getSchema(typeName)); // add them all Set<FeatureId> fids = new HashSet<FeatureId>(); for (SimpleFeature f : granules) { // Add the feature to the feature collection featureCollection.add(f); fids.add(ff.featureId(f.getID())); } store.addFeatures(featureCollection); store.setTransaction(null); }
@Override public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader( Query query, Transaction transaction) throws IOException { SimpleFeatureSource fs = getFeatureSource(query.getTypeName()); if (fs == null) { throw new IOException( "Could not find feature type mentioned in query: '" + query.getTypeName() + "'"); } if (fs instanceof SimpleFeatureStore) { ((SimpleFeatureStore) fs).setTransaction(transaction); } SimpleFeatureIterator iterator = fs.getFeatures().features(); return new DelegateFeatureReader<SimpleFeatureType, SimpleFeature>( fs.getSchema(), iterator); }
new LocationFeatureCollection( source.getFeatures(), path, store.getSchema()); store.setTransaction(t); store.addFeatures(indexWithLocation); LOGGER.info("Migration for " + path + ":" + coverage + " succesfull");
final int retVal = fs.getFeatures(query).size(); // ensures we get a value if (retVal > 0) { fs.setTransaction(t); fs.removeFeatures(query.getFilter()); t.commit();
public void testRemoveFeature() throws Exception { SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] {"one", geom}, null); SimpleFeatureStore store = (SimpleFeatureStore) ds.getFeatureSource("default"); store.setTransaction(new DefaultTransaction()); List<FeatureId> fid = store.addFeatures(DataUtilities.collection(f1)); count(store, 2); FeatureId identifier = fid.iterator().next(); String next = identifier.getID(); FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null); Filter f = filterFactory.id(Collections.singleton(filterFactory.featureId(next))); store.removeFeatures(f); count(store, 1); // assertEquals("Number of known feature as obtained from getCount",3, // store.getCount(Query.ALL)); }
public void testUUIDAsPrimaryKey() throws Exception { try (Transaction transaction = new DefaultTransaction()) { SimpleFeatureStore featureStore = (SimpleFeatureStore) dataStore.getFeatureSource(tname("uuidt")); featureStore.setTransaction(transaction); featureStore.addFeatures(createFeatureCollection()); transaction.commit(); assertEquals(3, featureStore.getCount(Query.ALL)); } }
public void testAddFeature() throws Exception { SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] {"one", geom}, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] {"two", geom}, null); SimpleFeatureStore store = (SimpleFeatureStore) ds.getFeatureSource("default"); store.setTransaction(new DefaultTransaction()); store.addFeatures(DataUtilities.collection(f1)); store.addFeatures(DataUtilities.collection(f2)); count(store, 3); // assertEquals("Number of known feature as obtained from getCount",3, // store.getCount(Query.ALL)); }
SimpleFeatureStore store1 = (SimpleFeatureStore) store.getFeatureSource(TYPENAME); SimpleFeatureStore store2 = (SimpleFeatureStore) store.getFeatureSource(TYPENAME); store1.setTransaction(defaultTransaction); store2.setTransaction(anotherTransaction);
public void testSerialTransactions() throws IOException { SimpleFeatureStore st = (SimpleFeatureStore) dataStore.getFeatureSource(tname("ft1")); SimpleFeatureBuilder b = new SimpleFeatureBuilder(st.getSchema()); b.set(aname("intProperty"), Integer.valueOf(100)); SimpleFeature f1 = b.buildFeature(null); DefaultFeatureCollection features = new DefaultFeatureCollection(null, null); features.add(f1); try (Transaction tx1 = new DefaultTransaction()) { st.setTransaction(tx1); st.addFeatures(features); tx1.commit(); } assertEquals(4, dataStore.getFeatureSource(tname("ft1")).getCount(Query.ALL)); try (Transaction tx2 = new DefaultTransaction()) { st.setTransaction(tx2); st.addFeatures(features); tx2.commit(); } assertEquals(5, dataStore.getFeatureSource(tname("ft1")).getCount(Query.ALL)); } }
(SimpleFeatureStore) data.getFeatureSource(roadFeatures[0].getFeatureType().getTypeName()); store1.setTransaction(defaultTransaction); class Listener implements FeatureListener { String name;
public void testInsertFeatures() throws Exception { try (Transaction transaction = new DefaultTransaction()) { SimpleFeatureStore featureStore = (SimpleFeatureStore) dataStore.getFeatureSource(tname("guid")); featureStore.setTransaction(transaction); assertEquals(featureStore.getCount(Query.ALL), 2); SimpleFeatureType type = dataStore.getSchema(tname("guid")); SimpleFeature feature = SimpleFeatureBuilder.build(type, new Object[] {uuid3}, "guid.3"); SimpleFeatureCollection collection = DataUtilities.collection(feature); featureStore.addFeatures(collection); transaction.commit(); assertEquals(featureStore.getCount(Query.ALL), 3); } }
SimpleFeatureStore store1 = (SimpleFeatureStore) store.getFeatureSource(TYPENAME); SimpleFeatureStore store2 = (SimpleFeatureStore) store.getFeatureSource(TYPENAME); store1.setTransaction(defaultTransaction);
SimpleFeatureStore road2 = (SimpleFeatureStore) data.getFeatureSource("road"); road1.setTransaction(t1); road2.setTransaction(t2);