summaryrefslogtreecommitdiffstats
path: root/processing/src/main/java/com/yahoo/processing/Processor.java
diff options
context:
space:
mode:
Diffstat (limited to 'processing/src/main/java/com/yahoo/processing/Processor.java')
-rw-r--r--processing/src/main/java/com/yahoo/processing/Processor.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/processing/src/main/java/com/yahoo/processing/Processor.java b/processing/src/main/java/com/yahoo/processing/Processor.java
new file mode 100644
index 00000000000..9339d5792b7
--- /dev/null
+++ b/processing/src/main/java/com/yahoo/processing/Processor.java
@@ -0,0 +1,42 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.processing;
+
+import com.yahoo.component.chain.ChainedComponent;
+import com.yahoo.processing.execution.Execution;
+
+/**
+ * Superclass of chainable components processing Requests to create Responses.
+ * <p>
+ * Processors typically changes the Request and/or the Response. It may also make multiple
+ * forward requests, in series or parallel, or manufacture the response content itself or by calling
+ * an external service.
+ * <p>
+ * Typical usage:
+ * <code>
+ * public class MyProcessor extends Processor {
+ *
+ * &#64;Override
+ * public Response process(Request request, Execution execution) {
+ * // process the request here
+ * Response response = execution.process(request); // Pass along to get the Response
+ * // process (or fill in) Data/DataList items on the response here
+ * return response;
+ * }
+ *
+ * }
+ * </code>
+ *
+ * @author bratseth
+ */
+public abstract class Processor extends ChainedComponent {
+
+ /**
+ * Performs a processing request and returns the response
+ *
+ * @return a Response instance - never null - containing the data produced by this processor
+ * and those it forwards the request to
+ */
+ public abstract Response process(Request request, Execution execution);
+
+
+}