Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. package ru.at_consulting.bigdata.wordcount.system;
  2.  
  3. import org.apache.hadoop.conf.Configuration;
  4. import org.apache.hadoop.conf.Configured;
  5. import org.apache.hadoop.fs.FileSystem;
  6. import org.apache.hadoop.fs.Path;
  7. import org.apache.hadoop.fs.PathFilter;
  8.  
  9. import java.io.IOException;
  10.  
  11.  
  12. /**
  13.  * Created by Evzerov E
  14.  */
  15. public class DatePathFilter extends Configured implements PathFilter {
  16.  
  17.     FileSystem fs;
  18.  
  19.     @Override
  20.     public boolean accept(Path path) {
  21.  
  22.         try {
  23.             return !fs.isDirectory(path) || (path.toString().contains("dir1"));
  24.         } catch (IOException e) {
  25.             e.printStackTrace();
  26.             return false;
  27.         }
  28.     }
  29.  
  30.     @Override
  31.     public void setConf(Configuration conf) {
  32.         if (conf != null) {
  33.             try {
  34.                 fs = FileSystem.get(conf);
  35.             } catch (Exception ex) {
  36.                 ex.printStackTrace();
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement