else {
file = new File(storeDir, "store.xml");
}
if (s instanceof DataStoreInfo) {
DataStoreInfo ds = (DataStoreInfo) s;
FileParam dataFile = isFileBased(ds);
if (dataFile != null && options.bounds() == null) {
// optimize by copying files over directly
File storeDataDir = new File(wsDataDir, s.getName());
storeDataDir.mkdirs();
copyFilesTo(dataFile.file, storeDataDir, ds);
// update the store configuration to point to the newly copied files
File newFileRef = null;
if (dataFile.file.isDirectory()) {
newFileRef = storeDataDir;
}
else {
newFileRef = new File(storeDataDir, dataFile.file.getName());
}
// TODO: convert back to whatever format the parameter expects
DataStoreInfo clone = copy(ds, catalog.getFactory().createDataStore(), DataStoreInfo.class);
//clone.getConnectionParameters().put(dataFile.param.key, "file:%WORKSPACE%/"+newPath.toString());
clone.getConnectionParameters().put(dataFile.param.key, toWorkspaceRelativePath(newFileRef));
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,