Example usage for org.apache.hadoop.hdfs.security.token.delegation DelegationTokenIdentifier stringifyToken

List of usage examples for org.apache.hadoop.hdfs.security.token.delegation DelegationTokenIdentifier stringifyToken

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.security.token.delegation DelegationTokenIdentifier stringifyToken.

Prototype

public static String stringifyToken(final Token<?> token) throws IOException 

Source Link

Usage

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * @see ClientProtocol#getDelegationToken(Text)
 *//*from  w  w w  .j av a 2  s.c o  m*/
public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer) throws IOException {
    assert dtService != null;
    TraceScope scope = Trace.startSpan("getDelegationToken", traceSampler);
    try {
        Token<DelegationTokenIdentifier> token = namenode.getDelegationToken(renewer);
        if (token != null) {
            token.setService(this.dtService);
            LOG.info("Created " + DelegationTokenIdentifier.stringifyToken(token));
        } else {
            LOG.info("Cannot get delegation token from " + renewer);
        }
        return token;
    } finally {
        scope.close();
    }
}

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Renew a delegation token/*from   w w  w . j a v  a 2s  .c o  m*/
 * 
 * @param token
 *            the token to renew
 * @return the new expiration time
 * @throws InvalidToken
 * @throws IOException
 * @deprecated Use Token.renew instead.
 */
@Deprecated
public long renewDelegationToken(Token<DelegationTokenIdentifier> token) throws InvalidToken, IOException {
    LOG.info("Renewing " + DelegationTokenIdentifier.stringifyToken(token));
    try {
        return token.renew(conf);
    } catch (InterruptedException ie) {
        throw new RuntimeException("caught interrupted", ie);
    } catch (RemoteException re) {
        throw re.unwrapRemoteException(InvalidToken.class, AccessControlException.class);
    }
}

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Cancel a delegation token/*from w w  w.java2s . co m*/
 * 
 * @param token
 *            the token to cancel
 * @throws InvalidToken
 * @throws IOException
 * @deprecated Use Token.cancel instead.
 */
@Deprecated
public void cancelDelegationToken(Token<DelegationTokenIdentifier> token) throws InvalidToken, IOException {
    LOG.info("Cancelling " + DelegationTokenIdentifier.stringifyToken(token));
    try {
        token.cancel(conf);
    } catch (InterruptedException ie) {
        throw new RuntimeException("caught interrupted", ie);
    } catch (RemoteException re) {
        throw re.unwrapRemoteException(InvalidToken.class, AccessControlException.class);
    }
}