List of usage examples for org.apache.hadoop.yarn.server.api.records.impl.pb MasterKeyPBImpl MasterKeyPBImpl
public MasterKeyPBImpl(MasterKeyProto proto)
From source file:io.hops.metadata.util.RMUtilities.java
License:Apache License
public static Map<RMStateStore.KeyType, MasterKey> getSecretMamagerKeys() throws IOException { LightWeightRequestHandler getNMTokenSecretMamagerCurrentKeyHandler = new LightWeightRequestHandler( YARNOperationType.TEST) {// w w w . j a v a 2 s . c om @Override public Object performTask() throws StorageException, InvalidProtocolBufferException { connector.beginTransaction(); connector.writeLock(); SecretMamagerKeysDataAccess DA = (SecretMamagerKeysDataAccess) RMStorageFactory .getDataAccess(SecretMamagerKeysDataAccess.class); List<SecretMamagerKey> hopKeys = (List<SecretMamagerKey>) DA.getAll(); connector.commit(); Map<RMStateStore.KeyType, MasterKey> keys = new EnumMap<RMStateStore.KeyType, MasterKey>( RMStateStore.KeyType.class); MasterKey key; if (hopKeys != null) { for (SecretMamagerKey hopKey : hopKeys) { key = new MasterKeyPBImpl(YarnServerCommonProtos.MasterKeyProto.parseFrom(hopKey.getKey())); keys.put(RMStateStore.KeyType.valueOf(hopKey.getKeyType()), key); } } return keys; } }; return (Map<RMStateStore.KeyType, MasterKey>) getNMTokenSecretMamagerCurrentKeyHandler.handle(); }