public void initialize(Map configParams) throws PolicyException {
  if (configParams == null) {
    throw (new PolicyException(ResBundleUtils.rbName,"ldapusers_initialization_failed",null,null));
  }
  String configuredLdapServer=(String)configParams.get(PolicyConfig.LDAP_SERVER);
  if (configuredLdapServer == null) {
    debug.error("LDAPUsers.initialize(): failed to get LDAP " + "server name. If you enter more than one server name " + "in the policy config service's Primary LDAP Server "+ "field, please make sure the ldap server name is preceded "+ "with the local server name.");
    throw (new PolicyException(ResBundleUtils.rbName,"invalid_ldap_server_host",null,null));
  }
  ldapServer=configuredLdapServer.toLowerCase();
  localDS=PolicyUtils.isLocalDS(ldapServer);
  aliasEnabled=Boolean.valueOf((String)configParams.get(PolicyConfig.USER_ALIAS_ENABLED));
  String authid=(String)configParams.get(PolicyConfig.LDAP_BIND_DN);
  String authpw=(String)configParams.get(PolicyConfig.LDAP_BIND_PASSWORD);
  if (authpw != null) {
    authpw=PolicyUtils.decrypt(authpw);
  }
  baseDN=(String)configParams.get(PolicyConfig.LDAP_USERS_BASE_DN);
  userSearchFilter=(String)configParams.get(PolicyConfig.LDAP_USERS_SEARCH_FILTER);
  String scope=(String)configParams.get(PolicyConfig.LDAP_USERS_SEARCH_SCOPE);
  if (scope.equalsIgnoreCase(LDAP_SCOPE_BASE)) {
    userSearchScope=SearchScope.BASE_OBJECT;
  }
 else   if (scope.equalsIgnoreCase(LDAP_SCOPE_ONE)) {
    userSearchScope=SearchScope.SINGLE_LEVEL;
  }
 else {
    userSearchScope=SearchScope.WHOLE_SUBTREE;
  }
  userRDNAttrName=(String)configParams.get(PolicyConfig.LDAP_USER_SEARCH_ATTRIBUTE);
  int minPoolSize;
  int maxPoolSize;
  try {
    timeLimit=Integer.parseInt((String)configParams.get(PolicyConfig.LDAP_SEARCH_TIME_OUT));
    maxResults=Integer.parseInt((String)configParams.get(PolicyConfig.LDAP_SEARCH_LIMIT));
    minPoolSize=Integer.parseInt((String)configParams.get(PolicyConfig.LDAP_CONNECTION_POOL_MIN_SIZE));
    maxPoolSize=Integer.parseInt((String)configParams.get(PolicyConfig.LDAP_CONNECTION_POOL_MAX_SIZE));
  }
 catch (  NumberFormatException nfe) {
    throw (new PolicyException(nfe));
  }
  boolean sslEnabled=Boolean.valueOf((String)configParams.get(PolicyConfig.LDAP_SSL_ENABLED));
  Set orgNameSet=(Set)configParams.get(PolicyManager.ORGANIZATION_NAME);
  if ((orgNameSet != null) && (!orgNameSet.isEmpty())) {
    Iterator items=orgNameSet.iterator();
    orgName=(String)items.next();
  }
  if (debug.messageEnabled()) {
    debug.message("LDAPUsers.initialize(): getting params" + "\nldapServer: " + ldapServer + "\nauthid: "+ authid+ "\nbaseDN: "+ baseDN+ "\nuserSearchFilter: "+ userSearchFilter+ "\nuserRDNAttrName: "+ userRDNAttrName+ "\ntimeLimit: "+ timeLimit+ "\nmaxResults: "+ maxResults+ "\nminPoolSize: "+ minPoolSize+ "\nmaxPoolSize: "+ maxPoolSize+ "\nSSLEnabled: "+ sslEnabled+ "\nOrgName: "+ orgName);
  }
  LDAPConnectionPools.initConnectionPool(ldapServer,authid,authpw,sslEnabled,minPoolSize,maxPoolSize);
  connPool=LDAPConnectionPools.getConnectionPool(ldapServer);
  initialized=true;
}

