Guest User

Untitled

a guest
Jul 16th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.95 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.nio.file.FileVisitResult;
  3. import java.nio.file.FileVisitor;
  4. import java.nio.file.Files;
  5. import java.nio.file.Path;
  6. import java.nio.file.Paths;
  7. import java.nio.file.SimpleFileVisitor;
  8. import java.nio.file.attribute.BasicFileAttributes;
  9. import java.util.Map;
  10.  
  11. import org.apache.spark.SparkConf;
  12. import scala.Tuple2;
  13.  
  14. public class App {
  15.  
  16.   public static void main(String[] args) throws IOException {
  17.     SparkConf sparkConf = new SparkConf();
  18.  
  19.     System.out.println("SPARK PROPERTIES");
  20.  
  21.     for (Tuple2<String, String> entry : sparkConf.getAll()) {
  22.       System.out.println(entry._1() + " -> " + entry._2());
  23.     }
  24.  
  25.     System.out.println();
  26.     System.out.println();
  27.  
  28.     System.out.println("JAVA PROPERTIES");
  29.     for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
  30.       System.out.println(entry.getKey() + " -> " + entry.getValue());
  31.     }
  32.  
  33.     System.out.println();
  34.     System.out.println();
  35.  
  36.     System.out.println("ENVIRONMENT VARIABLES PROPERTIES");
  37.     for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
  38.       System.out.println(entry.getKey() + " -> " + entry.getValue());
  39.     }
  40.  
  41.     System.out.println();
  42.     System.out.println();
  43.  
  44.     System.out.println("FILE LISTING");
  45.     String ROOT = ".";
  46.     FileVisitor<Path> fileProcessor = new ProcessFile();
  47.     Files.walkFileTree(Paths.get(ROOT), fileProcessor);
  48.   }
  49.  
  50.   private static final class ProcessFile extends SimpleFileVisitor<Path> {
  51.  
  52.     @Override
  53.     public FileVisitResult visitFile(Path aFile, BasicFileAttributes aAttrs) throws IOException {
  54.       System.out.println("Processing file:" + aFile);
  55.       return FileVisitResult.CONTINUE;
  56.     }
  57.  
  58.     @Override
  59.     public FileVisitResult preVisitDirectory(Path aDir, BasicFileAttributes aAttrs) throws IOException {
  60.       System.out.println("Processing directory:" + aDir);
  61.       return FileVisitResult.CONTINUE;
  62.     }
  63.   }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment