@Override
  public boolean containsCredential(String alias) throws AmbariException {
    boolean exists = false;

    if ((alias != null) && !alias.isEmpty()) {
      lock.lock();
      try {
        KeyStore ks = loadCredentialStore();
        if (ks != null) {
          try {
            exists = ks.containsAlias(alias);
          } catch (KeyStoreException e) {
            throw new AmbariException("Failed to search the KeyStore for the requested entry - the key store may not have been initialized", e);
          }
        }
      } finally {
        lock.unlock();
      }
    }

    return exists;
  }
Tests this CredentialStore for the existence of a credential with the specified alias
<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
@return true if the alias exists; otherwise false
@throws AmbariException if an error occurs while searching forthe credential
ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java