ingest: seal all processor and processor factory implementations

This commit is contained in:
Martijn van Groningen 2016-02-03 14:47:22 +01:00
parent 7d787ad1d1
commit 0d9f535044
13 changed files with 23 additions and 25 deletions

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ingest.core.AbstractProcessor;
import org.elasticsearch.ingest.core.AbstractProcessorFactory; import org.elasticsearch.ingest.core.AbstractProcessorFactory;
import org.elasticsearch.ingest.core.ConfigurationUtils; import org.elasticsearch.ingest.core.ConfigurationUtils;
import org.elasticsearch.ingest.core.IngestDocument; import org.elasticsearch.ingest.core.IngestDocument;
import org.elasticsearch.ingest.core.Processor;
import java.util.Map; import java.util.Map;
@ -31,7 +30,7 @@ import java.util.Map;
* Base class for processors that manipulate strings and require a single "fields" array config value, which * Base class for processors that manipulate strings and require a single "fields" array config value, which
* holds a list of field names in string format. * holds a list of field names in string format.
*/ */
public abstract class AbstractStringProcessor extends AbstractProcessor { abstract class AbstractStringProcessor extends AbstractProcessor {
private final String field; private final String field;
protected AbstractStringProcessor(String tag, String field) { protected AbstractStringProcessor(String tag, String field) {
@ -54,7 +53,7 @@ public abstract class AbstractStringProcessor extends AbstractProcessor {
protected abstract String process(String value); protected abstract String process(String value);
public static abstract class Factory<T extends AbstractStringProcessor> extends AbstractProcessorFactory<T> { static abstract class Factory<T extends AbstractStringProcessor> extends AbstractProcessorFactory<T> {
protected final String processorType; protected final String processorType;
protected Factory(String processorType) { protected Factory(String processorType) {

View File

@ -33,7 +33,7 @@ import java.util.Map;
* provided values will be added. If the field is a scalar it will be converted to a single item list and the provided * provided values will be added. If the field is a scalar it will be converted to a single item list and the provided
* values will be added to the newly created list. * values will be added to the newly created list.
*/ */
public class AppendProcessor extends AbstractProcessor { public final class AppendProcessor extends AbstractProcessor {
public static final String TYPE = "append"; public static final String TYPE = "append";

View File

@ -19,7 +19,6 @@
package org.elasticsearch.ingest.processor; package org.elasticsearch.ingest.processor;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.ingest.core.AbstractProcessor; import org.elasticsearch.ingest.core.AbstractProcessor;
import org.elasticsearch.ingest.core.AbstractProcessorFactory; import org.elasticsearch.ingest.core.AbstractProcessorFactory;
import org.elasticsearch.ingest.core.IngestDocument; import org.elasticsearch.ingest.core.IngestDocument;
@ -36,7 +35,7 @@ import static org.elasticsearch.ingest.core.ConfigurationUtils.newConfigurationE
* Processor that converts fields content to a different type. Supported types are: integer, float, boolean and string. * Processor that converts fields content to a different type. Supported types are: integer, float, boolean and string.
* Throws exception if the field is not there or the conversion fails. * Throws exception if the field is not there or the conversion fails.
*/ */
public class ConvertProcessor extends AbstractProcessor { public final class ConvertProcessor extends AbstractProcessor {
enum Type { enum Type {
INTEGER { INTEGER {
@ -137,7 +136,7 @@ public class ConvertProcessor extends AbstractProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractProcessorFactory<ConvertProcessor> { public static final class Factory extends AbstractProcessorFactory<ConvertProcessor> {
@Override @Override
public ConvertProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception { public ConvertProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {
String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field"); String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");

View File

@ -108,7 +108,7 @@ public final class DateProcessor extends AbstractProcessor {
return matchFormats; return matchFormats;
} }
public static class Factory extends AbstractProcessorFactory<DateProcessor> { public static final class Factory extends AbstractProcessorFactory<DateProcessor> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public DateProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception { public DateProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {

View File

@ -31,7 +31,7 @@ import java.util.Map;
* Processor that raises a runtime exception with a provided * Processor that raises a runtime exception with a provided
* error message. * error message.
*/ */
public class FailProcessor extends AbstractProcessor { public final class FailProcessor extends AbstractProcessor {
public static final String TYPE = "fail"; public static final String TYPE = "fail";
@ -56,7 +56,7 @@ public class FailProcessor extends AbstractProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractProcessorFactory<FailProcessor> { public static final class Factory extends AbstractProcessorFactory<FailProcessor> {
private final TemplateService templateService; private final TemplateService templateService;

View File

@ -32,7 +32,7 @@ import java.util.regex.Pattern;
* Processor that allows to search for patterns in field content and replace them with corresponding string replacement. * Processor that allows to search for patterns in field content and replace them with corresponding string replacement.
* Support fields of string type only, throws exception if a field is of a different type. * Support fields of string type only, throws exception if a field is of a different type.
*/ */
public class GsubProcessor extends AbstractProcessor { public final class GsubProcessor extends AbstractProcessor {
public static final String TYPE = "gsub"; public static final String TYPE = "gsub";
@ -76,7 +76,7 @@ public class GsubProcessor extends AbstractProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractProcessorFactory<GsubProcessor> { public static final class Factory extends AbstractProcessorFactory<GsubProcessor> {
@Override @Override
public GsubProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception { public GsubProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {
String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field"); String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");

View File

@ -32,7 +32,7 @@ import java.util.stream.Collectors;
* Processor that joins the different items of an array into a single string value using a separator between each item. * Processor that joins the different items of an array into a single string value using a separator between each item.
* Throws exception is the specified field is not an array. * Throws exception is the specified field is not an array.
*/ */
public class JoinProcessor extends AbstractProcessor { public final class JoinProcessor extends AbstractProcessor {
public static final String TYPE = "join"; public static final String TYPE = "join";
@ -70,7 +70,7 @@ public class JoinProcessor extends AbstractProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractProcessorFactory<JoinProcessor> { public final static class Factory extends AbstractProcessorFactory<JoinProcessor> {
@Override @Override
public JoinProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception { public JoinProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {
String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field"); String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");

View File

@ -26,7 +26,7 @@ import java.util.Locale;
* Throws exception is the field is not of type string. * Throws exception is the field is not of type string.
*/ */
public class LowercaseProcessor extends AbstractStringProcessor { public final class LowercaseProcessor extends AbstractStringProcessor {
public static final String TYPE = "lowercase"; public static final String TYPE = "lowercase";
@ -44,7 +44,7 @@ public class LowercaseProcessor extends AbstractStringProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractStringProcessor.Factory<LowercaseProcessor> { public final static class Factory extends AbstractStringProcessor.Factory<LowercaseProcessor> {
public Factory() { public Factory() {
super(TYPE); super(TYPE);

View File

@ -30,7 +30,7 @@ import java.util.Map;
/** /**
* Processor that removes existing fields. Nothing happens if the field is not present. * Processor that removes existing fields. Nothing happens if the field is not present.
*/ */
public class RemoveProcessor extends AbstractProcessor { public final class RemoveProcessor extends AbstractProcessor {
public static final String TYPE = "remove"; public static final String TYPE = "remove";
@ -55,7 +55,7 @@ public class RemoveProcessor extends AbstractProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractProcessorFactory<RemoveProcessor> { public static final class Factory extends AbstractProcessorFactory<RemoveProcessor> {
private final TemplateService templateService; private final TemplateService templateService;

View File

@ -29,7 +29,7 @@ import java.util.Map;
/** /**
* Processor that allows to rename existing fields. Will throw exception if the field is not present. * Processor that allows to rename existing fields. Will throw exception if the field is not present.
*/ */
public class RenameProcessor extends AbstractProcessor { public final class RenameProcessor extends AbstractProcessor {
public static final String TYPE = "rename"; public static final String TYPE = "rename";
@ -75,7 +75,7 @@ public class RenameProcessor extends AbstractProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractProcessorFactory<RenameProcessor> { public static final class Factory extends AbstractProcessorFactory<RenameProcessor> {
@Override @Override
public RenameProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception { public RenameProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {
String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field"); String field = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");

View File

@ -32,7 +32,7 @@ import java.util.Map;
* Processor that adds new fields with their corresponding values. If the field is already present, its value * Processor that adds new fields with their corresponding values. If the field is already present, its value
* will be replaced with the provided one. * will be replaced with the provided one.
*/ */
public class SetProcessor extends AbstractProcessor { public final class SetProcessor extends AbstractProcessor {
public static final String TYPE = "set"; public static final String TYPE = "set";

View File

@ -23,7 +23,7 @@ package org.elasticsearch.ingest.processor;
* Processor that trims the content of string fields. * Processor that trims the content of string fields.
* Throws exception is the field is not of type string. * Throws exception is the field is not of type string.
*/ */
public class TrimProcessor extends AbstractStringProcessor { public final class TrimProcessor extends AbstractStringProcessor {
public static final String TYPE = "trim"; public static final String TYPE = "trim";
@ -41,7 +41,7 @@ public class TrimProcessor extends AbstractStringProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractStringProcessor.Factory<TrimProcessor> { public static final class Factory extends AbstractStringProcessor.Factory<TrimProcessor> {
public Factory() { public Factory() {
super(TYPE); super(TYPE);

View File

@ -25,7 +25,7 @@ import java.util.Locale;
* Processor that converts the content of string fields to uppercase. * Processor that converts the content of string fields to uppercase.
* Throws exception is the field is not of type string. * Throws exception is the field is not of type string.
*/ */
public class UppercaseProcessor extends AbstractStringProcessor { public final class UppercaseProcessor extends AbstractStringProcessor {
public static final String TYPE = "uppercase"; public static final String TYPE = "uppercase";
@ -43,7 +43,7 @@ public class UppercaseProcessor extends AbstractStringProcessor {
return TYPE; return TYPE;
} }
public static class Factory extends AbstractStringProcessor.Factory<UppercaseProcessor> { public static final class Factory extends AbstractStringProcessor.Factory<UppercaseProcessor> {
public Factory() { public Factory() {
super(TYPE); super(TYPE);