public void initialize ( Map configParams ) throws PolicyException { if ( configParams == null ) { throw ( new PolicyException ( ResBundleUtils . rbName , "ldapusers_initialization_failed" , null , null ) ) ; } String configuredLdapServer = ( String ) configParams . get ( PolicyConfig . LDAP_SERVER ) ; if ( configuredLdapServer == null ) { debug . error ( "LDAPUsers.initialize(): failed to get LDAP " + "server name. If you enter more than one server name " + "in the policy config service's Primary LDAP Server " + "field, please make sure the ldap server name is preceded " + "with the local server name." ) ; throw ( new PolicyException ( ResBundleUtils . rbName , "invalid_ldap_server_host" , null , null ) ) ; } ldapServer = configuredLdapServer . toLowerCase ( ) ; localDS = PolicyUtils . isLocalDS ( ldapServer ) ; aliasEnabled = Boolean . valueOf ( ( String ) configParams . get ( PolicyConfig . USER_ALIAS_ENABLED ) ) ; String authid = ( String ) configParams . get ( PolicyConfig . LDAP_BIND_DN ) ; String authpw = ( String ) configParams . get ( PolicyConfig . LDAP_BIND_PASSWORD ) ; if ( authpw != null ) { authpw = PolicyUtils . decrypt ( authpw ) ; } baseDN = ( String ) configParams . get ( PolicyConfig . LDAP_USERS_BASE_DN ) ; userSearchFilter = ( String ) configParams . get ( PolicyConfig . LDAP_USERS_SEARCH_FILTER ) ; String scope = ( String ) configParams . get ( PolicyConfig . LDAP_USERS_SEARCH_SCOPE ) ; if ( scope . equalsIgnoreCase ( LDAP_SCOPE_BASE ) ) { userSearchScope = SearchScope . BASE_OBJECT ; } else if ( scope . equalsIgnoreCase ( LDAP_SCOPE_ONE ) ) { userSearchScope = SearchScope . SINGLE_LEVEL ; } else { userSearchScope = SearchScope . WHOLE_SUBTREE ; } userRDNAttrName = ( String ) configParams . get ( PolicyConfig . LDAP_USER_SEARCH_ATTRIBUTE ) ; int minPoolSize ; int maxPoolSize ; try { timeLimit = Integer . parseInt ( ( String ) configParams . get ( PolicyConfig . LDAP_SEARCH_TIME_OUT ) ) ; maxResults = Integer . parseInt ( ( String ) configParams . get ( PolicyConfig . LDAP_SEARCH_LIMIT ) ) ; minPoolSize = Integer . parseInt ( ( String ) configParams . get ( PolicyConfig . LDAP_CONNECTION_POOL_MIN_SIZE ) ) ; maxPoolSize = Integer . parseInt ( ( String ) configParams . get ( PolicyConfig . LDAP_CONNECTION_POOL_MAX_SIZE ) ) ; } catch ( NumberFormatException nfe ) { throw ( new PolicyException ( nfe ) ) ; } boolean sslEnabled = Boolean . valueOf ( ( String ) configParams . get ( PolicyConfig . LDAP_SSL_ENABLED ) ) ; Set orgNameSet = ( Set ) configParams . get ( PolicyManager . ORGANIZATION_NAME ) ; if ( ( orgNameSet != null ) && ( ! orgNameSet . isEmpty ( ) ) ) { Iterator items = orgNameSet . iterator ( ) ; orgName = ( String ) items . next ( ) ; } if ( debug . messageEnabled ( ) ) { debug . message ( "LDAPUsers.initialize(): getting params" + "\nldapServer: " + ldapServer + "\nauthid: " + authid + "\nbaseDN: " + baseDN + "\nuserSearchFilter: " + userSearchFilter + "\nuserRDNAttrName: " + userRDNAttrName + "\ntimeLimit: " + timeLimit + "\nmaxResults: " + maxResults + "\nminPoolSize: " + minPoolSize + "\nmaxPoolSize: " + maxPoolSize + "\nSSLEnabled: " + sslEnabled + "\nOrgName: " + orgName ) ; } LDAPConnectionPools . initConnectionPool ( ldapServer , authid , authpw , sslEnabled , minPoolSize , maxPoolSize ) ; connPool = LDAPConnectionPools . getConnectionPool ( ldapServer ) ; initialized = true ; }
initialize the ldapgroup object by using the configuration information passed by the policy framework .
