beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesmal...@apache.org
Subject [12/50] [abbrv] incubator-beam git commit: Change visibility of FileBasedSource subclass methods and fix return types for existing subclasses.
Date Fri, 26 Feb 2016 22:54:49 GMT
Change visibility of FileBasedSource subclass methods and fix return types for existing subclasses.

Limit createForSubrangeOfFile and createSingleFileReader to
protected for FileBasedSource and all of its subclasses.
Also change the return type for subclasses to return
FileBasedSource and FileBasedReader instead of the specific
types.

Note that these methods were meant to be used only by the
FileBasedSource/BlockBasedSource and not called by users
but if they did, this change would be backwards incompatible
because of the return type and visibility changes.

This is for Apache Beam.

----Release Notes----

[]
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=115301831


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/c0a814b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/c0a814b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/c0a814b8

Branch: refs/heads/master
Commit: c0a814b89bcbcb3541591f7eccd7db5ada2b0a17
Parents: 24288e7
Author: lcwik <lcwik@google.com>
Authored: Mon Feb 22 21:01:59 2016 -0800
Committer: Davor Bonaci <davorbonaci@users.noreply.github.com>
Committed: Thu Feb 25 23:58:26 2016 -0800

----------------------------------------------------------------------
 .../main/java/com/google/cloud/dataflow/sdk/io/AvroSource.java  | 4 ++--
 .../java/com/google/cloud/dataflow/sdk/io/BlockBasedSource.java | 4 ++--
 .../main/java/com/google/cloud/dataflow/sdk/io/XmlSource.java   | 4 ++--
 .../com/google/cloud/dataflow/sdk/io/FileBasedSourceTest.java   | 5 +++--
 4 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c0a814b8/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/AvroSource.java
----------------------------------------------------------------------
diff --git a/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/AvroSource.java b/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/AvroSource.java
index da8458c..297663e 100644
--- a/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/AvroSource.java
+++ b/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/AvroSource.java
@@ -242,7 +242,7 @@ public class AvroSource<T> extends BlockBasedSource<T> {
   }
 
   @Override
-  public AvroSource<T> createForSubrangeOfFile(String fileName, long start, long end)
{
+  public BlockBasedSource<T> createForSubrangeOfFile(String fileName, long start, long
end) {
     byte[] syncMarker = this.syncMarker;
     String codec = this.codec;
     String readSchemaString = this.readSchemaString;
@@ -274,7 +274,7 @@ public class AvroSource<T> extends BlockBasedSource<T> {
   }
 
   @Override
-  public AvroReader<T> createSingleFileReader(PipelineOptions options) {
+  protected BlockBasedReader<T> createSingleFileReader(PipelineOptions options) {
     return new AvroReader<T>(this);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c0a814b8/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/BlockBasedSource.java
----------------------------------------------------------------------
diff --git a/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/BlockBasedSource.java b/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/BlockBasedSource.java
index 9ef4cdc..f4a9c7d 100644
--- a/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/BlockBasedSource.java
+++ b/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/BlockBasedSource.java
@@ -81,14 +81,14 @@ public abstract class BlockBasedSource<T> extends FileBasedSource<T>
{
    * Creates a {@code BlockBasedSource} for the specified range in a single file.
    */
   @Override
-  public abstract BlockBasedSource<T> createForSubrangeOfFile(
+  protected abstract BlockBasedSource<T> createForSubrangeOfFile(
       String fileName, long start, long end);
 
   /**
    * Creates a {@code BlockBasedReader}.
    */
   @Override
-  public abstract BlockBasedReader<T> createSingleFileReader(PipelineOptions options);
+  protected abstract BlockBasedReader<T> createSingleFileReader(PipelineOptions options);
 
   /**
    * A {@code Block} represents a block of records that can be read.

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c0a814b8/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/XmlSource.java
----------------------------------------------------------------------
diff --git a/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/XmlSource.java b/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/XmlSource.java
index 668361b..d684d22 100644
--- a/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/XmlSource.java
+++ b/sdk/src/main/java/com/google/cloud/dataflow/sdk/io/XmlSource.java
@@ -183,13 +183,13 @@ public class XmlSource<T> extends FileBasedSource<T> {
   }
 
   @Override
-  public FileBasedSource<T> createForSubrangeOfFile(String fileName, long start, long
end) {
+  protected FileBasedSource<T> createForSubrangeOfFile(String fileName, long start,
long end) {
     return new XmlSource<T>(
         fileName, getMinBundleSize(), start, end, rootElement, recordElement, recordClass);
   }
 
   @Override
-  public FileBasedReader<T> createSingleFileReader(PipelineOptions options) {
+  protected FileBasedReader<T> createSingleFileReader(PipelineOptions options) {
     return new XMLReader<T>(this);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c0a814b8/sdk/src/test/java/com/google/cloud/dataflow/sdk/io/FileBasedSourceTest.java
----------------------------------------------------------------------
diff --git a/sdk/src/test/java/com/google/cloud/dataflow/sdk/io/FileBasedSourceTest.java b/sdk/src/test/java/com/google/cloud/dataflow/sdk/io/FileBasedSourceTest.java
index d50c6a6..7cf4398 100644
--- a/sdk/src/test/java/com/google/cloud/dataflow/sdk/io/FileBasedSourceTest.java
+++ b/sdk/src/test/java/com/google/cloud/dataflow/sdk/io/FileBasedSourceTest.java
@@ -112,12 +112,13 @@ public class FileBasedSourceTest {
     }
 
     @Override
-    public FileBasedSource<String> createForSubrangeOfFile(String fileName, long start,
long end) {
+    protected FileBasedSource<String> createForSubrangeOfFile(
+        String fileName, long start, long end) {
       return new TestFileBasedSource(fileName, getMinBundleSize(), start, end, splitHeader);
     }
 
     @Override
-    public FileBasedReader<String> createSingleFileReader(PipelineOptions options)
{
+    protected FileBasedReader<String> createSingleFileReader(PipelineOptions options)
{
       if (splitHeader == null) {
         return new TestReader(this);
       } else {


Mime
View raw message