Search in sources :

Example 86 with Named

use of javax.inject.Named in project camel by apache.

the class PropertyEndpointTest method configuration.

@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
    Properties properties = new Properties();
    properties.put("from", "inbound");
    properties.put("to", "mock:outbound");
    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)

Example 87 with Named

use of javax.inject.Named 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 88 with Named

use of javax.inject.Named 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)

Example 89 with Named

use of javax.inject.Named in project oxTrust by GluuFederation.

the class AppInitializer method createCentralLdapEntryManager.

@Produces
@ApplicationScoped
@Named(LDAP_CENTRAL_ENTRY_MANAGER_NAME)
@CentralLdap
public LdapEntryManager createCentralLdapEntryManager() {
    if (!((configurationFactory.getLdapCentralConfiguration() != null) && configurationFactory.getAppConfiguration().isUpdateApplianceStatus())) {
        return new LdapEntryManager();
    }
    FileConfiguration ldapCentralConfig = configurationFactory.getLdapCentralConfiguration();
    Properties centralConnectionProperties = (Properties) ldapCentralConfig.getProperties();
    EncryptionService securityService = encryptionServiceInstance.get();
    Properties decryptedCentralConnectionProperties = securityService.decryptProperties(centralConnectionProperties);
    LdapEntryManager centralLdapEntryManager = this.ldapEntryManagerFactory.createEntryManager(decryptedCentralConnectionProperties);
    log.info("Created {}: {}", new Object[] { LDAP_CENTRAL_ENTRY_MANAGER_NAME, centralLdapEntryManager.getOperationService() });
    return centralLdapEntryManager;
}
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) CentralLdap(org.gluu.oxtrust.service.cdi.event.CentralLdap) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 90 with Named

use of javax.inject.Named in project oxTrust by GluuFederation.

the class AppInitializer method initUmaMetadataConfiguration.

@Produces
@ApplicationScoped
@Named("umaMetadataConfiguration")
public UmaMetadata initUmaMetadataConfiguration() throws OxIntializationException {
    String umaConfigurationEndpoint = getUmaConfigurationEndpoint();
    if (StringHelper.isEmpty(umaConfigurationEndpoint)) {
        return null;
    }
    UmaMetadataService metaDataConfigurationService = UmaClientFactory.instance().createMetadataService(umaConfigurationEndpoint);
    UmaMetadata metadataConfiguration = metaDataConfigurationService.getMetadata();
    if (metadataConfiguration == null) {
        throw new OxIntializationException("UMA meta data configuration is invalid!");
    }
    return metadataConfiguration;
}
Also used : UmaMetadata(org.xdi.oxauth.model.uma.UmaMetadata) OxIntializationException(org.xdi.exception.OxIntializationException) UmaMetadataService(org.xdi.oxauth.client.uma.UmaMetadataService) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Aggregations

Named (javax.inject.Named)136 Produces (javax.enterprise.inject.Produces)40 ApplicationScoped (javax.enterprise.context.ApplicationScoped)31 Test (org.junit.Test)29 Provides (com.google.inject.Provides)23 Properties (java.util.Properties)18 Singleton (javax.inject.Singleton)18 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)15 Api (com.google.api.server.spi.config.Api)15 SimpleLevelOverridingApi (com.google.api.server.spi.testing.SimpleLevelOverridingApi)15 JsonNode (com.fasterxml.jackson.databind.JsonNode)14 PropertiesComponent (org.apache.camel.component.properties.PropertiesComponent)12 Annotation (java.lang.annotation.Annotation)11 Provides (dagger.Provides)9 ArrayList (java.util.ArrayList)8 Inject (javax.inject.Inject)8 List (java.util.List)7 HashMap (java.util.HashMap)6 Method (java.lang.reflect.Method)5 ApiConfigAnnotationReader (com.google.api.server.spi.config.annotationreader.ApiConfigAnnotationReader)4