Search in sources :

Example 11 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxTrust 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.gluu.oxtrust.model.GluuAppliance) SmtpConfiguration(org.xdi.model.SmtpConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 12 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project camel by apache.

the class Jms method sjms.

@Produces
@Named("sjms")
@ApplicationScoped
SjmsComponent sjms() {
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useShutdownHook=false&broker.useJmx=false"));
    component.setConnectionCount(maxConnections);
    return component;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 13 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project camel by apache.

the class Application method properties.

@Produces
@ApplicationScoped
@Named("properties")
// "properties" component bean that Camel uses to lookup properties
PropertiesComponent properties(PropertiesParser parser) {
    PropertiesComponent component = new PropertiesComponent();
    // Use DeltaSpike as configuration source for Camel CDI
    component.setPropertiesParser(parser);
    return component;
}
Also used : PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 14 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project camel by apache.

the class PropertiesConfigurationTest method propertiesComponent.

@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent propertiesComponent() {
    Properties configuration = new Properties();
    configuration.put("property", "value");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(configuration);
    component.setLocation("classpath:camel1.properties,classpath:camel2.properties");
    return component;
}
Also used : Properties(java.util.Properties) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 15 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project camel by apache.

the class AdvisedRouteTest method configuration.

@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("from", "inbound");
    properties.put("to", "direct:outbound");
    properties.put("header.message", "n/a");
    PropertiesComponent component = new PropertiesComponent();
    component.setInitialProperties(properties);
    return component;
}
Also used : Properties(java.util.Properties) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Aggregations

ApplicationScoped (javax.enterprise.context.ApplicationScoped)25 Produces (javax.enterprise.inject.Produces)25 Named (javax.inject.Named)19 PropertiesComponent (org.apache.camel.component.properties.PropertiesComponent)12 Properties (java.util.Properties)8 OperationsFacade (org.gluu.site.ldap.OperationsFacade)4 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)4 OxIntializationException (org.xdi.exception.OxIntializationException)2 SmtpConfiguration (org.xdi.model.SmtpConfiguration)2 CacheConfiguration (org.xdi.service.cache.CacheConfiguration)2 InMemoryConfiguration (org.xdi.service.cache.InMemoryConfiguration)2 EncryptionException (org.xdi.util.security.StringEncrypter.EncryptionException)2 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 ViewConfigResolver (org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver)1 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)1 CentralLdap (org.gluu.oxtrust.service.cdi.event.CentralLdap)1