1
|
package eu.dnetlib.data.collector.plugins.mongo;
|
2
|
|
3
|
import java.io.File;
|
4
|
import java.io.FileNotFoundException;
|
5
|
import java.io.FileReader;
|
6
|
import java.util.Iterator;
|
7
|
|
8
|
import eu.dnetlib.data.collector.rmi.CollectorServiceException;
|
9
|
import eu.dnetlib.data.information.collectionservice.rmi.CollectionServiceException;
|
10
|
|
11
|
/**
|
12
|
* The Class MongoDumpIterable.
|
13
|
*/
|
14
|
public class MongoDumpIterable implements Iterable<String> {
|
15
|
|
16
|
/** The input stream. */
|
17
|
private final FileReader inputStream;
|
18
|
|
19
|
/**
|
20
|
* Instantiates a new mongo dump iterable.
|
21
|
*
|
22
|
* @param inputFile the input file
|
23
|
* @throws CollectionServiceException the collection service exception
|
24
|
*/
|
25
|
public MongoDumpIterable(final File inputFile) throws CollectorServiceException {
|
26
|
try {
|
27
|
this.inputStream = new FileReader(inputFile);
|
28
|
} catch (FileNotFoundException e) {
|
29
|
throw new CollectorServiceException("Error unable to open inputStream", e);
|
30
|
}
|
31
|
}
|
32
|
|
33
|
/*
|
34
|
* (non-Javadoc)
|
35
|
*
|
36
|
* @see java.lang.Iterable#iterator()
|
37
|
*/
|
38
|
@Override
|
39
|
public Iterator<String> iterator() {
|
40
|
return new MongoDumpIterator(inputStream);
|
41
|
}
|
42
|
|
43
|
}
|