You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2017/01/03 23:00:42 UTC
[1/2] incubator-edgent git commit: [Edgent-361] Add a sample for
periodic use of textFileReader
Repository: incubator-edgent
Updated Branches:
refs/heads/master aa3b5c867 -> a92c365ee
[Edgent-361] Add a sample for periodic use of textFileReader
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/e3847046
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/e3847046
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/e3847046
Branch: refs/heads/master
Commit: e384704664b55b4512c8387df4478c12e22ef3b7
Parents: a6090c8
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Tue Jan 3 17:19:53 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Tue Jan 3 17:19:53 2017 -0500
----------------------------------------------------------------------
.../edgent/connectors/file/FileStreams.java | 22 +++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/e3847046/connectors/file/src/main/java/org/apache/edgent/connectors/file/FileStreams.java
----------------------------------------------------------------------
diff --git a/connectors/file/src/main/java/org/apache/edgent/connectors/file/FileStreams.java b/connectors/file/src/main/java/org/apache/edgent/connectors/file/FileStreams.java
index 8459299..1f4ca5e 100644
--- a/connectors/file/src/main/java/org/apache/edgent/connectors/file/FileStreams.java
+++ b/connectors/file/src/main/java/org/apache/edgent/connectors/file/FileStreams.java
@@ -117,8 +117,10 @@ public class FileStreams {
* <p>
* This is the same as {@code textFileReader(pathnames, null, null)}
* <p>
- * Sample use:
+ * Sample uses:
+ *
* <pre>{@code
+ * // continuously watch a directory for new files and process each one once
* String dir = "/some/directory/path";
* Topology t = ...
* TStream<String> pathnames = FileStreams.directoryWatcher(t, () -> dir);
@@ -126,6 +128,24 @@ public class FileStreams {
* contents.print();
* }</pre>
*
+ * <pre>{@code
+ * // periodically process one or more files
+ * Supplier<List<String>> myPathnamesSupplier = () -> } {
+ * {@code
+ * // implementation of List<String> get() - return a list of pathnames
+ * // return Arrays.asList("/some/pathname"); // a fixed list
+ * // return Arrays.asList(new File("/some/dir").list()); // query a directory
+ * // or query some other object(s) for a list ...
+ * }
+ * };
+ * {@code
+ * Topology t = ...
+ * TStream<String> pathnames = t.poll(myPathnamesSupplier, 30, TimeUnit.SECONDS)
+ * .flatMap(tuple -> tuple);
+ * TStream<String> contents = FileStreams.textFileReader(pathnames);
+ * contents.print();
+ * }</pre>
+ *
* @param pathnames
* Stream containing pathnames of files to read.
* @return Stream containing lines from the files.
[2/2] incubator-edgent git commit: Merge pull request #268
Posted by dl...@apache.org.
Merge pull request #268
This closes #268
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/a92c365e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/a92c365e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/a92c365e
Branch: refs/heads/master
Commit: a92c365ee5174d3c337deb4287570e9509643782
Parents: aa3b5c8 e384704
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Tue Jan 3 18:00:36 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Tue Jan 3 18:00:36 2017 -0500
----------------------------------------------------------------------
.../edgent/connectors/file/FileStreams.java | 22 +++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------