summaryrefslogtreecommitdiff
path: root/plugins/ingest-attachment
diff options
context:
space:
mode:
authorRyan Ernst <ryan@iernst.net>2016-06-30 01:49:22 -0700
committerRyan Ernst <ryan@iernst.net>2016-06-30 01:49:22 -0700
commit08b3b6264e8618deb125ab5a4825e50a7c04f9ab (patch)
treedecadadd94fb770d8d66f0c545a4d7ea7f984a45 /plugins/ingest-attachment
parentf4519c44b75f11ded35240133bd720a876cdcacb (diff)
Tests pass, started removing generics from processor factory
Diffstat (limited to 'plugins/ingest-attachment')
-rw-r--r--plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java7
-rw-r--r--plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/IngestAttachmentPlugin.java20
2 files changed, 17 insertions, 10 deletions
diff --git a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java
index 689adfa1ac..73bed16ec0 100644
--- a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java
+++ b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java
@@ -27,7 +27,7 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.ingest.AbstractProcessor;
import org.elasticsearch.ingest.AbstractProcessorFactory;
import org.elasticsearch.ingest.IngestDocument;
-import org.elasticsearch.ingest.ProcessorsRegistry;
+import org.elasticsearch.ingest.Processor;
import java.io.IOException;
import java.util.Arrays;
@@ -151,12 +151,13 @@ public final class AttachmentProcessor extends AbstractProcessor {
return indexedChars;
}
- public static final class Factory extends AbstractProcessorFactory<AttachmentProcessor> {
+ public static final class Factory extends AbstractProcessorFactory {
static final Set<Property> DEFAULT_PROPERTIES = EnumSet.allOf(Property.class);
@Override
- public AttachmentProcessor doCreate(ProcessorsRegistry registry, String processorTag, Map<String, Object> config) throws Exception {
+ public AttachmentProcessor doCreate(Map<String, Processor.Factory> registry, String processorTag,
+ Map<String, Object> config) throws Exception {
String field = readStringProperty(TYPE, processorTag, config, "field");
String targetField = readStringProperty(TYPE, processorTag, config, "target_field", "attachment");
List<String> properyNames = readOptionalList(TYPE, processorTag, config, "properties");
diff --git a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/IngestAttachmentPlugin.java b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/IngestAttachmentPlugin.java
index 3156fe381f..eaba639255 100644
--- a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/IngestAttachmentPlugin.java
+++ b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/IngestAttachmentPlugin.java
@@ -19,15 +19,21 @@
package org.elasticsearch.ingest.attachment;
-import org.elasticsearch.node.NodeModule;
-import org.elasticsearch.plugins.Plugin;
+import java.util.Collections;
+import java.util.Map;
-import java.io.IOException;
+import org.elasticsearch.env.Environment;
+import org.elasticsearch.ingest.Processor;
+import org.elasticsearch.ingest.TemplateService;
+import org.elasticsearch.plugins.IngestPlugin;
+import org.elasticsearch.plugins.Plugin;
+import org.elasticsearch.script.ScriptService;
-public class IngestAttachmentPlugin extends Plugin {
+public class IngestAttachmentPlugin extends Plugin implements IngestPlugin {
- public void onModule(NodeModule nodeModule) throws IOException {
- nodeModule.registerProcessor(AttachmentProcessor.TYPE,
- (registry) -> new AttachmentProcessor.Factory());
+ @Override
+ public Map<String, Processor.Factory> getProcessors(
+ Environment env, ScriptService scriptService, TemplateService templateService) {
+ return Collections.singletonMap(AttachmentProcessor.TYPE, new AttachmentProcessor.Factory());
}
}