Search in sources :

Example 1 with ParameterizedTypeImpl

use of org.jboss.weld.util.reflection.ParameterizedTypeImpl in project oxAuth by GluuFederation.

the class AppInitializer method recreateLdapAuthEntryManagers.

public void recreateLdapAuthEntryManagers(List<GluuLdapConfiguration> newLdapAuthConfigs) {
    // Get existing application scoped instance
    List<LdapEntryManager> oldLdapAuthEntryManagers = CdiUtil.getContextBean(beanManager, new ParameterizedTypeImpl(List.class, LdapEntryManager.class), LDAP_AUTH_ENTRY_MANAGER_NAME);
    // Recreate components
    createAuthConnectionProviders(newLdapAuthConfigs);
    // Close existing connections
    closeLdapAuthEntryManagers(oldLdapAuthEntryManagers);
    // Destroy old Ldap auth entry managers
    for (LdapEntryManager oldLdapAuthEntryManager : oldLdapAuthEntryManagers) {
        log.debug("Attempting to destroy {}: {}", LDAP_AUTH_ENTRY_MANAGER_NAME, oldLdapAuthEntryManager);
        oldLdapAuthEntryManager.destroy();
        log.debug("Destroyed {}: {}", LDAP_AUTH_ENTRY_MANAGER_NAME, oldLdapAuthEntryManager);
    }
    // Force to create new bean
    List<LdapEntryManager> ldapAuthEntryManagers = ldapAuthEntryManagerInstance.get();
    ldapAuthEntryManagerInstance.destroy(ldapAuthEntryManagers);
    log.info("Recreated instance {}: {}", LDAP_AUTH_ENTRY_MANAGER_NAME, ldapAuthEntryManagers);
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) List(java.util.List) ArrayList(java.util.ArrayList) ParameterizedTypeImpl(org.jboss.weld.util.reflection.ParameterizedTypeImpl)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)1 ParameterizedTypeImpl (org.jboss.weld.util.reflection.ParameterizedTypeImpl)1