Search in sources :

Example 6 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() {
    PropertiesComponent component = new PropertiesComponent();
    component.setLocation("classpath:application.properties");
    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 7 with ApplicationScoped

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

the class Config method properties.

@Produces
@ApplicationScoped
@Named("properties")
PropertiesComponent properties() {
    PropertiesComponent component = new PropertiesComponent();
    component.setLocation("classpath:jms.properties");
    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 8 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxAuth 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 9 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxTrust by GluuFederation.

the class AppInitializer method initOpenIdConfiguration.

@Produces
@ApplicationScoped
@Named("openIdConfiguration")
public OpenIdConfigurationResponse initOpenIdConfiguration() throws OxIntializationException {
    String oxAuthIssuer = this.configurationFactory.getAppConfiguration().getOxAuthIssuer();
    if (StringHelper.isEmpty(oxAuthIssuer)) {
        log.info("oxAuth issuer isn't specified");
        return null;
    }
    log.debug("Attempting to determine configuration endpoint URL");
    OpenIdConnectDiscoveryClient openIdConnectDiscoveryClient;
    try {
        openIdConnectDiscoveryClient = new OpenIdConnectDiscoveryClient(oxAuthIssuer);
    } catch (URISyntaxException ex) {
        throw new OxIntializationException("OpenId discovery response is invalid!", ex);
    }
    OpenIdConnectDiscoveryResponse openIdConnectDiscoveryResponse = openIdConnectDiscoveryClient.exec();
    if ((openIdConnectDiscoveryResponse.getStatus() != 200) || (openIdConnectDiscoveryResponse.getSubject() == null) || (openIdConnectDiscoveryResponse.getLinks().size() == 0)) {
        throw new OxIntializationException("OpenId discovery response is invalid!");
    }
    log.debug("Attempting to load OpenID configuration");
    String configurationEndpoint = openIdConnectDiscoveryResponse.getLinks().get(0).getHref() + "/.well-known/openid-configuration";
    OpenIdConfigurationClient client = new OpenIdConfigurationClient(configurationEndpoint);
    OpenIdConfigurationResponse openIdConfiguration = client.execOpenIdConfiguration();
    if (openIdConfiguration.getStatus() != 200) {
        throw new OxIntializationException("OpenId configuration response is invalid!");
    }
    return openIdConfiguration;
}
Also used : OpenIdConnectDiscoveryClient(org.xdi.oxauth.client.OpenIdConnectDiscoveryClient) OpenIdConfigurationClient(org.xdi.oxauth.client.OpenIdConfigurationClient) OpenIdConnectDiscoveryResponse(org.xdi.oxauth.client.OpenIdConnectDiscoveryResponse) OpenIdConfigurationResponse(org.xdi.oxauth.client.OpenIdConfigurationResponse) URISyntaxException(java.net.URISyntaxException) OxIntializationException(org.xdi.exception.OxIntializationException) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 10 with ApplicationScoped

use of javax.enterprise.context.ApplicationScoped in project oxTrust 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));
    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)

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