class KerberosOperationHandler {

  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;
  }

}