From d624acb623b4dfe9ec4945dd474fb81db2c4b13a Mon Sep 17 00:00:00 2001 From: Fabian Steeg <fsteeg@gmail.com> Date: Thu, 13 Jun 2013 14:37:49 +0200 Subject: [PATCH] Fix examples and annotations on Flux command implementations With the Flux validator in the Metafacture IDE, the `@In` and `@Out` annotations on the Flux command implementation classes are processed to check the workflows (see [1]). With the current Flux examples in metafacture-core, the IDE reports some errors and warnings which this commit fixes: - Update morph-marc21.flux to use the new `encode-literals` command - Fix `@In` and `@Out` annotations of `TripleCount` - Add some missing `@In`, `@Out`, and `@Description` annotations [1] https://github.com/culturegraph/metafacture-ide/pull/23 --- examples/morph/morph-marc21.flux | 2 +- .../culturegraph/mf/stream/converter/bib/MabDecoder.java | 6 ++++++ .../culturegraph/mf/stream/converter/bib/MarcDecoder.java | 6 ++++++ .../java/org/culturegraph/mf/stream/pipe/ObjectTee.java | 6 ++++++ .../java/org/culturegraph/mf/stream/pipe/StreamTee.java | 6 ++++++ .../org/culturegraph/mf/stream/pipe/sort/TripleCount.java | 4 ++-- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/examples/morph/morph-marc21.flux b/examples/morph/morph-marc21.flux index 2381d67f2..19a398b55 100644 --- a/examples/morph/morph-marc21.flux +++ b/examples/morph/morph-marc21.flux @@ -5,5 +5,5 @@ open-file| as-lines| decode-marc21| morph(FLUX_DIR + "morph-marc21.xml")| -encode("literals")| +encode-literals| write("stdout"); diff --git a/src/main/java/org/culturegraph/mf/stream/converter/bib/MabDecoder.java b/src/main/java/org/culturegraph/mf/stream/converter/bib/MabDecoder.java index 3d40e8537..51aef2945 100644 --- a/src/main/java/org/culturegraph/mf/stream/converter/bib/MabDecoder.java +++ b/src/main/java/org/culturegraph/mf/stream/converter/bib/MabDecoder.java @@ -20,6 +20,9 @@ import org.culturegraph.mf.exceptions.FormatException; import org.culturegraph.mf.framework.DefaultObjectPipe; import org.culturegraph.mf.framework.StreamReceiver; +import org.culturegraph.mf.framework.annotations.Description; +import org.culturegraph.mf.framework.annotations.In; +import org.culturegraph.mf.framework.annotations.Out; /** @@ -31,6 +34,9 @@ * @author Markus Michael Geipel, Christoph Böhme * */ +@Description("Parses a raw Mab2 stream (UTF-8 encoding expected).") +@In(String.class) +@Out(StreamReceiver.class) public final class MabDecoder extends DefaultObjectPipe<String, StreamReceiver> { diff --git a/src/main/java/org/culturegraph/mf/stream/converter/bib/MarcDecoder.java b/src/main/java/org/culturegraph/mf/stream/converter/bib/MarcDecoder.java index 44b34bc32..a3b7a19d5 100644 --- a/src/main/java/org/culturegraph/mf/stream/converter/bib/MarcDecoder.java +++ b/src/main/java/org/culturegraph/mf/stream/converter/bib/MarcDecoder.java @@ -20,6 +20,9 @@ import org.culturegraph.mf.exceptions.FormatException; import org.culturegraph.mf.framework.DefaultObjectPipe; import org.culturegraph.mf.framework.StreamReceiver; +import org.culturegraph.mf.framework.annotations.Description; +import org.culturegraph.mf.framework.annotations.In; +import org.culturegraph.mf.framework.annotations.Out; import org.culturegraph.mf.stream.converter.IllegalEncodingException; @@ -31,6 +34,9 @@ * * @author Markus Michael Geipel, Christoph Böhme */ +@Description("Parses a raw Marc string (UTF-8 encoding expected).") +@In(String.class) +@Out(StreamReceiver.class) public final class MarcDecoder extends DefaultObjectPipe<String, StreamReceiver> { diff --git a/src/main/java/org/culturegraph/mf/stream/pipe/ObjectTee.java b/src/main/java/org/culturegraph/mf/stream/pipe/ObjectTee.java index 8699b19f9..43b9092be 100644 --- a/src/main/java/org/culturegraph/mf/stream/pipe/ObjectTee.java +++ b/src/main/java/org/culturegraph/mf/stream/pipe/ObjectTee.java @@ -18,6 +18,9 @@ import org.culturegraph.mf.framework.DefaultTee; import org.culturegraph.mf.framework.ObjectPipe; import org.culturegraph.mf.framework.ObjectReceiver; +import org.culturegraph.mf.framework.annotations.Description; +import org.culturegraph.mf.framework.annotations.In; +import org.culturegraph.mf.framework.annotations.Out; /** * Sends an object to more than one receiver. @@ -27,6 +30,9 @@ * @author Christoph Böhme * */ +@Description("Sends an object to more than one receiver.") +@In(Object.class) +@Out(Object.class) public final class ObjectTee<T> extends DefaultTee<ObjectReceiver<T>> implements ObjectPipe<T, ObjectReceiver<T>> { diff --git a/src/main/java/org/culturegraph/mf/stream/pipe/StreamTee.java b/src/main/java/org/culturegraph/mf/stream/pipe/StreamTee.java index 423df294e..61e409d58 100644 --- a/src/main/java/org/culturegraph/mf/stream/pipe/StreamTee.java +++ b/src/main/java/org/culturegraph/mf/stream/pipe/StreamTee.java @@ -18,6 +18,9 @@ import org.culturegraph.mf.framework.DefaultTee; import org.culturegraph.mf.framework.StreamPipe; import org.culturegraph.mf.framework.StreamReceiver; +import org.culturegraph.mf.framework.annotations.Description; +import org.culturegraph.mf.framework.annotations.In; +import org.culturegraph.mf.framework.annotations.Out; /** * Replicates an event stream to an arbitrary number of {@link StreamReceiver}s. @@ -25,6 +28,9 @@ * @author Christoph Böhme, Markus Michael Geipel * */ +@Description("Replicates an event stream to an arbitrary number of stream receivers.") +@In(StreamReceiver.class) +@Out(StreamReceiver.class) public final class StreamTee extends DefaultTee<StreamReceiver> implements StreamPipe<StreamReceiver> { diff --git a/src/main/java/org/culturegraph/mf/stream/pipe/sort/TripleCount.java b/src/main/java/org/culturegraph/mf/stream/pipe/sort/TripleCount.java index 16095860e..a2380cc03 100644 --- a/src/main/java/org/culturegraph/mf/stream/pipe/sort/TripleCount.java +++ b/src/main/java/org/culturegraph/mf/stream/pipe/sort/TripleCount.java @@ -28,8 +28,8 @@ * */ @Description("Counts triples") -@In(NamedValue.class) -@Out(NamedValue.class) +@In(Triple.class) +@Out(Triple.class) public final class TripleCount extends AbstractTripleSort { public static final String DEFAULT_COUNTP_REDICATE = "count";