
alluxio.shell.command.MountCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alluxio-shell Show documentation
Show all versions of alluxio-shell Show documentation
A Linux shell-like interface to interact with Alluxio
/*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the “License”). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.shell.command;
import alluxio.AlluxioURI;
import alluxio.Configuration;
import alluxio.client.file.FileSystem;
import alluxio.exception.AlluxioException;
import org.apache.commons.cli.CommandLine;
import java.io.IOException;
import javax.annotation.concurrent.ThreadSafe;
/**
* Mounts a UFS path onto an Alluxio path.
*/
@ThreadSafe
public final class MountCommand extends AbstractShellCommand {
/**
* @param conf the configuration for Alluxio
* @param fs the filesystem of Alluxio
*/
public MountCommand(Configuration conf, FileSystem fs) {
super(conf, fs);
}
@Override
public String getCommandName() {
return "mount";
}
@Override
protected int getNumOfArgs() {
return 2;
}
@Override
public void run(CommandLine cl) throws IOException {
String[] args = cl.getArgs();
AlluxioURI alluxioPath = new AlluxioURI(args[0]);
AlluxioURI ufsPath = new AlluxioURI(args[1]);
try {
mFileSystem.mount(alluxioPath, ufsPath);
System.out.println("Mounted " + ufsPath + " at " + alluxioPath);
} catch (AlluxioException e) {
throw new IOException(e.getMessage());
}
}
@Override
public String getUsage() {
return "mount ";
}
@Override
public String getDescription() {
return "Mounts a UFS path onto an Alluxio path.";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy