Search in sources :

Example 91 with Named

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

the class MovieActivityModule method playingMovieFragment.

@ActivityScope
@Provides
@Named("playing")
MovieFragment playingMovieFragment() {
    Bundle bundle = new Bundle();
    bundle.putInt("type", MovieFragment.TYPE_PLAYING);
    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 92 with Named

use of javax.inject.Named in project verify-hub by alphagov.

the class SamlEngineModule method getVerifyMetadataHealthCheck.

@Provides
@Singleton
@Named(VERIFY_METADATA_HEALTH_CHECK)
private MetadataHealthCheck getVerifyMetadataHealthCheck(@Named("VerifyMetadataResolver") MetadataResolver metadataResolver, Environment environment, SamlEngineConfiguration configuration) {
    MetadataHealthCheck metadataHealthCheck = new MetadataHealthCheck(metadataResolver, configuration.getMetadataConfiguration().getExpectedEntityId());
    environment.healthChecks().register(VERIFY_METADATA_HEALTH_CHECK, metadataHealthCheck);
    return metadataHealthCheck;
}
Also used : MetadataHealthCheck(uk.gov.ida.saml.metadata.MetadataHealthCheck) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 93 with Named

use of javax.inject.Named in project verify-hub by alphagov.

the class SamlProxyModule method getCountryMetadataHealthCheck.

@Provides
@Singleton
@Named(COUNTRY_METADATA_HEALTH_CHECK)
public Optional<MetadataHealthCheck> getCountryMetadataHealthCheck(@Named("CountryMetadataResolver") Optional<MetadataResolver> metadataResolver, Environment environment, SamlProxyConfiguration configuration) {
    return metadataResolver.map(resolver -> {
        MetadataHealthCheck metadataHealthCheck = new MetadataHealthCheck(metadataResolver.get(), configuration.getCountryConfiguration().get().getMetadataConfiguration().getExpectedEntityId());
        environment.healthChecks().register(COUNTRY_METADATA_HEALTH_CHECK, metadataHealthCheck);
        return metadataHealthCheck;
    });
}
Also used : MetadataHealthCheck(uk.gov.ida.saml.metadata.MetadataHealthCheck) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 94 with Named

use of javax.inject.Named in project atlasdb by palantir.

the class KeyValueServiceModule method provideWrappedKeyValueService.

@Provides
@Singleton
@Named("kvs")
public KeyValueService provideWrappedKeyValueService(@Named("rawKvs") KeyValueService rawKvs, TimestampService tss, ServicesConfig config) {
    KvsProfilingLogger.setSlowLogThresholdMillis(config.atlasDbConfig().getKvsSlowLogThresholdMillis());
    KeyValueService kvs = ProfilingKeyValueService.create(rawKvs);
    kvs = TracingKeyValueService.create(kvs);
    kvs = AtlasDbMetrics.instrument(KeyValueService.class, kvs);
    kvs = ValidatingQueryRewritingKeyValueService.create(kvs);
    SweepConfig sweepConfig = config.atlasDbRuntimeConfig().sweep();
    kvs = SweepStatsKeyValueService.create(kvs, tss, sweepConfig::writeThreshold, sweepConfig::writeSizeThreshold);
    TransactionTables.createTables(kvs);
    ImmutableSet<Schema> schemas = ImmutableSet.<Schema>builder().add(SweepSchema.INSTANCE.getLatestSchema()).add(CompactSchema.INSTANCE.getLatestSchema()).addAll(config.schemas()).build();
    for (Schema schema : schemas) {
        Schemas.createTablesAndIndexes(schema, kvs);
    }
    return kvs;
}
Also used : SweepConfig(com.palantir.atlasdb.config.SweepConfig) ValidatingQueryRewritingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ValidatingQueryRewritingKeyValueService) TracingKeyValueService(com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService) ProfilingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ProfilingKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) SweepStatsKeyValueService(com.palantir.atlasdb.keyvalue.impl.SweepStatsKeyValueService) SweepSchema(com.palantir.atlasdb.schema.SweepSchema) CompactSchema(com.palantir.atlasdb.schema.CompactSchema) Schema(com.palantir.atlasdb.table.description.Schema) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 95 with Named

use of javax.inject.Named in project core by weld.

the class CodeFragmentManagerImpl method getRecentCodeFragments.

@Produces
@Named
public List<CodeFragment> getRecentCodeFragments() {
    Query query = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE c.hash=null ORDER BY datetime DESC ");
    query.setMaxResults(MAX_RECENT_FRAGMENTS);
    @SuppressWarnings("unchecked") List<CodeFragment> codes = query.getResultList();
    return codes;
}
Also used : CriteriaQuery(javax.persistence.criteria.CriteriaQuery) Query(javax.persistence.Query) CodeFragment(org.jboss.weld.examples.pastecode.model.CodeFragment) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces)

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