List of usage examples for org.apache.hadoop.security.token.delegation AbstractDelegationTokenIdentifier getRenewer
public Text getRenewer()
From source file:org.apache.slider.core.launch.CredentialUtils.java
License:Apache License
/** * Create a string for people to look at * @param token token to convert to a string form * @return a printable view of the token */// w w w.ja va2 s .c o m public static String tokenToString(Token<? extends TokenIdentifier> token) { DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); StringBuilder buffer = new StringBuilder(128); buffer.append(token.toString()); try { TokenIdentifier ti = token.decodeIdentifier(); buffer.append("; ").append(ti); if (ti instanceof AbstractDelegationTokenIdentifier) { // details in human readable form, and compensate for information HDFS DT omits AbstractDelegationTokenIdentifier dt = (AbstractDelegationTokenIdentifier) ti; buffer.append("; Renewer: ").append(dt.getRenewer()); buffer.append("; Issued: ").append(df.format(new Date(dt.getIssueDate()))); buffer.append("; Max Date: ").append(df.format(new Date(dt.getMaxDate()))); } } catch (IOException e) { //marshall problem; not ours LOG.debug("Failed to decode {}: {}", token, e, e); } return buffer.toString(); }