@Override
  public void addCredential(String alias, Credential credential) throws AmbariException {
    if ((alias == null) || alias.isEmpty()) {
      throw new IllegalArgumentException("Alias cannot be null or empty.");
    }

    lock.lock();
    try {
      KeyStore ks = loadCredentialStore();
      addCredential(ks, alias, credential);
      persistCredentialStore(ks);
    } finally {
      lock.unlock();
    }
  }
Adds a new credential to this CredentialStore
<p/>
The supplied key will be converted into UTF-8 bytes before being stored.
<p/>
This implementation is thread-safe, allowing one thread at a time to access the credential store.

@param alias      a string declaring the alias (or name) of the credential
@param credential the credential to store
@throws AmbariException if an error occurs while storing the new credential
ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java