@ Override public Token < ? > addDelegationTokens ( Configuration conf , Credentials creds , String renewer , String url ) throws Exception { if ( ! url . startsWith ( SCHEME ) ) { url = SCHEME + "://" + url ; } FileSystem fs = FileSystem . get ( URI . create ( url ) , conf ) ; Token < ? > token = fs . getDelegationToken ( renewer ) ; if ( token == null ) { throw new DelegationTokenIOException ( "Filesystem not generating Delegation Tokens: " + url ) ; } creds . addToken ( token . getService ( ) , token ) ; return token ; }
Returns Token object via FileSystem null if bad argument .