Пример #1
0
  /**
   * Invoked when the registry shuts down, giving services a chance to perform any final operations.
   * Service implementations should not attempt to invoke methods on other services (via proxies) as
   * the service proxies may themselves be shutdown.
   */
  public void shutdown() {
    try {
      if (ldapConnection != null && ldapConnection.isConnected()) {
        if (logger.isDebugEnabled()) logger.debug("disconnecting from server {}", ldapHostName);

        ldapConnection.disconnect();
      }
    } catch (LDAPException e) {
      throw new RuntimeException(e);
    }
  }
Пример #2
0
  /**
   * connect and/or authenticate at LDAP server.
   *
   * @throws LDAPException
   */
  private synchronized void checkAndconnect() throws LDAPException {
    if (!ldapConnection.isConnected()) {
      if (logger.isDebugEnabled()) logger.debug("connecting server: {}", ldapHostName);

      ldapConnection.connect(ldapVersion, ldapHostName, ldapPort, ldapAuthDN, ldapPwd);
    }

    if (!ldapConnection.isAuthenticated()) {
      if (logger.isDebugEnabled()) logger.debug("authenticate at server: {}", ldapHostName);

      ldapConnection.authenticate(ldapVersion, ldapAuthDN, ldapPwd);
    }
  }