Examples of PostgisNGDataStoreFactory


Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

        ran = true;
    }

    private void loadTableDescriptors() throws SQLException, DataSourceException {

        PostgisNGDataStoreFactory factory = PostgisServiceExtension2.getFactory();
        Map<String, Serializable> params = new HashMap<String, Serializable>();
        params.put(DBTYPE.key, (Serializable)DBTYPE.sample);       
        params.put(HOST.key, host);
        params.put(PORT.key, port);
        params.put(USER.key, username);
        params.put(PASSWD.key, password);
        params.put(DATABASE.key, database);

        BasicDataSource dataSource = null;
        Connection connection = null;
        try {
            dataSource = factory.createDataSource(params);
            connection = dataSource.getConnection();

            Statement statement = connection.createStatement();

            if (!hasWritableTable("geometry_columns", "f_geometry_column", statement)) { //$NON-NLS-1$
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

        return CatalogPlugin.getDefault().getResolveManager().resolve(this, adaptee, monitor);
    }

    public synchronized JDBCDataStore getDataStore() throws IOException {
      if(datastore == null) {
            PostgisNGDataStoreFactory factory = PostgisServiceExtension2.getFactory();
            datastore = factory.createDataStore(params);
      }
        return datastore;
    }
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

        }
        featureStore=null;
        datastore=null;
        PostgisServiceExtension2 ext=new PostgisServiceExtension2();
        Map<String, Serializable> params = ext.createParams(PostgisServiceExtension2.DIALECT.toURL(url));
        PostgisNGDataStoreFactory factory = new PostgisNGDataStoreFactory();
       
        datastore=factory.createDataStore(params);
        return datastore;
    }
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

    private static PostgisNGDataStoreFactory factory;

    public synchronized static PostgisNGDataStoreFactory getFactory() {
        if (factory == null) {
            factory = new PostgisNGDataStoreFactory();
            // TODO look up in factory SPI in order to avoid
            // duplicate instances
        }
        return factory;
    }
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

    private static PostgisNGDataStoreFactory factory;

    public synchronized static PostgisNGDataStoreFactory getFactory() {
        if (factory == null) {
            factory = new PostgisNGDataStoreFactory();
            // TODO look up in factory SPI in order to avoid
            // duplicate instances
        }
        return factory;
    }
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

                connect(new ShapefileDataStoreFactory());
            }
        });
        fileMenu.add(new SafeAction("Connect to PostGIS database...") {
            public void action(ActionEvent e) throws Throwable {
                connect(new PostgisNGDataStoreFactory());
            }
        });
        fileMenu.add(new SafeAction("Connect to DataStore...") {
            public void action(ActionEvent e) throws Throwable {
                connect(null);
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

    private static final String CREATE_DROP_TESTDB = "gt2_create_drop_testdb";

    @Override
    protected boolean isOnline() throws Exception {
        PostgisNGDataStoreFactory factory =  new PostgisNGDataStoreFactory();
        JDBCDataStore closer = new JDBCDataStore();
        Class.forName(factory.getDriverClassName());
       
        // get host and port
        String host = fixture.getProperty(HOST.key);
        String port = fixture.getProperty(PORT.key);
        String user = fixture.getProperty(USER.key);
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

            closer.closeSafe(st);
        }
    }
   
    public void testCreateDrop() throws IOException, SQLException, SchemaException {
        PostgisNGDataStoreFactory factory =  new PostgisNGDataStoreFactory();
        Properties db = fixture;
       
        Map<String, Object> params = new HashMap<String, Object>();
        params.put(HOST.key, db.getProperty(HOST.key));
        params.put(DATABASE.key, CREATE_DROP_TESTDB);
        params.put(PORT.key, db.getProperty(PORT.key));
        params.put(USER.key, db.getProperty(USER.key));
        params.put(PASSWD.key, db.getProperty(PASSWD.key));
        params.put(DBTYPE.key, "postgis");
        params.put(PostgisNGDataStoreFactory.CREATE_DB_IF_MISSING.key, true);

        // we can work with it
        assertTrue(factory.canProcess(params));
       
        // force database creation and check the store functions
        JDBCDataStore store = factory.createDataStore(params);
        assertNotNull(store);
        store.createSchema(DataUtilities.createType("test", "id:String,polygonProperty:Polygon:srid=32615"));
        store.getSchema("test");
       
        // now disconnect and drop
        store.dispose();
        factory.dropDatabase(params);
       
        // try to connect again, it must fail
        params.remove(PostgisNGDataStoreFactory.CREATE_DB_IF_MISSING.key);
        try {
            store = factory.createDataStore(params);
            store.getTypeNames();
            fail("This one should have failed, the database has just been dropped");
        } catch(Exception e) {
            // fine, it's what we expected
        }
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

        }

        // create a new schema without geometries to simulate failure on scanning all the typeNames
        DataStore ds = null;
        try {
            ds = new PostgisNGDataStoreFactory().createDataStore(params);
            final List<AttributeDescriptor> schema = new ArrayList<AttributeDescriptor>();
            schema.add(new AttributeDescriptorImpl(new AttributeTypeImpl(new NameImpl("name"),
                    String.class, false, false, null, null, null), new NameImpl("name"), 0, 0,
                    true, ""));
            SimpleFeatureType featureType = new SimpleFeatureTypeImpl(new NameImpl(noGeomFirst),
View Full Code Here

Examples of org.geotools.data.postgis.PostgisNGDataStoreFactory

* @source $URL$
*/
public class PostgisNGJNDIDataStoreFactory extends JDBCJNDIDataStoreFactory {

    public PostgisNGJNDIDataStoreFactory() {
        super(new PostgisNGDataStoreFactory());
    }
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.