s = clone;
}
else {
// copy into a new geopackage
GeoPackage gpkg = new GeoPackage(new File(wsDataDir, ds.getName()+".gpkg"));
try {
ingestInto(gpkg, ds);
}
finally {
gpkg.close();
}
// update the connection parameters
DataStoreInfo clone = copy(ds, catalog.getFactory().createDataStore(), DataStoreInfo.class);
clone.setType("GeoPackage");
Map<String,Serializable> oldParams = clone.getConnectionParameters();
Map<String,Serializable> params = Maps.newHashMap();
params.put(GeoPkgDataStoreFactory.DBTYPE.key, "geopkg");
params.put(GeoPkgDataStoreFactory.DATABASE.key, toWorkspaceRelativePath(gpkg.getFile()));
params.put(GeoPkgDataStoreFactory.NAMESPACE.key,
(Serializable) GeoPkgDataStoreFactory.NAMESPACE.lookUp(oldParams));
oldParams.clear();
oldParams.putAll(params);