1
|
package eu.dnetlib.data.collector.plugins.mongo;
|
2
|
|
3
|
import java.io.File;
|
4
|
|
5
|
import eu.dnetlib.rmi.data.CollectorServiceException;
|
6
|
import eu.dnetlib.rmi.data.InterfaceDescriptor;
|
7
|
import eu.dnetlib.rmi.data.plugin.AbstractCollectorPlugin;
|
8
|
|
9
|
public class MongoDumpPlugin extends AbstractCollectorPlugin {
|
10
|
|
11
|
@Override
|
12
|
public Iterable<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate)
|
13
|
throws CollectorServiceException {
|
14
|
final String baseUrl = interfaceDescriptor.getBaseUrl();
|
15
|
if (baseUrl == null || baseUrl.isEmpty()) { throw new CollectorServiceException("Param 'baseurl' is null or empty"); }
|
16
|
final File f = new File(baseUrl);
|
17
|
if (f.exists() == false) { throw new CollectorServiceException("the file at url " + baseUrl + " does not exists"); }
|
18
|
|
19
|
return new MongoDumpIterable(f);
|
20
|
|
21
|
}
|
22
|
|
23
|
}
|