Search in sources :

Example 6 with LdapEntryManager

use of org.gluu.persist.ldap.impl.LdapEntryManager in project oxTrust by GluuFederation.

the class AppInitializer method createLdapEntryManager.

@Produces
@ApplicationScoped
@Named(LDAP_ENTRY_MANAGER_NAME)
public LdapEntryManager createLdapEntryManager() {
    FileConfiguration ldapConfig = configurationFactory.getLdapConfiguration();
    Properties connectionProperties = (Properties) ldapConfig.getProperties();
    EncryptionService securityService = encryptionServiceInstance.get();
    Properties decryptedConnectionProperties = securityService.decryptProperties(connectionProperties);
    LdapEntryManager ldapEntryManager = this.ldapEntryManagerFactory.createEntryManager(decryptedConnectionProperties);
    log.info("Created {}: {}", new Object[] { LDAP_ENTRY_MANAGER_NAME, ldapEntryManager.getOperationService() });
    return ldapEntryManager;
}
Also used : FileConfiguration(org.xdi.util.properties.FileConfiguration) LdapEntryManager(org.gluu.persist.ldap.impl.LdapEntryManager) Properties(java.util.Properties) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 7 with LdapEntryManager

use of org.gluu.persist.ldap.impl.LdapEntryManager in project oxTrust by GluuFederation.

the class AppInitializer method recreateLdapEntryManager.

public void recreateLdapEntryManager(@Observes @LdapConfigurationReload String event) {
    // Get existing application scoped instance
    LdapEntryManager oldLdapEntryManager = CdiUtil.getContextBean(beanManager, LdapEntryManager.class, LDAP_ENTRY_MANAGER_NAME);
    // Close existing connections
    closeLdapEntryManager(oldLdapEntryManager);
    // Force to create new bean
    LdapEntryManager ldapEntryManager = ldapEntryManagerInstance.get();
    ldapEntryManagerInstance.destroy(ldapEntryManager);
    log.info("Recreated instance {}: {}", LDAP_ENTRY_MANAGER_NAME, ldapEntryManager);
}
Also used : LdapEntryManager(org.gluu.persist.ldap.impl.LdapEntryManager)

Example 8 with LdapEntryManager

use of org.gluu.persist.ldap.impl.LdapEntryManager in project oxTrust by GluuFederation.

the class AppInitializer method applicationInitialized.

/**
 * Initialize components and schedule DS connection time checker
 */
public void applicationInitialized(@Observes @Initialized(ApplicationScoped.class) Object init) {
    log.debug("Initializing application services");
    showBuildInfo();
    customLibrariesLoader.init();
    createEntryManagerFactory();
    configurationFactory.create();
    LdapEntryManager localLdapEntryManager = ldapEntryManagerInstance.get();
    initializeLdifArchiver(localLdapEntryManager);
    // Initialize template engine
    templateService.initTemplateEngine();
    // Initialize SubversionService
    subversionService.initSubversionService();
    // Initialize python interpreter
    pythonService.initPythonInterpreter(configurationFactory.getLdapConfiguration().getString("pythonModulesDir", null));
    // Initialize Shibboleth
    shibbolethInitializer.createShibbolethConfiguration();
    // Initialize script manager
    List<CustomScriptType> supportedCustomScriptTypes = Arrays.asList(CustomScriptType.CACHE_REFRESH, CustomScriptType.UPDATE_USER, CustomScriptType.USER_REGISTRATION, CustomScriptType.ID_GENERATOR, CustomScriptType.SCIM);
    // Start timer
    quartzSchedulerManager.start();
    // Schedule timer tasks
    metricService.initTimer();
    configurationFactory.initTimer();
    ldapStatusTimer.initTimer();
    metadataValidationTimer.initTimer();
    entityIDMonitoringService.initTimer();
    cacheRefreshTimer.initTimer();
    customScriptManager.initTimer(supportedCustomScriptTypes);
    statusCheckerDaily.initTimer();
    statusCheckerTimer.initTimer();
    svnSyncTimer.initTimer();
    logFileSizeChecker.initTimer();
    loggerService.updateLoggerConfigLocation();
}
Also used : LdapEntryManager(org.gluu.persist.ldap.impl.LdapEntryManager) CustomScriptType(org.xdi.model.custom.script.CustomScriptType)

Example 9 with LdapEntryManager

use of org.gluu.persist.ldap.impl.LdapEntryManager in project oxTrust by GluuFederation.

the class AppInitializer method recreateCentralLdapEntryManager.

public void recreateCentralLdapEntryManager(@Observes @LdapCentralConfigurationReload String event) {
    // Get existing application scoped instance
    LdapEntryManager oldCentralLdapEntryManager = CdiUtil.getContextBean(beanManager, LdapEntryManager.class, LDAP_CENTRAL_ENTRY_MANAGER_NAME);
    // Close existing connections
    closeLdapEntryManager(oldCentralLdapEntryManager);
    // Force to create new bean
    LdapEntryManager ldapCentralEntryManager = ldapCentralEntryManagerInstance.get();
    ldapEntryManagerInstance.destroy(ldapCentralEntryManager);
    log.info("Recreated instance {}: {}", LDAP_CENTRAL_ENTRY_MANAGER_NAME, ldapCentralEntryManager);
}
Also used : LdapEntryManager(org.gluu.persist.ldap.impl.LdapEntryManager)

Example 10 with LdapEntryManager

use of org.gluu.persist.ldap.impl.LdapEntryManager in project oxTrust by GluuFederation.

the class Configuration method createLdapEntryManager.

private LdapEntryManager createLdapEntryManager() {
    Properties connectionProperties = (Properties) this.ldapConfiguration.getProperties();
    Properties decryptedConnectionProperties = PropertiesDecrypter.decryptProperties(connectionProperties, this.cryptoConfigurationSalt);
    LdapEntryManagerFactory ldapEntryManagerFactory = new LdapEntryManagerFactory();
    LdapEntryManager ldapEntryManager = ldapEntryManagerFactory.createEntryManager(decryptedConnectionProperties);
    logger.debug("Created LdapEntryManager: {}", ldapEntryManager);
    return ldapEntryManager;
}
Also used : LdapEntryManager(org.gluu.persist.ldap.impl.LdapEntryManager) Properties(java.util.Properties) LdapEntryManagerFactory(org.gluu.persist.ldap.impl.LdapEntryManagerFactory)

Aggregations

LdapEntryManager (org.gluu.persist.ldap.impl.LdapEntryManager)20 Filter (org.gluu.search.filter.Filter)6 Properties (java.util.Properties)5 GluuSimplePerson (org.gluu.oxtrust.ldap.cache.model.GluuSimplePerson)5 ArrayList (java.util.ArrayList)4 GluuInumMap (org.gluu.oxtrust.ldap.cache.model.GluuInumMap)3 BaseMappingException (org.gluu.persist.exception.mapping.BaseMappingException)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 ApplicationScoped (javax.enterprise.context.ApplicationScoped)2 Produces (javax.enterprise.inject.Produces)2 Named (javax.inject.Named)2 SimpleSession (org.gluu.ldap.model.SimpleSession)2 CacheCompoundKey (org.gluu.oxtrust.ldap.cache.model.CacheCompoundKey)2 LdapEntryManagerFactory (org.gluu.persist.ldap.impl.LdapEntryManagerFactory)2 CustomAttribute (org.gluu.persist.model.base.CustomAttribute)2 FileConfiguration (org.xdi.util.properties.FileConfiguration)2 List (java.util.List)1