Example usage for org.apache.hadoop.fs FsShell main

List of usage examples for org.apache.hadoop.fs FsShell main

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FsShell main.

Prototype

public static void main(String argv[]) throws Exception 

Source Link

Document

main() has some simple utility methods

Usage

From source file:com.cloudera.hue.SudoFsShell.java

License:Apache License

public static void main(String[] args) throws Exception {
    if (args.length < 1) {
        usage();//from   ww  w .j av a 2 s  .  c o m
        System.exit(1);
    }

    String username = args[0];
    final String shellArgs[] = new String[args.length - 1];
    System.arraycopy(args, 1, shellArgs, 0, args.length - 1);

    UserGroupInformation sudoUgi;
    if (UserGroupInformation.isSecurityEnabled()) {
        sudoUgi = UserGroupInformation.createProxyUser(username, UserGroupInformation.getCurrentUser());
    } else {
        sudoUgi = UserGroupInformation.createRemoteUser(username);
    }

    sudoUgi.doAs(new PrivilegedExceptionAction<Void>() {
        public Void run() throws Exception {
            FsShell.main(shellArgs);
            return null;
        }
    });
}

From source file:io.aos.hadoop.HdfsFsShell.java

License:Apache License

public static void main(String... args) throws Exception {
    FsShell.main(new String[] { "-ls", "/" });
}