Examples of HdfsResourceLoader


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

    this.splitter = splitter;
  }

  private Set<Resource> resolveResources() throws IOException {
    Set<Resource> resources = new HashSet<Resource>();
    HdfsResourceLoader loader = new HdfsResourceLoader(getConfiguration());
    if (inputPatterns != null) {
      for (String pattern : inputPatterns) {
        resources.addAll(Arrays.asList(loader.getResources(pattern)));
      }
    }
    loader.close();
    return resources;
  }
View Full Code Here

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

          variableName));
      return null;
    }

    // create one instance
    return new HdfsResourceLoader(cfg);
  }
View Full Code Here

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

      // ignore
    }
  }

  public static Resource mkdir(Configuration cfg, String dir) {
    HdfsResourceLoader loader = new HdfsResourceLoader(cfg);
    try {
      Resource resource = loader.getResource(dir);
      FileSystem fs = ((HdfsResourceLoader) loader).getFileSystem();
      fs.mkdirs(new Path(resource.getURI()));
      return loader.getResource(dir);
    } catch (IOException ex) {
      try {
        loader.close();
      } catch (IOException ioe) {
      }
      throw new IllegalArgumentException(ex);
    }
View Full Code Here

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

    }

  }

  public static Resource writeToFS(Configuration cfg, String filename) {
    return writeToFS(new HdfsResourceLoader(cfg), filename);
  }
View Full Code Here

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

  @Resource(name = HadoopSystemConstants.DEFAULT_ID_RESOURCE_LOADER_REGISTRAR)
  private CustomResourceLoaderRegistrar registrar;

  @Test
  public void testRegistrarExists() throws Exception {
    HdfsResourceLoader fromRegistrar = TestUtils.readField("loader", registrar);
    assertThat(loader, sameInstance(fromRegistrar));
  }
View Full Code Here

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

    ctx.registerShutdownHook();

    FileSystem fs = FileSystem.get(ctx.getBean(Configuration.class));
    System.out.println("FS is " + fs.getClass().getName());
    HdfsResourceLoader hrl = ctx.getBean(HdfsResourceLoader.class);
    Resource resource = hrl.getResource("/ide-test/output/word/");

    assertTrue(ctx.isPrototype("script-tasklet"));

    fs.delete(new Path(resource.getURI().toString()), true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.