JDBCDataStore createDataStore() throws IOException { Map<String, Object> params = new HashMap<>(); params.put(GeoPkgDataStoreFactory.DATASOURCE.key, connPool); return new GeoPkgDataStoreFactory(writerConfig).createDataStore(params); } }
/** * This is left for public API compatibility but it's not as efficient as using the GeoPackage * internal pool * * @param params Map of connection parameter. * @return * @throws IOException */ @Override public BasicDataSource createDataSource(Map params) throws IOException { // create a datasource BasicDataSource dataSource = new BasicDataSource(); // driver dataSource.setDriverClassName(getDriverClassName()); // url dataSource.setUrl(getJDBCUrl(params)); addConnectionProperties(dataSource, params); dataSource.setAccessToUnderlyingConnectionAllowed(true); return dataSource; }
/** Creates a GeoPackage from an existing file specifying database credentials. */ public GeoPackage(File file, String user, String passwd, boolean readOnly) throws IOException { this.file = file; Map params = new HashMap(); if (user != null) { params.put(GeoPkgDataStoreFactory.USER.key, user); } if (passwd != null) { params.put(GeoPkgDataStoreFactory.PASSWD.key, passwd); } if (readOnly) { params.put(GeoPkgDataStoreFactory.READ_ONLY.key, readOnly); } params.put(GeoPkgDataStoreFactory.DATABASE.key, file.getPath()); params.put(GeoPkgDataStoreFactory.DBTYPE.key, GeoPkgDataStoreFactory.DBTYPE.sample); this.connPool = new GeoPkgDataStoreFactory(writerConfig).createDataSource(params); }
list.add(new DatabaseConnectionField(GeoPkgDataStoreFactory.USER)); GeoPkgDataStoreFactory factory = new GeoPkgDataStoreFactory(); return new DatabaseConnection( GeoPkgDataStoreFactory.DBTYPE, factory.getDisplayName(), false, list,
JDBCDataStore createDataStore() throws IOException { Map<String, Object> params = new HashMap<>(); params.put(GeoPkgDataStoreFactory.DATASOURCE.key, connPool); return new GeoPkgDataStoreFactory(writerConfig).createDataStore(params); } }
/** Creates a GeoPackage from an existing file specifying database credentials. */ public GeoPackage(File file, String user, String passwd, boolean readOnly) throws IOException { this.file = file; Map params = new HashMap(); if (user != null) { params.put(GeoPkgDataStoreFactory.USER.key, user); } if (passwd != null) { params.put(GeoPkgDataStoreFactory.PASSWD.key, passwd); } if (readOnly) { params.put(GeoPkgDataStoreFactory.READ_ONLY.key, readOnly); } params.put(GeoPkgDataStoreFactory.DATABASE.key, file.getPath()); params.put(GeoPkgDataStoreFactory.DBTYPE.key, GeoPkgDataStoreFactory.DBTYPE.sample); this.connPool = new GeoPkgDataStoreFactory(writerConfig).createDataSource(params); }
/** * This is left for public API compatibility but it's not as efficient as using the GeoPackage * internal pool * * @param params Map of connection parameter. * @return * @throws IOException */ @Override public BasicDataSource createDataSource(Map params) throws IOException { // create a datasource BasicDataSource dataSource = new BasicDataSource(); // driver dataSource.setDriverClassName(getDriverClassName()); // url dataSource.setUrl(getJDBCUrl(params)); addConnectionProperties(dataSource, params); dataSource.setAccessToUnderlyingConnectionAllowed(true); return dataSource; }
@Override public DataStore get() { if (dataStore == null) { final File databaseFile = getTargetFile(); final GeoPkgDataStoreFactory factory = new GeoPkgDataStoreFactory(); final Map<String, Serializable> params = ImmutableMap.of( GeoPkgDataStoreFactory.DBTYPE.key, "geopkg", GeoPkgDataStoreFactory.DATABASE.key, databaseFile.getAbsolutePath()); DataStore dataStore; try { dataStore = factory.createDataStore(params); } catch (IOException ioe) { throw new RuntimeException("Unable to create GeoPkgDataStore", ioe); } if (null == dataStore) { throw new RuntimeException("Unable to create GeoPkgDataStore"); } this.dataStore = dataStore; } return dataStore; }
private void createDataStore() { final GeoPkgDataStoreFactory factory = new GeoPkgDataStoreFactory(); final HashMap<String, Serializable> params = new HashMap<>(3); if (uploadedFile == null) { throw new CommandSpecException("Request must specify one and only one " + RepositoryCommandController.UPLOAD_FILE_KEY + " in the request body"); } // fill in DataStore parameters params.put(GeoPkgDataStoreFactory.DBTYPE.key, "geopkg"); params.put(GeoPkgDataStoreFactory.DATABASE.key, uploadedFile.getAbsolutePath()); params.put(GeoPkgDataStoreFactory.USER.key, options.getFirstValue("user", "user")); try { dataStore = factory.createDataStore(params); } catch (IOException ioe) { throw new CommandSpecException("Unable to create GeoPkgDataStore: " + ioe .getMessage()); } if (null == dataStore) { throw new CommandSpecException( "Unable to create GeoPkgDataStore from uploaded file."); } }
public DataStore createDataStore(File dbFile) { GeoPkgDataStoreFactory f = new GeoPkgDataStoreFactory(); DataStore dataStore; final HashMap<String, Serializable> params = new HashMap<>(3); params.put(GeoPkgDataStoreFactory.DBTYPE.key, "geopkg"); params.put(GeoPkgDataStoreFactory.DATABASE.key, dbFile.getAbsolutePath()); params.put(GeoPkgDataStoreFactory.USER.key, "user"); try { dataStore = f.createDataStore(params); } catch (IOException ioe) { throw new RuntimeException("Unable to create GeoPkgDataStore", ioe); } return dataStore; }
public DataStore createDataStore(File dbFile) { GeoPkgDataStoreFactory f = new GeoPkgDataStoreFactory(); DataStore dataStore; final HashMap<String, Serializable> params = new HashMap<>(3); params.put(GeoPkgDataStoreFactory.DBTYPE.key, "geopkg"); params.put(GeoPkgDataStoreFactory.DATABASE.key, dbFile.getAbsolutePath()); params.put(GeoPkgDataStoreFactory.USER.key, "user"); try { dataStore = f.createDataStore(params); } catch (IOException ioe) { throw new RuntimeException("Unable to create GeoPkgDataStore", ioe); } return dataStore; }