Java Code Examples for org.springframework.data.hadoop.fs.FsShell

The following examples show how to use org.springframework.data.hadoop.fs.FsShell. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-cloud-deployer-yarn   Source File: AppDeployerIT.java    License: Apache License 2.0 5 votes vote down vote up
private void copyFile(Resource artifact, String dir) throws Exception {
	File tmp = File.createTempFile(UUID.randomUUID().toString(), null);
	FileCopyUtils.copy(artifact.getInputStream(), new FileOutputStream(tmp));
	@SuppressWarnings("resource")
	FsShell shell = new FsShell(getConfiguration());
	String artifactPath = dir + artifact.getFile().getName();
	if (!shell.test(artifactPath)) {
		shell.copyFromLocal(tmp.getAbsolutePath(), dir + artifact.getFile().getName());
	}
}
 
Example 2
Source Project: spring-cloud-deployer-yarn   Source File: TaskLauncherIT.java    License: Apache License 2.0 5 votes vote down vote up
private void copyFile(Resource artifact, String dir) throws Exception {
	File tmp = File.createTempFile(UUID.randomUUID().toString(), null);
	FileCopyUtils.copy(artifact.getInputStream(), new FileOutputStream(tmp));
	@SuppressWarnings("resource")
	FsShell shell = new FsShell(getConfiguration());
	String artifactPath = dir + artifact.getFile().getName();
	if (!shell.test(artifactPath)) {
		shell.copyFromLocal(tmp.getAbsolutePath(), dir + artifact.getFile().getName());
	}
}
 
Example 3
@Before
public void setup() throws IOException {
	FileSystem fs = FileSystem.get(hadoopConfiguration);
	FsShell fsShell = new FsShell(hadoopConfiguration, fs);
	if (fsShell.test(testDir)) {
		fsShell.rmr(testDir);
	}
}
 
Example 4
Source Project: Intro-to-Spring-Hadoop   Source File: Application.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
FsShell fsShell() {
    org.apache.hadoop.conf.Configuration hadoopConfiguration =
            new org.apache.hadoop.conf.Configuration();
    hadoopConfiguration.set("fs.defaultFS", "hdfs://borneo:8020");
    return new FsShell(hadoopConfiguration);
}