/** * Write contents of this instance as CredentialsProto message to DataOutput. * @param out * @throws IOException */ void writeProto(DataOutput out) throws IOException { CredentialsProto.Builder storage = CredentialsProto.newBuilder(); for (Map.Entry<Text, Token<? extends TokenIdentifier>> e : tokenMap.entrySet()) { CredentialsKVProto.Builder kv = CredentialsKVProto.newBuilder(). setAliasBytes(ByteString.copyFrom( e.getKey().getBytes(), 0, e.getKey().getLength())). setToken(e.getValue().toTokenProto()); storage.addTokens(kv.build()); } for(Map.Entry<Text, byte[]> e : secretKeysMap.entrySet()) { CredentialsKVProto.Builder kv = CredentialsKVProto.newBuilder(). setAliasBytes(ByteString.copyFrom( e.getKey().getBytes(), 0, e.getKey().getLength())). setSecret(ByteString.copyFrom(e.getValue())); storage.addSecrets(kv.build()); } storage.build().writeDelimitedTo((DataOutputStream)out); }
/** * <code>repeated .hadoop.common.CredentialsKVProto tokens = 1;</code> */ public Builder addTokens( org.apache.hadoop.security.proto.SecurityProtos.CredentialsKVProto.Builder builderForValue) { if (tokensBuilder_ == null) { ensureTokensIsMutable(); tokens_.add(builderForValue.build()); onChanged(); } else { tokensBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <code>repeated .hadoop.common.CredentialsKVProto secrets = 2;</code> */ public Builder addSecrets( org.apache.hadoop.security.proto.SecurityProtos.CredentialsKVProto.Builder builderForValue) { if (secretsBuilder_ == null) { ensureSecretsIsMutable(); secrets_.add(builderForValue.build()); onChanged(); } else { secretsBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <code>repeated .hadoop.common.CredentialsKVProto secrets = 2;</code> */ public Builder addSecrets( int index, org.apache.hadoop.security.proto.SecurityProtos.CredentialsKVProto.Builder builderForValue) { if (secretsBuilder_ == null) { ensureSecretsIsMutable(); secrets_.add(index, builderForValue.build()); onChanged(); } else { secretsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .hadoop.common.CredentialsKVProto secrets = 2;</code> */ public Builder setSecrets( int index, org.apache.hadoop.security.proto.SecurityProtos.CredentialsKVProto.Builder builderForValue) { if (secretsBuilder_ == null) { ensureSecretsIsMutable(); secrets_.set(index, builderForValue.build()); onChanged(); } else { secretsBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .hadoop.common.CredentialsKVProto tokens = 1;</code> */ public Builder addTokens( int index, org.apache.hadoop.security.proto.SecurityProtos.CredentialsKVProto.Builder builderForValue) { if (tokensBuilder_ == null) { ensureTokensIsMutable(); tokens_.add(index, builderForValue.build()); onChanged(); } else { tokensBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .hadoop.common.CredentialsKVProto tokens = 1;</code> */ public Builder setTokens( int index, org.apache.hadoop.security.proto.SecurityProtos.CredentialsKVProto.Builder builderForValue) { if (tokensBuilder_ == null) { ensureTokensIsMutable(); tokens_.set(index, builderForValue.build()); onChanged(); } else { tokensBuilder_.setMessage(index, builderForValue.build()); } return this; } /**