Project

General

Profile

1
package eu.dnetlib.data.collector.plugins.datasets;
2

    
3
import java.io.IOException;
4
import java.io.InputStreamReader;
5
import java.net.URL;
6

    
7
import eu.dnetlib.data.collector.plugin.AbstractCollectorPlugin;
8
import eu.dnetlib.data.collector.rmi.CollectorServiceException;
9
import eu.dnetlib.data.collector.rmi.InterfaceDescriptor;
10

    
11
public class DatasetsByProjectPlugin extends AbstractCollectorPlugin {
12

    
13
	@Override
14
	public Iterable<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate)
15
			throws CollectorServiceException {
16
		try {
17
			URL url = new URL(interfaceDescriptor.getBaseUrl());
18
			url.openConnection();
19
			InputStreamReader reader = new InputStreamReader(url.openStream());
20
			DatasetsByProjectIterator iterator = new DatasetsByProjectIterator(reader);
21
			return iterator;
22
		} catch (IOException e) {
23
			throw new CollectorServiceException("OOOPS something bad happen on creating iterator ", e);
24
		}
25

    
26
	}
27
}
(3-3/8)