Search in sources :

Example 46 with Produces

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;
}
Also used : PersistenceUnitName(org.apache.deltaspike.jpa.api.entitymanager.PersistenceUnitName) EntityManagerFactory(javax.persistence.EntityManagerFactory) Properties(java.util.Properties) PersistenceUnitName(org.apache.deltaspike.jpa.api.entitymanager.PersistenceUnitName) Produces(javax.enterprise.inject.Produces) Dependent(javax.enterprise.context.Dependent)

Example 47 with Produces

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;
}
Also used : InMemoryConfiguration(org.xdi.service.cache.InMemoryConfiguration) CacheConfiguration(org.xdi.service.cache.CacheConfiguration) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 48 with Produces

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;
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) OperationsFacade(org.gluu.site.ldap.OperationsFacade) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 49 with Produces

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;
}
Also used : GluuAppliance(org.xdi.oxauth.model.appliance.GluuAppliance) SmtpConfiguration(org.xdi.model.SmtpConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 50 with Produces

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;
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) ArrayList(java.util.ArrayList) OperationsFacade(org.gluu.site.ldap.OperationsFacade) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Aggregations

Produces (javax.enterprise.inject.Produces)56 Named (javax.inject.Named)32 ApplicationScoped (javax.enterprise.context.ApplicationScoped)25 Properties (java.util.Properties)12 PropertiesComponent (org.apache.camel.component.properties.PropertiesComponent)12 ArrayList (java.util.ArrayList)6 Dependent (javax.enterprise.context.Dependent)4 ParameterizedType (java.lang.reflect.ParameterizedType)3 Type (java.lang.reflect.Type)3 RequestScoped (javax.enterprise.context.RequestScoped)3 InjectableResource (org.apache.deltaspike.core.api.resourceloader.InjectableResource)3 InjectableResourceProvider (org.apache.deltaspike.core.api.resourceloader.InjectableResourceProvider)3 OperationsFacade (org.gluu.site.ldap.OperationsFacade)3 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)3 FunctionMapperImpl (com.sun.el.lang.FunctionMapperImpl)2 VariableMapperImpl (com.sun.el.lang.VariableMapperImpl)2 CompositeELResolver (javax.el.CompositeELResolver)2 FieldMetaData (org.fusesource.camel.component.sap.model.rfc.FieldMetaData)2 FunctionTemplate (org.fusesource.camel.component.sap.model.rfc.FunctionTemplate)2 ListFieldMetaData (org.fusesource.camel.component.sap.model.rfc.ListFieldMetaData)2