Search in sources :

Example 26 with Named

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

the class AppInitializer method createLdapEntryManager.

@Produces
@ApplicationScoped
@Named(LDAP_ENTRY_MANAGER_NAME)
public LdapEntryManager createLdapEntryManager() {
    FileConfiguration ldapConfig = configurationFactory.getLdapConfiguration();
    Properties connectionProperties = (Properties) ldapConfig.getProperties();
    EncryptionService securityService = encryptionServiceInstance.get();
    Properties decryptedConnectionProperties = securityService.decryptProperties(connectionProperties);
    LdapEntryManager ldapEntryManager = this.ldapEntryManagerFactory.createEntryManager(decryptedConnectionProperties);
    log.info("Created {}: {}", new Object[] { LDAP_ENTRY_MANAGER_NAME, ldapEntryManager.getOperationService() });
    return ldapEntryManager;
}
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) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 27 with Named

use of javax.inject.Named in project Payara by payara.

the class HK2IntegrationUtilities method getHK2Qualifiers.

private static Set<Annotation> getHK2Qualifiers(InjectionPoint injectionPoint) {
    Set<Annotation> setQualifiers = injectionPoint.getQualifiers();
    Set<Annotation> retVal = new HashSet<Annotation>();
    for (Annotation anno : setQualifiers) {
        if (anno.annotationType().equals(Default.class))
            continue;
        if (anno.annotationType().equals(Named.class)) {
            Named named = (Named) anno;
            if ("".equals(named.value())) {
                Annotated annotated = injectionPoint.getAnnotated();
                if (annotated instanceof AnnotatedField) {
                    AnnotatedField<?> annotatedField = (AnnotatedField<?>) annotated;
                    Field field = annotatedField.getJavaMember();
                    anno = new NamedImpl(field.getName());
                }
            }
        }
        retVal.add(anno);
    }
    return retVal;
}
Also used : Named(javax.inject.Named) Annotated(javax.enterprise.inject.spi.Annotated) Field(java.lang.reflect.Field) AnnotatedField(javax.enterprise.inject.spi.AnnotatedField) NamedImpl(org.glassfish.hk2.utilities.NamedImpl) AnnotatedField(javax.enterprise.inject.spi.AnnotatedField) Annotation(java.lang.annotation.Annotation) HashSet(java.util.HashSet)

Example 28 with Named

use of javax.inject.Named in project DevRing by LJYcoder.

the class MovieActivityModule method commingMovieFragment.

@ActivityScope
@Provides
@Named("comming")
MovieFragment commingMovieFragment() {
    Bundle bundle = new Bundle();
    bundle.putInt("type", MovieFragment.TYPE_COMMING);
    MovieFragment fragment = new MovieFragment();
    fragment.setArguments(bundle);
    return fragment;
}
Also used : Bundle(android.os.Bundle) MovieFragment(com.dev.base.mvp.view.fragment.MovieFragment) Named(javax.inject.Named) ActivityScope(com.ljy.devring.di.scope.ActivityScope) Provides(dagger.Provides)

Example 29 with Named

use of javax.inject.Named in project java-tron by tronprotocol.

the class Module method buildTransactionDb.

/**
 * build transaction database.
 */
@Provides
@Singleton
@Named("transaction")
public LevelDbDataSourceImpl buildTransactionDb() {
    LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Args.getInstance().getOutputDirectory(), TRANSACTION_DB_NAME);
    db.initDB();
    return db;
}
Also used : LevelDbDataSourceImpl(org.tron.common.storage.leveldb.LevelDbDataSourceImpl) Named(javax.inject.Named) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 30 with Named

use of javax.inject.Named in project java-tron by tronprotocol.

the class Module method buildBlockDb.

/**
 * build block database.
 */
@Provides
@Singleton
@Named("block")
public LevelDbDataSourceImpl buildBlockDb() {
    LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Args.getInstance().getOutputDirectory(), BLOCK_DB_NAME);
    db.initDB();
    return db;
}
Also used : LevelDbDataSourceImpl(org.tron.common.storage.leveldb.LevelDbDataSourceImpl) Named(javax.inject.Named) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Named (javax.inject.Named)126 Produces (javax.enterprise.inject.Produces)36 Test (org.junit.Test)29 ApplicationScoped (javax.enterprise.context.ApplicationScoped)26 Provides (com.google.inject.Provides)22 Singleton (javax.inject.Singleton)17 Properties (java.util.Properties)16 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 List (java.util.List)7 Inject (javax.inject.Inject)7 HashMap (java.util.HashMap)6 ApiConfigAnnotationReader (com.google.api.server.spi.config.annotationreader.ApiConfigAnnotationReader)4 Type (java.lang.reflect.Type)4