1
|
package eu.dnetlib.msro.workers.aggregation.collect.plugins.httplist;
|
2
|
|
3
|
import java.util.stream.Stream;
|
4
|
|
5
|
import eu.dnetlib.miscutils.streams.DnetStreamSupport;
|
6
|
import eu.dnetlib.msro.workers.aggregation.collect.CollectException;
|
7
|
import eu.dnetlib.msro.workers.aggregation.collect.plugins.CollectorPlugin;
|
8
|
import eu.dnetlib.msro.workers.aggregation.collect.plugins.DnetCollectorParam;
|
9
|
import eu.dnetlib.msro.workers.aggregation.collect.plugins.DnetCollectorPlugin;
|
10
|
import eu.dnetlib.msro.workers.aggregation.objects.InterfaceDescriptor;
|
11
|
import org.springframework.stereotype.Component;
|
12
|
|
13
|
@Component
|
14
|
@DnetCollectorPlugin(value = "httpList", parameters = {
|
15
|
@DnetCollectorParam("listUrl")
|
16
|
})
|
17
|
public class HttpListCollectorPlugin implements CollectorPlugin {
|
18
|
|
19
|
@Override
|
20
|
public Stream<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate)
|
21
|
throws CollectException {
|
22
|
final String baseUrl = interfaceDescriptor.getBaseUrl();
|
23
|
final String listAddress = interfaceDescriptor.getParams().get("listUrl");
|
24
|
|
25
|
return DnetStreamSupport.stream(new HttpListIterator(baseUrl, listAddress));
|
26
|
}
|
27
|
}
|