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

The following examples show how to use org.springframework.data.hadoop.fs.FsShell. 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 File: AppDeployerIT.java    From spring-cloud-deployer-yarn with 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 File: TaskLauncherIT.java    From spring-cloud-deployer-yarn with 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
Source File: DatasetSinkIntegrationTests.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@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 File: Application.java    From Intro-to-Spring-Hadoop with 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);
}