public void setAdministratorCredential(PrincipalKeyCredential administratorCredential)
      throws KerberosAdminAuthenticationException {

    // Ensure the credential is not null
    if (administratorCredential == null) {
      throw new KerberosAdminAuthenticationException("The administrator credential must not be null");
    }

    // Ensure the principal is not null or empty
    String principal = administratorCredential.getPrincipal();
    if (StringUtils.isEmpty(principal)) {
      throw new KerberosAdminAuthenticationException("Must specify a principal but it is null or empty");
    }

    // Ensure either the password or the keytab value is not null or empty
    char[] password = administratorCredential.getKey();
    if (ArrayUtils.isEmpty(password)) {
      throw new KerberosAdminAuthenticationException("Must specify a password but it is null or empty");
    }

    this.administratorCredential = administratorCredential;
  }
Sets the administrator credentials for this KerberosOperationHandler.
<p/>
If the supplied {@link PrincipalKeyCredential} is not <code>null</code>, validates that the administrator
principal and values are not <code>null</code> or empty. If the credential value does not
validate, then a {@link KerberosAdminAuthenticationException} will be thrown.

@param administratorCredential the KDC administrator credential
@throws KerberosAdminAuthenticationException if the non-null Credential fails to contain
                                             a non-empty principal and password values.
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java