You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by cs...@apache.org on 2016/04/07 10:14:21 UTC
[1/2] incubator-apex-malhar git commit: Fixed the operator package
Repository: incubator-apex-malhar
Updated Branches:
refs/heads/master 6aef32d04 -> 4cffeb344
Fixed the operator package
Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/commit/5ff84b4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/tree/5ff84b4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/diff/5ff84b4a
Branch: refs/heads/master
Commit: 5ff84b4a06988e2c5336119c6bc07f6752ec8c73
Parents: 6aef32d
Author: Pramod Immaneni <pr...@datatorrent.com>
Authored: Wed Apr 6 19:07:07 2016 -0700
Committer: Pramod Immaneni <pr...@datatorrent.com>
Committed: Wed Apr 6 19:07:07 2016 -0700
----------------------------------------------------------------------
.../lib/io/fs/AbstractFileInputOperator.java | 2 +-
.../malhar/fs/LineByLineFileInputOperator.java | 75 --------------------
.../lib/fs/LineByLineFileInputOperator.java | 75 ++++++++++++++++++++
.../io/fs/AbstractFileInputOperatorTest.java | 3 +-
4 files changed, 77 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/5ff84b4a/library/src/main/java/com/datatorrent/lib/io/fs/AbstractFileInputOperator.java
----------------------------------------------------------------------
diff --git a/library/src/main/java/com/datatorrent/lib/io/fs/AbstractFileInputOperator.java b/library/src/main/java/com/datatorrent/lib/io/fs/AbstractFileInputOperator.java
index ef27cf1..b5b20e4 100644
--- a/library/src/main/java/com/datatorrent/lib/io/fs/AbstractFileInputOperator.java
+++ b/library/src/main/java/com/datatorrent/lib/io/fs/AbstractFileInputOperator.java
@@ -42,7 +42,7 @@ import javax.validation.constraints.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.apex.malhar.fs.LineByLineFileInputOperator;
+import org.apache.apex.malhar.lib.fs.LineByLineFileInputOperator;
import org.apache.commons.lang.mutable.MutableLong;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/5ff84b4a/library/src/main/java/org/apache/apex/malhar/fs/LineByLineFileInputOperator.java
----------------------------------------------------------------------
diff --git a/library/src/main/java/org/apache/apex/malhar/fs/LineByLineFileInputOperator.java b/library/src/main/java/org/apache/apex/malhar/fs/LineByLineFileInputOperator.java
deleted file mode 100644
index 812709e..0000000
--- a/library/src/main/java/org/apache/apex/malhar/fs/LineByLineFileInputOperator.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.apex.malhar.fs;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.apache.hadoop.fs.Path;
-
-import com.datatorrent.api.DefaultOutputPort;
-
-import com.datatorrent.lib.io.fs.AbstractFileInputOperator;
-
-/**
- * This is an extension of the {@link AbstractFileInputOperator} that outputs the contents of a file line by line.
- * Each line is emitted as a separate tuple in string format.
- * <p>
- * The directory path where to scan and read files from should be specified using the {@link #directory} property.
- * </p>
- * @displayName Line-by-line File Input
- * @category Input
- * @tags fs, file, line, lines, input operator
- */
-public class LineByLineFileInputOperator extends AbstractFileInputOperator<String>
-{
- public final transient DefaultOutputPort<String> output = new DefaultOutputPort<String>();
-
- protected transient BufferedReader br;
-
- @Override
- protected InputStream openFile(Path path) throws IOException
- {
- InputStream is = super.openFile(path);
- br = new BufferedReader(new InputStreamReader(is));
- return is;
- }
-
- @Override
- protected void closeFile(InputStream is) throws IOException
- {
- super.closeFile(is);
- br.close();
- br = null;
- }
-
- @Override
- protected String readEntity() throws IOException
- {
- return br.readLine();
- }
-
- @Override
- protected void emit(String tuple)
- {
- output.emit(tuple);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/5ff84b4a/library/src/main/java/org/apache/apex/malhar/lib/fs/LineByLineFileInputOperator.java
----------------------------------------------------------------------
diff --git a/library/src/main/java/org/apache/apex/malhar/lib/fs/LineByLineFileInputOperator.java b/library/src/main/java/org/apache/apex/malhar/lib/fs/LineByLineFileInputOperator.java
new file mode 100644
index 0000000..9c374d3
--- /dev/null
+++ b/library/src/main/java/org/apache/apex/malhar/lib/fs/LineByLineFileInputOperator.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.apex.malhar.lib.fs;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.apache.hadoop.fs.Path;
+
+import com.datatorrent.api.DefaultOutputPort;
+
+import com.datatorrent.lib.io.fs.AbstractFileInputOperator;
+
+/**
+ * This is an extension of the {@link AbstractFileInputOperator} that outputs the contents of a file line by line.
+ * Each line is emitted as a separate tuple in string format.
+ * <p>
+ * The directory path where to scan and read files from should be specified using the {@link #directory} property.
+ * </p>
+ * @displayName Line-by-line File Input
+ * @category Input
+ * @tags fs, file, line, lines, input operator
+ */
+public class LineByLineFileInputOperator extends AbstractFileInputOperator<String>
+{
+ public final transient DefaultOutputPort<String> output = new DefaultOutputPort<String>();
+
+ protected transient BufferedReader br;
+
+ @Override
+ protected InputStream openFile(Path path) throws IOException
+ {
+ InputStream is = super.openFile(path);
+ br = new BufferedReader(new InputStreamReader(is));
+ return is;
+ }
+
+ @Override
+ protected void closeFile(InputStream is) throws IOException
+ {
+ super.closeFile(is);
+ br.close();
+ br = null;
+ }
+
+ @Override
+ protected String readEntity() throws IOException
+ {
+ return br.readLine();
+ }
+
+ @Override
+ protected void emit(String tuple)
+ {
+ output.emit(tuple);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/5ff84b4a/library/src/test/java/com/datatorrent/lib/io/fs/AbstractFileInputOperatorTest.java
----------------------------------------------------------------------
diff --git a/library/src/test/java/com/datatorrent/lib/io/fs/AbstractFileInputOperatorTest.java b/library/src/test/java/com/datatorrent/lib/io/fs/AbstractFileInputOperatorTest.java
index 400eccc..3a8661c 100644
--- a/library/src/test/java/com/datatorrent/lib/io/fs/AbstractFileInputOperatorTest.java
+++ b/library/src/test/java/com/datatorrent/lib/io/fs/AbstractFileInputOperatorTest.java
@@ -19,7 +19,6 @@
package com.datatorrent.lib.io.fs;
import java.io.File;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -34,7 +33,7 @@ import org.junit.Test;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
-import org.apache.apex.malhar.fs.LineByLineFileInputOperator;
+import org.apache.apex.malhar.lib.fs.LineByLineFileInputOperator;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
[2/2] incubator-apex-malhar git commit: Merge branch 'APEXMALHAR-2025'
Posted by cs...@apache.org.
Merge branch 'APEXMALHAR-2025'
Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/commit/4cffeb34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/tree/4cffeb34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/diff/4cffeb34
Branch: refs/heads/master
Commit: 4cffeb34483234b2487ce1dcbb2fc9e35d4eb5a6
Parents: 6aef32d 5ff84b4
Author: Chandni Singh <cs...@apache.org>
Authored: Thu Apr 7 01:11:32 2016 -0700
Committer: Chandni Singh <cs...@apache.org>
Committed: Thu Apr 7 01:11:32 2016 -0700
----------------------------------------------------------------------
.../lib/io/fs/AbstractFileInputOperator.java | 2 +-
.../malhar/fs/LineByLineFileInputOperator.java | 75 --------------------
.../lib/fs/LineByLineFileInputOperator.java | 75 ++++++++++++++++++++
.../io/fs/AbstractFileInputOperatorTest.java | 3 +-
4 files changed, 77 insertions(+), 78 deletions(-)
----------------------------------------------------------------------