Пример #1
0
 public static Token<BlockTokenIdentifier> fromProto(HdfsProtos.BlockTokenIdentifierProto proto) {
   return new Token<BlockTokenIdentifier>(
       proto.getIdentifier().toByteArray(),
       proto.getPassword().toByteArray(),
       new Text(proto.getKind()),
       new Text(proto.getService()));
 }
Пример #2
0
 public static HdfsProtos.BlockTokenIdentifierProto toProto(Token<?> blockToken) {
   return HdfsProtos.BlockTokenIdentifierProto.newBuilder()
       .setIdentifier(ByteString.copyFrom(blockToken.getIdentifier()))
       .setPassword(ByteString.copyFrom(blockToken.getPassword()))
       .setKind(blockToken.getKind().toString())
       .setService(blockToken.getService().toString())
       .build();
 }