本文整理汇总了Java中org.apache.hadoop.security.token.delegation.DelegationKey.write方法的典型用法代码示例。如果您正苦于以下问题:Java DelegationKey.write方法的具体用法?Java DelegationKey.write怎么用?Java DelegationKey.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.security.token.delegation.DelegationKey
的用法示例。
在下文中一共展示了DelegationKey.write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeRMDTMasterKeyState
import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
@Override
protected void storeRMDTMasterKeyState(DelegationKey masterKey)
throws IOException {
String dbKey = getRMDTMasterKeyNodeKey(masterKey);
if (LOG.isDebugEnabled()) {
LOG.debug("Storing token master key to " + dbKey);
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(os);
try {
masterKey.write(out);
} finally {
out.close();
}
try {
db.put(bytes(dbKey), os.toByteArray());
} catch (DBException e) {
throw new IOException(e);
}
}
示例2: storeRMDTMasterKeyState
import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
@Override
protected synchronized void storeRMDTMasterKeyState(
DelegationKey delegationKey) throws Exception {
String nodeCreatePath =
getNodePath(dtMasterKeysRootPath, DELEGATION_KEY_PREFIX
+ delegationKey.getKeyId());
ByteArrayOutputStream os = new ByteArrayOutputStream();
DataOutputStream fsOut = new DataOutputStream(os);
if (LOG.isDebugEnabled()) {
LOG.debug("Storing RMDelegationKey_" + delegationKey.getKeyId());
}
delegationKey.write(fsOut);
try {
createWithRetries(nodeCreatePath, os.toByteArray(), zkAcl,
CreateMode.PERSISTENT);
} finally {
os.close();
}
}
示例3: storeTokenMasterKey
import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
@Override
public void storeTokenMasterKey(DelegationKey masterKey)
throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("Storing master key " + masterKey.getKeyId());
}
ByteArrayOutputStream memStream = new ByteArrayOutputStream();
DataOutputStream dataStream = new DataOutputStream(memStream);
try {
masterKey.write(dataStream);
dataStream.close();
dataStream = null;
} finally {
IOUtils.cleanup(LOG, dataStream);
}
String dbKey = getTokenMasterKeyDatabaseKey(masterKey);
try {
db.put(bytes(dbKey), memStream.toByteArray());
} catch (DBException e) {
throw new IOException(e);
}
}
示例4: storeTokenMasterKey
import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
@Override
public void storeTokenMasterKey(DelegationKey key) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("Storing master key " + key.getKeyId());
}
Path keyPath = new Path(tokenKeysStatePath,
TOKEN_MASTER_KEY_FILE_PREFIX + key.getKeyId());
if (fs.exists(keyPath)) {
throw new IOException(keyPath + " already exists");
}
ByteArrayOutputStream memStream = new ByteArrayOutputStream();
DataOutputStream dataStream = new DataOutputStream(memStream);
try {
key.write(dataStream);
dataStream.close();
dataStream = null;
} finally {
IOUtils.cleanup(LOG, dataStream);
}
createNewFile(keyPath, memStream.toByteArray());
}
示例5: storeRMDTMasterKeyState
import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
@Override
protected synchronized void storeRMDTMasterKeyState(
DelegationKey delegationKey) throws Exception {
String nodeCreatePath =
getNodePath(dtMasterKeysRootPath, DELEGATION_KEY_PREFIX
+ delegationKey.getKeyId());
ByteArrayOutputStream os = new ByteArrayOutputStream();
DataOutputStream fsOut = new DataOutputStream(os);
if (LOG.isDebugEnabled()) {
LOG.debug("Storing RMDelegationKey_" + delegationKey.getKeyId());
}
delegationKey.write(fsOut);
try {
safeCreate(nodeCreatePath, os.toByteArray(), zkAcl,
CreateMode.PERSISTENT);
} finally {
os.close();
}
}
示例6: storeRMDTMasterKeyState
import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
@Override
public synchronized void storeRMDTMasterKeyState(DelegationKey masterKey)
throws Exception {
Path nodeCreatePath = getNodePath(rmDTSecretManagerRoot,
DELEGATION_KEY_PREFIX + masterKey.getKeyId());
ByteArrayOutputStream os = new ByteArrayOutputStream();
try (DataOutputStream fsOut = new DataOutputStream(os)) {
LOG.info("Storing RMDelegationKey_" + masterKey.getKeyId());
masterKey.write(fsOut);
writeFileWithRetries(nodeCreatePath, os.toByteArray(), true);
}
}
示例7: buildTokenMasterKeyData
import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
private static byte[] buildTokenMasterKeyData(DelegationKey key)
throws IOException {
ByteArrayOutputStream memStream = new ByteArrayOutputStream();
DataOutputStream dataStream = new DataOutputStream(memStream);
try {
key.write(dataStream);
dataStream.close();
} finally {
IOUtils.cleanup(LOG, dataStream);
}
return memStream.toByteArray();
}