camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] git commit: CAMEL-7278: Added owner to camel-hdfs to only include files matching owner. Thanks to Martha Obrinteschi for patch.
Date Fri, 14 Mar 2014 10:01:48 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 7567b08e2 -> 405c667b0
  refs/heads/master f59b2e491 -> 239579a60


CAMEL-7278: Added owner to camel-hdfs to only include files matching owner. Thanks to Martha
Obrinteschi for patch.


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

Branch: refs/heads/master
Commit: cfb6121a1856653d7a2fd037143e25f35057e253
Parents: f59b2e4
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Mar 14 10:59:25 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Mar 14 11:01:03 2014 +0100

----------------------------------------------------------------------
 .../apache/camel/component/hdfs/HdfsConfiguration.java  |  9 +++++++++
 .../org/apache/camel/component/hdfs/HdfsConsumer.java   | 12 ++++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cfb6121a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
index 729fb58..13a1a06 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
@@ -52,6 +52,7 @@ public class HdfsConfiguration {
     private int checkIdleInterval = HdfsConstants.DEFAULT_CHECK_IDLE_INTERVAL;
     private List<HdfsProducer.SplitStrategy> splitStrategies;
     private boolean connectOnStartup = true;
+    private String owner;
 
     public HdfsConfiguration() {
     }
@@ -407,4 +408,12 @@ public class HdfsConfiguration {
     public void setConnectOnStartup(boolean connectOnStartup) {
         this.connectOnStartup = connectOnStartup;
     }
+
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/cfb6121a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
index 2c78740..367f418 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
@@ -120,9 +120,21 @@ public final class HdfsConsumer extends ScheduledPollConsumer {
         }
 
         for (FileStatus status : fileStatuses) {
+
             if (normalFileIsDirectoryNoSuccessFile(status, info)) {
                 continue;
             }
+
+            if (config.getOwner() != null) {
+                // must match owner
+                if (!config.getOwner().equals(status.getOwner())) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Skipping file: {} as not matching owner: {}", status.getPath().toString(),
config.getOwner());
+                    }
+                    continue;
+                }
+            }
+
             try {
                 this.rwlock.writeLock().lock();
                 this.istream = HdfsInputStream.createInputStream(status.getPath().toString(),
this.config);


Mime
View raw message