Project

General

Profile

1 33202 michele.ar
package eu.dnetlib.data.collector.plugin;
2
3
import java.util.List;
4
5
import org.springframework.beans.factory.annotation.Required;
6
7
import com.google.common.base.Function;
8
import com.google.common.collect.Lists;
9
10
import eu.dnetlib.data.collector.plugin.CollectorPlugin;
11
import eu.dnetlib.data.collector.rmi.ProtocolDescriptor;
12
import eu.dnetlib.data.collector.rmi.ProtocolParameter;
13
14
public abstract class AbstractCollectorPlugin implements CollectorPlugin {
15
16
	private ProtocolDescriptor protocolDescriptor;
17
18
	@Override
19
	public final String getProtocol() {
20
		return getProtocolDescriptor().getName();
21
	}
22
23
	@Override
24
	public final List<String> listNameParameters() {
25
		return Lists.newArrayList(Lists.transform(getProtocolDescriptor().getParams(), new Function<ProtocolParameter, String>() {
26
27
			@Override
28
			public String apply(final ProtocolParameter p) {
29
				return p.getName();
30
			}
31
		}));
32
	}
33
34
	@Override
35
	public final ProtocolDescriptor getProtocolDescriptor() {
36
		return protocolDescriptor;
37
	}
38
39
	@Required
40
	public void setProtocolDescriptor(final ProtocolDescriptor protocolDescriptor) {
41
		this.protocolDescriptor = protocolDescriptor;
42
	}
43
}