Replaced IOException with Exception on factory implementations' `Processor.Factory#create(Map)` method.

This commit is contained in:
Martijn van Groningen 2015-11-30 15:37:16 +01:00
parent fdf4543b8e
commit dde274d944
12 changed files with 13 additions and 23 deletions

View File

@ -21,7 +21,6 @@ package org.elasticsearch.ingest.processor;
import org.elasticsearch.ingest.IngestDocument;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -58,7 +57,7 @@ public abstract class AbstractStringProcessor implements Processor {
public static abstract class Factory<T extends AbstractStringProcessor> implements Processor.Factory<T> {
@Override
public T create(Map<String, Object> config) throws IOException {
public T create(Map<String, Object> config) throws Exception {
List<String> fields = ConfigurationUtils.readList(config, "fields");
return newProcessor(Collections.unmodifiableList(fields));
}

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.util.*;
/**
@ -129,7 +128,7 @@ public class ConvertProcessor implements Processor {
public static class Factory implements Processor.Factory<ConvertProcessor> {
@Override
public ConvertProcessor create(Map<String, Object> config) throws IOException {
public ConvertProcessor create(Map<String, Object> config) throws Exception {
Map<String, String> fields = ConfigurationUtils.readMap(config, "fields");
Map<String, Type> convertFields = new HashMap<>();
for (Map.Entry<String, String> entry : fields.entrySet()) {

View File

@ -111,7 +111,7 @@ public final class DateProcessor implements Processor {
public static class Factory implements Processor.Factory<DateProcessor> {
@SuppressWarnings("unchecked")
public DateProcessor create(Map<String, Object> config) {
public DateProcessor create(Map<String, Object> config) throws Exception {
String matchField = ConfigurationUtils.readStringProperty(config, "match_field");
String targetField = ConfigurationUtils.readStringProperty(config, "target_field", DEFAULT_TARGET_FIELD);
String timezoneString = ConfigurationUtils.readOptionalStringProperty(config, "timezone");

View File

@ -220,7 +220,7 @@ public final class GeoIpProcessor implements Processor {
private Path geoIpConfigDirectory;
private final DatabaseReaderService databaseReaderService = new DatabaseReaderService();
public GeoIpProcessor create(Map<String, Object> config) throws IOException {
public GeoIpProcessor create(Map<String, Object> config) throws Exception {
String ipField = readStringProperty(config, "source_field");
String targetField = readStringProperty(config, "target_field", "geoip");
String databaseFile = readStringProperty(config, "database_file", "GeoLite2-City.mmdb");

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
@ -39,7 +38,7 @@ public final class GrokProcessor implements Processor {
private final String matchField;
private final Grok grok;
public GrokProcessor(Grok grok, String matchField) throws IOException {
public GrokProcessor(Grok grok, String matchField) {
this.matchField = matchField;
this.grok = grok;
}
@ -72,7 +71,7 @@ public final class GrokProcessor implements Processor {
public static class Factory implements Processor.Factory<GrokProcessor> {
private Path grokConfigDirectory;
public GrokProcessor create(Map<String, Object> config) throws IOException {
public GrokProcessor create(Map<String, Object> config) throws Exception {
String matchField = ConfigurationUtils.readStringProperty(config, "field");
String matchPattern = ConfigurationUtils.readStringProperty(config, "pattern");
Map<String, String> patternBank = new HashMap<>();

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -68,7 +67,7 @@ public class GsubProcessor implements Processor {
public static class Factory implements Processor.Factory<GsubProcessor> {
@Override
public GsubProcessor create(Map<String, Object> config) throws IOException {
public GsubProcessor create(Map<String, Object> config) throws Exception {
List<Map<String, String>> gsubConfig = ConfigurationUtils.readList(config, "expressions");
List<GsubExpression> gsubExpressions = new ArrayList<>();
for (Map<String, String> stringObjectMap : gsubConfig) {

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -68,7 +67,7 @@ public class JoinProcessor implements Processor {
public static class Factory implements Processor.Factory<JoinProcessor> {
@Override
public JoinProcessor create(Map<String, Object> config) throws IOException {
public JoinProcessor create(Map<String, Object> config) throws Exception {
Map<String, String> fields = ConfigurationUtils.readMap(config, "fields");
return new JoinProcessor(Collections.unmodifiableMap(fields));
}

View File

@ -8,7 +8,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.IngestDocument.MetaData;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Collections;
import java.util.HashMap;
@ -49,7 +48,7 @@ public final class MetaDataProcessor implements Processor {
private final MustacheFactory mustacheFactory = new DefaultMustacheFactory();
@Override
public MetaDataProcessor create(Map<String, Object> config) throws IOException {
public MetaDataProcessor create(Map<String, Object> config) throws Exception {
Map<MetaData, Mustache> templates = new HashMap<>();
Iterator<Map.Entry<String, Object>> iterator = config.entrySet().iterator();
while (iterator.hasNext()) {

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -60,7 +59,7 @@ public class RemoveProcessor implements Processor {
public static class Factory implements Processor.Factory<RemoveProcessor> {
@Override
public RemoveProcessor create(Map<String, Object> config) throws IOException {
public RemoveProcessor create(Map<String, Object> config) throws Exception {
List<String> fields = ConfigurationUtils.readList(config, "fields");
return new RemoveProcessor(Collections.unmodifiableList(fields));
}

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
@ -65,7 +64,7 @@ public class RenameProcessor implements Processor {
public static class Factory implements Processor.Factory<RenameProcessor> {
@Override
public RenameProcessor create(Map<String, Object> config) throws IOException {
public RenameProcessor create(Map<String, Object> config) throws Exception {
Map<String, String> fields = ConfigurationUtils.readMap(config, "fields");
return new RenameProcessor(Collections.unmodifiableMap(fields));
}

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
@ -59,7 +58,7 @@ public class SetProcessor implements Processor {
public static final class Factory implements Processor.Factory<SetProcessor> {
@Override
public SetProcessor create(Map<String, Object> config) throws IOException {
public SetProcessor create(Map<String, Object> config) throws Exception {
Map<String, Object> fields = ConfigurationUtils.readMap(config, "fields");
return new SetProcessor(Collections.unmodifiableMap(fields));
}

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.processor.ConfigurationUtils;
import org.elasticsearch.ingest.processor.Processor;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
@ -65,7 +64,7 @@ public class SplitProcessor implements Processor {
public static class Factory implements Processor.Factory<SplitProcessor> {
@Override
public SplitProcessor create(Map<String, Object> config) throws IOException {
public SplitProcessor create(Map<String, Object> config) throws Exception {
Map<String, String> fields = ConfigurationUtils.readMap(config, "fields");
return new SplitProcessor(Collections.unmodifiableMap(fields));
}