use of javax.enterprise.inject.Produces in project deltaspike by apache.
the class EntityManagerFactoryProducer method createEntityManagerFactoryForUnit.
@Produces
@Dependent
// the value is nonbinding, thus 'any' is just a dummy parameter here
@PersistenceUnitName("any")
public EntityManagerFactory createEntityManagerFactoryForUnit(InjectionPoint injectionPoint) {
PersistenceUnitName unitNameAnnotation = injectionPoint.getAnnotated().getAnnotation(PersistenceUnitName.class);
if (unitNameAnnotation == null) {
LOG.warning("@PersisteneUnitName annotation could not be found at EntityManagerFactory injection point!");
return null;
}
String unitName = unitNameAnnotation.value();
Properties properties = persistenceConfigurationProvider.getEntityManagerFactoryConfiguration(unitName);
EntityManagerFactory emf = Persistence.createEntityManagerFactory(unitName, properties);
return emf;
}
use of javax.enterprise.inject.Produces in project oxTrust by GluuFederation.
the class ApplicationFactory method getCacheConfiguration.
@Produces
@ApplicationScoped
public CacheConfiguration getCacheConfiguration() {
CacheConfiguration cacheConfiguration = applianceService.getAppliance().getCacheConfiguration();
if (cacheConfiguration == null || cacheConfiguration.getCacheProviderType() == null) {
log.error("Failed to read cache configuration from LDAP. Please check appliance oxCacheConfiguration attribute " + "that must contain cache configuration JSON represented by CacheConfiguration.class. Applieance DN: " + applianceService.getAppliance().getDn());
log.info("Creating fallback IN-MEMORY cache configuration ... ");
cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setInMemoryConfiguration(new InMemoryConfiguration());
log.info("IN-MEMORY cache configuration is created.");
}
log.info("Cache configuration: " + cacheConfiguration);
return cacheConfiguration;
}
use of javax.enterprise.inject.Produces in project oxAuth by GluuFederation.
the class AppInitializer method getLdapEntryManager.
@Produces
@ApplicationScoped
@Named(LDAP_ENTRY_MANAGER_NAME)
public LdapEntryManager getLdapEntryManager() {
LdapEntryManager ldapEntryManager = new LdapEntryManager(new OperationsFacade(this.connectionProvider, this.bindConnectionProvider));
log.info("Created {}: {}", new Object[] { LDAP_ENTRY_MANAGER_NAME, ldapEntryManager.getLdapOperationService() });
return ldapEntryManager;
}
use of javax.enterprise.inject.Produces in project oxAuth by GluuFederation.
the class ApplicationFactory method getSmtpConfiguration.
@Produces
@ApplicationScoped
public SmtpConfiguration getSmtpConfiguration() {
GluuAppliance appliance = applianceService.getAppliance();
SmtpConfiguration smtpConfiguration = appliance.getSmtpConfiguration();
if (smtpConfiguration == null) {
return null;
}
String password = smtpConfiguration.getPassword();
if (StringHelper.isNotEmpty(password)) {
try {
smtpConfiguration.setPasswordDecrypted(encryptionService.decrypt(password));
} catch (EncryptionException ex) {
log.error("Failed to decript SMTP user password", ex);
}
}
return smtpConfiguration;
}
use of javax.enterprise.inject.Produces in project oxAuth by GluuFederation.
the class AppInitializer method createLdapAuthEntryManager.
@Produces
@ApplicationScoped
@Named(LDAP_AUTH_ENTRY_MANAGER_NAME)
public List<LdapEntryManager> createLdapAuthEntryManager() {
List<LdapEntryManager> ldapAuthEntryManagers = new ArrayList<LdapEntryManager>();
if (this.ldapAuthConfigs.size() == 0) {
return ldapAuthEntryManagers;
}
for (int i = 0; i < this.ldapAuthConfigs.size(); i++) {
LdapEntryManager ldapAuthEntryManager = new LdapEntryManager(new OperationsFacade(this.authConnectionProviders.get(i), this.authBindConnectionProviders.get(i)));
log.debug("Created {}#{}: {}", new Object[] { LDAP_AUTH_ENTRY_MANAGER_NAME, i, ldapAuthEntryManager });
ldapAuthEntryManagers.add(ldapAuthEntryManager);
}
return ldapAuthEntryManagers;
}
Aggregations