//
// create the index
//
// do we have a datastore.properties file?
final File parent = new File(runConfiguration.getParameter(Prop.ROOT_MOSAIC_DIR));
GranuleCatalog catalog;
// Consider checking that from the indexer if any
final File datastoreProperties = new File(parent, "datastore.properties");
// GranuleCatalog catalog = null;
if (Utils.checkFileReadable(datastoreProperties)) {
// read the properties file
catalog = createGranuleCatalogFromDatastore(parent, datastoreProperties, create,runConfiguration.getHints());
} else {
// we do not have a datastore properties file therefore we continue with a shapefile datastore
final URL file = new File(parent, runConfiguration.getParameter(Utils.Prop.INDEX_NAME) + ".shp").toURI().toURL();
final Properties params = new Properties();
params.put(ShapefileDataStoreFactory.URLP.key, file);
if (file.getProtocol().equalsIgnoreCase("file")) {
params.put(ShapefileDataStoreFactory.CREATE_SPATIAL_INDEX.key, Boolean.TRUE);
}
params.put(ShapefileDataStoreFactory.MEMORY_MAPPED.key, USE_MEMORY_MAPPED_BUFFERS);
params.put(ShapefileDataStoreFactory.DBFTIMEZONE.key, TimeZone.getTimeZone("UTC"));
params.put(Utils.Prop.LOCATION_ATTRIBUTE, runConfiguration.getParameter(Utils.Prop.LOCATION_ATTRIBUTE));
catalog = GranuleCatalogFactory.createGranuleCatalog(params, false, create, Utils.SHAPE_SPI,runConfiguration.getHints());
MultiLevelROIProvider roi = MultiLevelROIProviderFactory.createFootprintProvider(parent);
catalog.setMultiScaleROIProvider(roi);
}
return catalog;
}