1
|
package eu.dnetlib.msro.workers.aggregation.collect.plugins.oaisets;
|
2
|
|
3
|
import java.util.stream.Stream;
|
4
|
|
5
|
import org.springframework.beans.factory.annotation.Autowired;
|
6
|
import org.springframework.stereotype.Component;
|
7
|
|
8
|
import eu.dnetlib.miscutils.streams.DnetStreamSupport;
|
9
|
import eu.dnetlib.msro.workers.aggregation.collect.CollectException;
|
10
|
import eu.dnetlib.msro.workers.aggregation.collect.plugins.CollectorPlugin;
|
11
|
import eu.dnetlib.msro.workers.aggregation.collect.plugins.DnetCollectorPlugin;
|
12
|
import eu.dnetlib.msro.workers.aggregation.collect.plugins.oai.engine.HttpConnector;
|
13
|
import eu.dnetlib.msro.workers.aggregation.objects.InterfaceDescriptor;
|
14
|
|
15
|
@Component
|
16
|
@DnetCollectorPlugin("oai_sets")
|
17
|
public class OaiSetsCollectorPlugin implements CollectorPlugin {
|
18
|
|
19
|
@Autowired
|
20
|
private HttpConnector httpConnector;
|
21
|
|
22
|
@Override
|
23
|
public Stream<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate)
|
24
|
throws CollectException {
|
25
|
final String baseUrl = interfaceDescriptor.getBaseUrl();
|
26
|
|
27
|
if ((baseUrl == null) || baseUrl.isEmpty()) { throw new CollectException("Param 'baseurl' is null or empty"); }
|
28
|
|
29
|
return DnetStreamSupport.stream(new OaiSetsIterator(baseUrl, httpConnector));
|
30
|
}
|
31
|
|
32
|
}
|