tachyon.command
Class TFsShell

java.lang.Object
  extended by tachyon.command.TFsShell

public class TFsShell
extends Object

Class for handling command line inputs.


Constructor Summary
TFsShell()
           
 
Method Summary
 void close()
           
 int copyFromLocal(String[] argv)
          Copies a file specified by argv from the local filesystem to the filesystem.
 int copyToLocal(String[] argv)
          Copies a file specified by argv from the filesystem to the local filesystem.
 int location(String[] argv)
          Displays a list of hosts that have the file specified in argv stored.
 int ls(String[] argv)
          Displays information for all directories and files directly under the path specified in argv.
static void main(String[] argv)
          Main method, starts a new TFsShell
 int mkdir(String[] argv)
          Creates a new directory specified by the path in argv, including any parent folders that are required.
 void printUsage()
          Method which prints the method to use all the commands.
 void printUsage(String cmd)
           
 int rename(String[] argv)
          Renames a file or directory specified by argv.
 int rm(String[] argv)
          Removes the file or directory specified by argv.
 int run(String[] argv)
          Method which determines how to handle the user's request, will display usage help to the user if command format is incorrect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TFsShell

public TFsShell()
Method Detail

printUsage

public void printUsage(String cmd)

close

public void close()

ls

public int ls(String[] argv)
       throws FileDoesNotExistException,
              InvalidPathException,
              org.apache.thrift.TException
Displays information for all directories and files directly under the path specified in argv.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occurred.
Throws:
FileDoesNotExistException
InvalidPathException
org.apache.thrift.TException

mkdir

public int mkdir(String[] argv)
          throws InvalidPathException,
                 FileAlreadyExistException
Creates a new directory specified by the path in argv, including any parent folders that are required. This method fails if a directory or file with the same path already exists.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occurred.
Throws:
InvalidPathException
FileAlreadyExistException

rm

public int rm(String[] argv)
       throws InvalidPathException,
              org.apache.thrift.TException
Removes the file or directory specified by argv. Will remove all files and directories in the directory if a directory is specified.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occurred.
Throws:
FileDoesNotExistException
InvalidPathException
org.apache.thrift.TException

rename

public int rename(String[] argv)
           throws FileDoesNotExistException,
                  InvalidPathException,
                  org.apache.thrift.TException
Renames a file or directory specified by argv. Will fail if the new path name already exists.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occurred.
Throws:
FileDoesNotExistException
InvalidPathException
org.apache.thrift.TException

copyToLocal

public int copyToLocal(String[] argv)
                throws FileDoesNotExistException,
                       InvalidPathException,
                       org.apache.thrift.TException,
                       IOException
Copies a file specified by argv from the filesystem to the local filesystem.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occurred.
Throws:
FileDoesNotExistException
InvalidPathException
org.apache.thrift.TException
IOException

location

public int location(String[] argv)
             throws FileDoesNotExistException,
                    InvalidPathException,
                    IOException,
                    org.apache.thrift.TException
Displays a list of hosts that have the file specified in argv stored.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occurred.
Throws:
FileDoesNotExistException
InvalidPathException
IOException
org.apache.thrift.TException

copyFromLocal

public int copyFromLocal(String[] argv)
                  throws FileNotFoundException,
                         InvalidPathException,
                         IOException,
                         FileAlreadyExistException
Copies a file specified by argv from the local filesystem to the filesystem. Will fail if the path given already exists in the filesystem.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occurred.
Throws:
FileDoesNotExistException
InvalidPathException
IOException
FileNotFoundException
FileAlreadyExistException

printUsage

public void printUsage()
Method which prints the method to use all the commands.


main

public static void main(String[] argv)
                 throws org.apache.thrift.TException
Main method, starts a new TFsShell

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Throws:
org.apache.thrift.TException

run

public int run(String[] argv)
        throws org.apache.thrift.TException
Method which determines how to handle the user's request, will display usage help to the user if command format is incorrect.

Parameters:
argv[] - Array of arguments given by the user's input from the terminal
Returns:
0 if command is successful, -1 if an error occured
Throws:
org.apache.thrift.TException


Copyright © 2013. All Rights Reserved.