2020-04-27 14:52:31 +02:00
|
|
|
|
2021-02-06 20:12:00 +01:00
|
|
|
package eu.dnetlib.dhp.collection.worker;
|
2019-10-02 14:45:12 +02:00
|
|
|
|
2019-10-24 11:36:59 +02:00
|
|
|
import eu.dnetlib.dhp.collection.plugin.CollectorPlugin;
|
|
|
|
import eu.dnetlib.dhp.collection.plugin.oai.OaiCollectorPlugin;
|
|
|
|
|
2019-10-02 14:45:12 +02:00
|
|
|
public class CollectorPluginFactory {
|
|
|
|
|
2021-02-05 19:18:05 +01:00
|
|
|
public static CollectorPlugin getPluginByProtocol(final HttpClientParams clientParams, final String protocol)
|
|
|
|
throws UnknownCollectorPluginException {
|
2020-04-27 14:52:31 +02:00
|
|
|
if (protocol == null)
|
2021-02-05 19:18:05 +01:00
|
|
|
throw new UnknownCollectorPluginException("protocol cannot be null");
|
2020-04-27 14:52:31 +02:00
|
|
|
switch (protocol.toLowerCase().trim()) {
|
|
|
|
case "oai":
|
2021-02-05 19:18:05 +01:00
|
|
|
return new OaiCollectorPlugin(clientParams);
|
2020-04-27 14:52:31 +02:00
|
|
|
default:
|
2021-02-05 19:18:05 +01:00
|
|
|
throw new UnknownCollectorPluginException("Unknown protocol");
|
2020-04-27 14:52:31 +02:00
|
|
|
}
|
|
|
|
}
|
2019-10-02 14:45:12 +02:00
|
|
|
}
|