aboutsummaryrefslogtreecommitdiff
path: root/java/pablotron/luigi/actions
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2018-09-06 08:40:23 -0400
committerPaul Duncan <pabs@pablotron.org>2018-09-06 08:40:23 -0400
commitf422534cd4cf1ba32523c9fc798c207065038ca5 (patch)
treed3dce87dffeca2acfceab6aa9abf7046843f9145 /java/pablotron/luigi/actions
parentc02640d395fe95a41183a63bea29113676e92fae (diff)
downloadluigi-template-f422534cd4cf1ba32523c9fc798c207065038ca5.tar.bz2
luigi-template-f422534cd4cf1ba32523c9fc798c207065038ca5.zip
java: add pom.xml, mv sources to src/main/java/org/pablotron, add src/test, add initial junit tests, update makefile and .gitignore
Diffstat (limited to 'java/pablotron/luigi/actions')
-rw-r--r--java/pablotron/luigi/actions/Action.java12
-rw-r--r--java/pablotron/luigi/actions/FilterAction.java41
-rw-r--r--java/pablotron/luigi/actions/TextAction.java22
3 files changed, 0 insertions, 75 deletions
diff --git a/java/pablotron/luigi/actions/Action.java b/java/pablotron/luigi/actions/Action.java
deleted file mode 100644
index 010622a..0000000
--- a/java/pablotron/luigi/actions/Action.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package pablotron.luigi.actions;
-
-import java.util.Map;
-import pablotron.luigi.Filter;
-import pablotron.luigi.LuigiError;
-
-public interface Action {
- public String run(
- Map<String, Filter.Handler> filters,
- Map<String, String> args
- ) throws LuigiError;
-};
diff --git a/java/pablotron/luigi/actions/FilterAction.java b/java/pablotron/luigi/actions/FilterAction.java
deleted file mode 100644
index b69923b..0000000
--- a/java/pablotron/luigi/actions/FilterAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package pablotron.luigi.actions;
-
-import java.util.Map;
-import pablotron.luigi.actions.Action;
-import pablotron.luigi.FilterReference;
-import pablotron.luigi.Filter;
-import pablotron.luigi.LuigiError;
-
-public final class FilterAction implements Action {
- private final String key;
- private final FilterReference filters[];
-
- public FilterAction(final String key, final FilterReference filters[]) {
- this.key = key;
- this.filters = filters;
- }
-
- public String run(
- Map<String, Filter.Handler> filters,
- Map<String, String> args
- ) throws LuigiError {
- // check for key
- if (!args.containsKey(key))
- throw new LuigiError("unknown key: " + key);
-
- // reduce value to result
- String r = args.get(key);
- for (int i = 0, l = this.filters.length; i < l; i++) {
- // get/check filter
- Filter.Handler f = filters.get(this.filters[i].name);
- if (f == null)
- throw new LuigiError("unknown filter: " + this.filters[i].name);
-
- // run filter
- r = f.filter(r, this.filters[i].args, args);
- }
-
- // return result
- return r;
- }
-};
diff --git a/java/pablotron/luigi/actions/TextAction.java b/java/pablotron/luigi/actions/TextAction.java
deleted file mode 100644
index 3024f23..0000000
--- a/java/pablotron/luigi/actions/TextAction.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package pablotron.luigi.actions;
-
-import java.util.Map;
-import pablotron.luigi.actions.Action;
-import pablotron.luigi.Filter;
-import pablotron.luigi.LuigiError;
-
-public final class TextAction implements Action {
- private final String text;
-
- public TextAction(final String text) {
- this.text = text;
- }
-
- public String run(
- Map<String, Filter.Handler> filters,
- Map<String, String> args
- ) throws LuigiError {
- return this.text;
- }
-};
-