@Override public MCollection next() { MFile nextFile = iter.next(); // try { MCollection result = new CollectionSingleIndexFile( nextFile, logger); result.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config); return result; //} catch (IOException e) { // logger.error("PartitionManagerFromList failed on "+nextFile.getPath(), e); // throw new RuntimeException(e); // } }
@Override public MCollection next() { MFile nextFile = iter.next(); // try { MCollection result = new CollectionSingleIndexFile( nextFile, logger); result.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config); return result; //} catch (IOException e) { // logger.error("PartitionManagerFromList failed on "+nextFile.getPath(), e); // throw new RuntimeException(e); // } }
@Override public MCollection next() { File nextFile = iter.next(); try { MCollection result = new CollectionSingleIndexFile( new MFileOS7(nextFile.getPath()), logger); result.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config); return result; } catch (IOException e) { logger.error("PartitionManagerFromList failed on "+nextFile.getPath(), e); throw new RuntimeException(e); } }
@Override public boolean hasNext() { if (!iter.hasNext()) { next = null; return false; } File nextFile = iter.next(); try { MCollection result = new CollectionSingleIndexFile( new MFileOS7(nextFile.getPath()), logger); if (wasRemoved(result)) return hasNext(); result.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config); next = result; return true; } catch (IOException e) { logger.error("PartitionManagerFromList failed on "+nextFile.getPath(), e); throw new RuntimeException(e); } }
public void consume(MFile mfile) { MCollection part = new CollectionSingleFile(mfile, logger); part.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config); try { boolean changed = updateGribCollection(isGrib1, part, updateType, FeatureCollectionConfig.PartitionType.file, logger, errlog); if (changed) anyChange.set(true); } catch (IllegalStateException t) { logger.warn("Error making partition {} '{}'", part.getRoot(), t.getMessage()); partition.removePartition(part); // keep on truckin; can happen if directory is empty } catch (Throwable t) { logger.error("Error making partition " + part.getRoot(), t); partition.removePartition(part); } } });
part.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config); try { if (part instanceof DirectoryPartition) { // LOOK if child partition fails, the parent partition doesnt know that - suckage
dcmp.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, partitionManager.getAuxInfo(FeatureCollectionConfig.AUX_CONFIG)); result.addPartition(dcmp);
static public GribCollectionImmutable openGribCollectionFromDataFile(boolean isGrib1, MFile mfile, CollectionUpdateType updateType, FeatureCollectionConfig config, Formatter errlog, org.slf4j.Logger logger) throws IOException { MCollection dcm = new CollectionSingleFile(mfile, logger); dcm.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config); if (isGrib1) { Grib1CollectionBuilder builder = new Grib1CollectionBuilder(dcm.getCollectionName(), dcm, logger); // LOOK ignoring partition type boolean changed = (builder.updateNeeded(updateType) && builder.createIndex(FeatureCollectionConfig.PartitionType.file, errlog)); } else { Grib2CollectionBuilder builder = new Grib2CollectionBuilder(dcm.getCollectionName(), dcm, logger); boolean changed = (builder.updateNeeded(updateType) && builder.createIndex(FeatureCollectionConfig.PartitionType.file, errlog)); } // the index file should now exist, open it GribCollectionImmutable result = openCdmIndex(dcm.getIndexFilename(NCX_SUFFIX), config, true, logger); if (result != null) return result; // if open fails, force recreate the index if (updateType == CollectionUpdateType.never) return null; // not allowed to write if (updateType == CollectionUpdateType.always) return null;// already tried to force write, give up return openGribCollectionFromDataFile(isGrib1, mfile, CollectionUpdateType.always, config, errlog, logger); }