Package org.geotools.data

Examples of org.geotools.data.Transaction.commit()


        assertEquals("client 1 after commiting removal of fid1 (client 2 has added fid5)", 4,
                roadFromClient1.getFeatures().size());
        assertEquals("client 2 after client 1 commits removal of fid1 (client 2 has added fid5)",
                5, roadFromClient2.getFeatures().size());

        transaction2.commit();
        assertEquals("auto after client 2 commits addition of fid5 (fid1 previously removed)", 5,
                roadAuto.getFeatures().size());
        assertEquals("client 1 after client 2 commits addition of fid5 (fid1 previously removed)",
                5, roadFromClient1.getFeatures().size());
        assertEquals("client 2 after commiting addition of fid5 (fid1 previously removed)", 5,
View Full Code Here


             */
            SimpleFeatureCollection collection = new ListFeatureCollection(TYPE, features);
            featureStore.setTransaction(transaction);
            try {
                featureStore.addFeatures(collection);
                transaction.commit();
            } catch (Exception problem) {
                problem.printStackTrace();
                transaction.rollback();
            } finally {
                transaction.close();
View Full Code Here

                Geometry geometry2 = JTS.transform(geometry, transform);

                copy.setDefaultGeometry(geometry2);
                writer.write();
            }
            transaction.commit();
            JOptionPane.showMessageDialog(null, "Export to shapefile complete");
        } catch (Exception problem) {
            problem.printStackTrace();
            transaction.rollback();
            JOptionPane.showMessageDialog(null, "Export to shapefile failed");
View Full Code Here

        SimpleFeatureStore featureStore;
        featureStore = (SimpleFeatureStore) newDataStore.getFeatureSource(typeName);
        featureStore.setTransaction(transaction);
        try {
            featureStore.addFeatures(featureCollection);
            transaction.commit();
            JOptionPane.showMessageDialog(null, "Export to shapefile complete", "Export",
                            JOptionPane.INFORMATION_MESSAGE);
        } catch (Exception problem) {
            transaction.rollback();
            problem.printStackTrace();
View Full Code Here

    Transaction transaction = Transaction.AUTO_COMMIT;
    FeatureWriter<SimpleFeatureType, SimpleFeature> writer = ds.getFeatureWriter(ds.getTypeNames()[0], Transaction.AUTO_COMMIT);
    SimpleFeature feature = writer.next();
    feature.setAttribute(0, null);
    writer.close();
    transaction.commit();
    ds.dispose();

    // Read the same file and check the geometry is null
    ShpFiles shpFiles = new ShpFiles(shpUrl);
    ShapefileReader reader = new ShapefileReader(shpFiles, false, true,
View Full Code Here

                if (writer != null) {
                    writer.close();
                    writer = null;
                }
            }
            t.commit();
            t.close();
            assertEquals(--idx, loadFeatures(sds).size());
        }
        sds.dispose();
    }
View Full Code Here

        newFeatures2[1].setDefaultGeometry(fac
                .createPoint(new Coordinate(0, 0)));

        store.addFeatures(DataUtilities.collection(newFeatures1));
        store.addFeatures(DataUtilities.collection(newFeatures2));
        transaction.commit();
        transaction.close();
        assertEquals(idx + 3, sds.getCount(Query.ALL));
        sds.dispose();

    }
View Full Code Here

                + DataUtilities.fidSet(featureStore1.getFeatures()));
        System.out.println("t1 commit          t2: "
                + DataUtilities.fidSet(featureStore2.getFeatures()));

        // commit transaction two
        t2.commit();

        System.out.println();
        System.out
                .println("Step 5 transaction 2 commits the addition of '" + feature.getID() + "'");
        System.out.println("------");
View Full Code Here

                }
            } finally {
                writer.close();
            }
            System.out.println("commit " + t); // now the contents are removed
            t.commit();
        } catch (Throwable eek) {
            t.rollback();
        } finally {
            t.close();
            store.dispose();
View Full Code Here

        fr.close();
        assertEquals(count1+insert.size(), count2);

       
      System.out.println("Insert Commit");
      t.commit();

      System.out.println("Insert Read 3");
      fr = fs.getFeatures().features();
      int count3 = 0;
      while(fr.hasNext()){
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.