Package org.springframework.data.hadoop.fs

Examples of org.springframework.data.hadoop.fs.FsShell


    }
    configuration = null;
  }

  protected void listFiles(Configuration configuration) {
    @SuppressWarnings("resource")
    FsShell shell = new FsShell(configuration);
    for (FileStatus s : shell.ls(true, "/")) {
      log.info("status " + s);
    }
  }
View Full Code Here


      log.info("status " + s);
    }
  }

  protected void catFile(String path) {
    @SuppressWarnings("resource")
    FsShell shell = new FsShell(configuration);
    Collection<String> text = shell.text(path);
    if (text.size() == 1) {
      log.info(text.iterator().next());
    }
  }
View Full Code Here

      writer.write(pojo);
    };
    writer.flush();
    writer.close();

    FsShell fsShell = new FsShell(getConfiguration());
    assertTrue(fsShell.ls(true, path + "/test/" + datasetTemplete.getDatasetName(SimplePojo.class) + "/year=1997/month=05/*.avro").size() >= 2);
    assertTrue(fsShell.ls(true, path + "/test/" + datasetTemplete.getDatasetName(SimplePojo.class) + "/year=1997/month=11/*.avro").size() >= 2);
    assertTrue(fsShell.ls(true, path + "/test/" + datasetTemplete.getDatasetName(SimplePojo.class) + "/year=1997/month=12/*.avro").size() >= 2);
  }
View Full Code Here

      writer.write(pojo);
    };
    writer.flush();
    writer.close();

    FsShell fsShell = new FsShell(getConfiguration());
    assertEquals(1, fsShell.ls(true, path + "/test/" + datasetTemplete.getDatasetName(SimplePojo.class) + "/year=1997/month=05/*.avro").size());
    assertEquals(1, fsShell.ls(true, path + "/test/" + datasetTemplete.getDatasetName(SimplePojo.class) + "/year=1997/month=11/*.avro").size());
    assertEquals(1, fsShell.ls(true, path + "/test/" + datasetTemplete.getDatasetName(SimplePojo.class) + "/year=1997/month=12/*.avro").size());
  }
 
View Full Code Here

      if (cfg == null) {
        log.warn(String.format(
            "No Hadoop Configuration detected; not binding FsShell as variable '%s' to script", name));
      }
      else {
        putIfAbsent(args, name, new FsShell(cfg, fs));
      }
    }

    putIfAbsent(args, "cl", ctx.getClassLoader());
    putIfAbsent(args, "ctxRL", ctx);
View Full Code Here

    Map<String, Object> args = new LinkedHashMap<String, Object>();
    FileSystem fs = FileSystem.get(config);
    SimplerFileSystem sfs = new SimplerFileSystem(fs);
   
    args.put("fs", sfs);
    args.put("fsh", new FsShell(config, sfs));

    eval.evaluate(script, args);
  }
View Full Code Here

        "/META-INF/spring/pig-context-password-repository.xml", PigAppWithRepository.class);
    log.info("Pig Application Running");
    context.registerShutdownHook()

    String outputDir = "/data/password-repo/output";   
    FsShell fsShell = context.getBean(FsShell.class);
    if (fsShell.test(outputDir)) {
      fsShell.rmr(outputDir);
    }
   
    PasswordRepository repo = context.getBean(PigPasswordRepository.class);
    repo.processPasswordFile("/data/passwd/input");
   
View Full Code Here

  @OnContainerStart
  public void publicVoidNoArgsMethod() {
    log.info("Hello from HelloPojo");
    log.info("About to list from hdfs root content");

    @SuppressWarnings("resource")
    FsShell shell = new FsShell(configuration);
    for (FileStatus s : shell.ls(false, "/")) {
      log.info(s);
    }
  }
View Full Code Here

    Assert.notNull(xdEnvironment, "xdEnvironment can not be null");
    this.nameNode = xdEnvironment.getNameNode();

    hadoopConfiguration = new Configuration();
    FileSystem.setDefaultUri(hadoopConfiguration, nameNode);
    shell = new FsShell(hadoopConfiguration);
    dataNodePort = xdEnvironment.getDataNodePort();
  }
View Full Code Here

    this.rolloverThresholdInBytes = rolloverThresholdInBytes;
  }

  protected void initializeCounterIfNecessary() {
    if (!initialized) {
      FsShell fsShell = new FsShell(getFileSystem().getConf(), getFileSystem());
      try {
        if (!fsShell.test(getBasePath())) {
          fsShell.mkdir(getBasePath());
        }
        int maxCounter = 0;
        boolean foundFile = false;
        Collection<FileStatus> fileStats = fsShell.ls(this.getBasePath());
        for (FileStatus fileStatus : fileStats) {
          String shortName = fileStatus.getPath().getName();
          int counterFromName = getCounterFromName(shortName);
          if (counterFromName != -1) {
            foundFile = true;
View Full Code Here

TOP

Related Classes of org.springframework.data.hadoop.fs.FsShell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.