package dk.statsbiblioteket.newspaper.md5checker;

import dk.statsbiblioteket.medieplatform.autonomous.Batch;
import dk.statsbiblioteket.medieplatform.autonomous.iterator.common.TreeIterator;
import dk.statsbiblioteket.medieplatform.autonomous.iterator.filesystem.transforming.TransformingIteratorForFileSystems;

import java.io.File;
import java.util.Properties;
import java.util.regex.Pattern;

public class MockupIteratorSuper extends MD5CheckerComponent {
    /**
     * Constructor matching super. Super requires a properties to be able to initialise the tree iterator, if needed.
     * If you do not need the tree iterator, ignore properties.
     *
     * You can use properties for your own stuff as well
     *
     * @param properties properties
     */
    public MockupIteratorSuper(Properties properties) {
        super(properties);
    }

    /**
     * We override this method to be able to inject our own tree iterator
     * @param batch the batch to iterate on
     * @return a tree iterator
     */
    @Override
    protected TreeIterator createIterator(Batch batch) {
        File dataDir = new File(Thread.currentThread().getContextClassLoader().getResource("scratch").getFile());
        File batchDir = new File(dataDir, batch.getFullID());
        return new TransformingIteratorForFileSystems(batchDir, Pattern.quote("."),".*\\.jp2$",".md5");
    }
}

@@ -328,16 +328,41 @@
 o.File;%0A
+import java.util.Arrays;%0A
 import j
@@ -1386,16 +1386,131 @@
 %22,%22.md5%22
+,%0A                                                      Arrays.asList(%22transfer_complete%22, %22transfer_acknowledged%22)
 );%0A    %7D

MAke list of ignored files by file iterator configurable