private void processGeneralOptions ( Configuration conf , CommandLine line ) { if ( line . hasOption ( "fs" ) ) { FileSystem . setDefaultUri ( conf , line . getOptionValue ( "fs" ) ) ; } if ( line . hasOption ( "jt" ) ) { conf . set ( "mapred.job.tracker" , line . getOptionValue ( "jt" ) ) ; } if ( line . hasOption ( "conf" ) ) { String [ ] values = line . getOptionValues ( "conf" ) ; for ( String value : values ) { conf . addResource ( new Path ( value ) ) ; } } try { if ( line . hasOption ( "libjars" ) ) { conf . set ( "tmpjars" , validateFiles ( line . getOptionValue ( "libjars" ) , conf ) ) ; //setting libjars in client classpath URL [ ] libjars = getLibJars ( conf ) ; if ( libjars != null && libjars . length > 0 ) { conf . setClassLoader ( new URLClassLoader ( libjars , conf . getClassLoader ( ) ) ) ; Thread . currentThread ( ) . setContextClassLoader ( new URLClassLoader ( libjars , Thread . currentThread ( ) . getContextClassLoader ( ) ) ) ; } } if ( line . hasOption ( "files" ) ) { conf . set ( "tmpfiles" , validateFiles ( line . getOptionValue ( "files" ) , conf ) ) ; } if ( line . hasOption ( "archives" ) ) { conf . set ( "tmparchives" , validateFiles ( line . getOptionValue ( "archives" ) , conf ) ) ; } } catch ( IOException ioe ) { System . err . println ( StringUtils . stringifyException ( ioe ) ) ; } if ( line . hasOption ( ' ' ) ) { String [ ] property = line . getOptionValues ( ' ' ) ; for ( String prop : property ) { String [ ] keyval = prop . split ( "=" , 2 ) ; if ( keyval . length == 2 ) { conf . set ( keyval [ 0 ] , keyval [ 1 ] ) ; } } } conf . setBoolean ( "mapred.used.genericoptionsparser" , true ) ; }
Modify configuration according user - specified generic options