public MFileCollectionManager(String name, MCollection mc, CalendarDate startPartition, org.slf4j.Logger logger) { super(name, logger); this.startPartition = startPartition; this.scanList.add(mc); this.rootDir = mc.getDirectoryName(); this.recheck = null; this.protoChoice = FeatureCollectionConfig.ProtoChoice.Penultimate; // default this.olderThanInMsecs = -1; }
@Override public String toString() { Formatter f = new Formatter(); f.format("DatasetCollectionManager{ collectionName='%s' recheck=%s ", collectionName, recheck); for (MCollection mc : scanList) { f.format("%n dir=%s filter=%s", mc.getDirectoryName(), mc.getFileFilter()); } return f.toString(); }
@Override public Iterator<MFile> getInventoryTop(MCollection mc, boolean recheck) { String path = mc.getDirectoryName(); if (path.startsWith("file:")) { path = path.substring(5); } File cd = new File(path); if (!cd.exists()) return null; if (!cd.isDirectory()) return null; return new FilteredIterator(mc, new MFileIterator(cd), false); // removes subdirs }
@Override public Iterator<MFile> getInventoryAll(MCollection mc, boolean recheck) { String path = mc.getDirectoryName(); if (path.startsWith("file:")) { path = path.substring(5); } File cd = new File(path); if (!cd.exists()) return null; if (!cd.isDirectory()) return null; return new FilteredIterator(mc, new MFileIteratorAll(cd), false); }
public Iterator<MFile> getSubdirs(MCollection mc, boolean recheck) { String path = mc.getDirectoryName(); if (path.startsWith("file:")) { path = path.substring(5); } File cd = new File(path); if (!cd.exists()) return null; if (!cd.isDirectory()) return null; return new FilteredIterator(mc, new MFileIterator(cd), true); // return only subdirs }
@Override public Iterator<MFile> getSubdirs(MCollection mc, boolean recheck) { String path = mc.getDirectoryName(); if (path.startsWith("file:")) { path = path.substring(5); } CacheDirectory cd = cacheManager.get(path, recheck); // check in cache, else call File.listFiles() if (cd == null) return null; if (!cd.isDirectory()) return null; return new FilteredIterator(mc, new MFileIterator(cd), true); }
@Override public Iterator<MFile> getInventoryAll(MCollection mc, boolean recheck) { String path = mc.getDirectoryName(); if (path.startsWith("file:")) { path = path.substring(5); } CacheDirectory cd = cacheManager.get(path, recheck); // check in cache, else call File.listFiles() if (cd == null) return null; if (!cd.isDirectory()) return null; return new FilteredIterator(mc, new MFileIteratorAll(cd, recheck), false); }
@Override public Iterator<MFile> getInventoryTop(MCollection mc, boolean recheck) { String path = mc.getDirectoryName(); if (path.startsWith("file:")) { path = path.substring(5); } CacheDirectory cd = cacheManager.get(path, recheck); // check in cache, else call File.listFiles() if (cd == null) return null; if (!cd.isDirectory()) return null; return new FilteredIterator(mc, new MFileIterator(cd), false); }