|
|
@ -14,6 +14,7 @@ import org.xbib.elx.api.BasicClient;
|
|
|
|
import org.xbib.elx.api.SearchClientProvider;
|
|
|
|
import org.xbib.elx.api.SearchClientProvider;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.ServiceLoader;
|
|
|
|
import java.util.ServiceLoader;
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
@ -106,6 +107,25 @@ public class ClientBuilder {
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ClientBuilder put(Map<String, ?> map) {
|
|
|
|
|
|
|
|
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
|
|
|
|
|
|
|
if (entry.getValue() == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entry.getValue() instanceof String ||
|
|
|
|
|
|
|
|
entry.getValue() instanceof Integer ||
|
|
|
|
|
|
|
|
entry.getValue() instanceof Long ||
|
|
|
|
|
|
|
|
entry.getValue() instanceof Float ||
|
|
|
|
|
|
|
|
entry.getValue() instanceof TimeValue) {
|
|
|
|
|
|
|
|
settingsBuilder.put(entry.getKey(), entry.getValue().toString());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
logger.log(Level.WARN, "skipping " + entry.getValue() +
|
|
|
|
|
|
|
|
" because invalid class type " + entry.getValue().getClass().getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
public <C extends BasicClient> C build() throws IOException {
|
|
|
|
public <C extends BasicClient> C build() throws IOException {
|
|
|
|
Settings settings = settingsBuilder.build();
|
|
|
|
Settings settings = settingsBuilder.build();
|
|
|
|