Package org.springframework.data.hadoop.fs

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


    String defaultName = "hadoopFs";
    Class<?> defaultType = FileSystem.class;

    if (ctx.containsBean(defaultName)) {
      FileSystem fs = (FileSystem) ctx.getBean(defaultName, defaultType);
      return (fs instanceof SimplerFileSystem ? fs : new SimplerFileSystem(fs));
    }

    String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(ctx, defaultType);
    if (names != null && names.length == 1) {
      return ctx.getBean(names[0], defaultType);
    }

    // sanity check
    if (detectedCfg == null) {
      log.warn(String.format(
          "No Hadoop Configuration or FileSystem detected; not binding variable '%s' to script",
          variableName));
      return null;
    }

    try {
      FileSystem fs = FileSystem.get(detectedCfg);
      return (fs instanceof SimplerFileSystem ? fs : new SimplerFileSystem(fs));
    } catch (IOException ex) {
      log.warn(String.format("Cannot create HDFS file system'; not binding variable '%s' to script",
          defaultName, defaultType, variableName), ex);
    }
View Full Code Here


    Jsr223ScriptEvaluator eval = new Jsr223ScriptEvaluator();
    eval.setLanguage("javascript");

    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

TOP

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

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.