private static void parseOptions ( String args [ ] ) { if ( ! ( args . length == 14 || args . length == 12 || args . length == 5 ) ) { usage ( ) ; } /* * As described in usage(): * -s dfs-server * -p dfs-port [-t [create|create-write|stat|readdir|read|rename|delete] * -a planfile-path * -c host * -n process-name * -P prefix */ for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equals ( "-s" ) && i + 1 < args . length ) { dfsServer_ = args [ i + 1 ] ; System . out . println ( args [ i + 1 ] ) ; i ++ ; } else if ( args [ i ] . equals ( "-p" ) && i + 1 < args . length ) { dfsPort_ = Integer . parseInt ( args [ i + 1 ] ) ; System . out . println ( args [ i + 1 ] ) ; i ++ ; } else if ( args [ i ] . equals ( "-t" ) && i + 1 < args . length ) { testName_ = args [ i + 1 ] ; System . out . println ( args [ i + 1 ] ) ; i ++ ; } else if ( args [ i ] . equals ( "-a" ) && i + 1 < args . length ) { planfilePath_ = args [ i + 1 ] ; System . out . println ( args [ i + 1 ] ) ; i ++ ; } else if ( args [ i ] . equals ( "-c" ) && i + 1 < args . length ) { hostName_ = args [ i + 1 ] ; System . out . println ( args [ i + 1 ] ) ; i ++ ; } else if ( args [ i ] . equals ( "-n" ) && i + 1 < args . length ) { processName_ = args [ i + 1 ] ; System . out . println ( args [ i + 1 ] ) ; i ++ ; } else if ( args [ i ] . equals ( "-P" ) && i + 1 < args . length ) { prefix_ = args [ i + 1 ] ; System . out . println ( args [ i + 1 ] ) ; i ++ ; } } if ( dfsServer_ . length ( ) == 0 || testName_ . length ( ) == 0 || planfilePath_ . length ( ) == 0 || hostName_ . length ( ) == 0 || processName_ . length ( ) == 0 || dfsPort_ == 0 ) { usage ( ) ; } if ( prefix_ == null ) { prefix_ = new String ( "PATH_PREFIX_" ) ; } prefixLen_ = prefix_ . length ( ) ; }
Parses command line options . the hostName processName are used to namespace the files created by this instance of the benchmark .