@Override
  public void open(PrincipalKeyCredential administratorCredential, String realm,
                   Map<String, String> kerberosConfiguration) throws KerberosOperationException {

    if (isOpen()) {
      close();
    }

    if (administratorCredential == null) {
      throw new KerberosAdminAuthenticationException("administrator credential not provided");
    }
    if (realm == null) {
      throw new KerberosRealmException("realm not provided");
    }
    if (kerberosConfiguration == null) {
      throw new KerberosRealmException("kerberos-env configuration may not be null");
    }

    this.ldapUrl = kerberosConfiguration.get(KERBEROS_ENV_LDAP_URL);
    if (this.ldapUrl == null) {
      throw new KerberosKDCConnectionException("ldapUrl not provided");
    }
    if (!this.ldapUrl.startsWith("ldaps://")) {
      throw new KerberosKDCConnectionException("ldapUrl is not valid ldaps URL");
    }

    this.principalContainerDn = kerberosConfiguration.get(KERBEROS_ENV_PRINCIPAL_CONTAINER_DN);
    if (this.principalContainerDn == null) {
      throw new KerberosLDAPContainerException("principalContainerDn not provided");
    }

    try {
      this.principalContainerLdapName = new LdapName(principalContainerDn);
    } catch (InvalidNameException e) {
      throw new KerberosLDAPContainerException("principalContainerDn is not a valid LDAP name", e);
    }

    super.open(administratorCredential, realm, kerberosConfiguration);

    this.ldapContext = createLdapContext();
    this.searchControls = createSearchControls();

    this.createTemplate = kerberosConfiguration.get(KERBEROS_ENV_AD_CREATE_ATTRIBUTES_TEMPLATE);

    setOpen(true);
  }
Prepares and creates resources to be used by this KerberosOperationHandler
<p/>
It is expected that this KerberosOperationHandler will not be used before this call.
<p/>
It is expected that the kerberosConfiguration Map has the following properties:
<ul>
<li>ldap_url - ldapUrl of ldap back end where principals would be created</li>
<li>container_dn - DN of the container in ldap back end where principals would be created</li>
</il>

@param administratorCredential a PrincipalKeyCredential containing the administrative credential
                               for the relevant KDC
@param realm                   a String declaring the default Kerberos realm (or domain)
@param kerberosConfiguration   a Map of key/value pairs containing data from the kerberos-env configuration set
@throws KerberosKDCConnectionException       if a connection to the KDC cannot be made
@throws KerberosAdminAuthenticationException if the administrator credentials fail to authenticate
@throws KerberosRealmException               if the realm does not map to a KDC
@throws KerberosOperationException           if an unexpected error occurred
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java