Search in sources :

Example 6 with Singleton

use of javax.inject.Singleton in project OpenAM by OpenRock.

the class ForgerockRestGuiceModule method getPrivilegeDefinitions.

@Provides
@Singleton
public Map<String, PrivilegeDefinition> getPrivilegeDefinitions() {
    final Map<String, PrivilegeDefinition> definitions = new HashMap<>();
    final PrivilegeDefinition evaluateDefinition = PrivilegeDefinition.getInstance("evaluate", PrivilegeDefinition.Action.READ);
    definitions.put("evaluate", evaluateDefinition);
    definitions.put("evaluateTree", evaluateDefinition);
    definitions.put("copy", PrivilegeDefinition.getInstance("modify", PrivilegeDefinition.Action.MODIFY));
    definitions.put("move", PrivilegeDefinition.getInstance("modify", PrivilegeDefinition.Action.MODIFY));
    definitions.put("schema", PrivilegeDefinition.getInstance("schema", PrivilegeDefinition.Action.READ));
    definitions.put("validate", PrivilegeDefinition.getInstance("validate", PrivilegeDefinition.Action.READ));
    definitions.put("template", PrivilegeDefinition.getInstance("template", PrivilegeDefinition.Action.READ));
    definitions.put("getPropertyNames", PrivilegeDefinition.getInstance("getPropertyNames", PrivilegeDefinition.Action.READ));
    definitions.put("getProperty", PrivilegeDefinition.getInstance("getProperty", PrivilegeDefinition.Action.READ));
    definitions.put("setProperty", PrivilegeDefinition.getInstance("setProperty", PrivilegeDefinition.Action.MODIFY));
    definitions.put("deleteProperty", PrivilegeDefinition.getInstance("deleteProperty", PrivilegeDefinition.Action.MODIFY));
    return definitions;
}
Also used : HashMap(java.util.HashMap) PrivilegeDefinition(org.forgerock.openam.rest.authz.PrivilegeDefinition) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 7 with Singleton

use of javax.inject.Singleton in project u2020 by JakeWharton.

the class DebugApiModule method provideBehavior.

@Provides
@Singleton
NetworkBehavior provideBehavior(@NetworkDelay Preference<Long> networkDelay, @NetworkFailurePercent Preference<Integer> networkFailurePercent, @NetworkVariancePercent Preference<Integer> networkVariancePercent) {
    NetworkBehavior behavior = NetworkBehavior.create();
    behavior.setDelay(networkDelay.get(), MILLISECONDS);
    behavior.setFailurePercent(networkFailurePercent.get());
    behavior.setVariancePercent(networkVariancePercent.get());
    return behavior;
}
Also used : NetworkBehavior(retrofit2.mock.NetworkBehavior) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 8 with Singleton

use of javax.inject.Singleton in project Telecine by JakeWharton.

the class TelecineModule method provideAnalytics.

@Provides
@Singleton
Analytics provideAnalytics() {
    if (BuildConfig.DEBUG) {
        return new Analytics() {

            @Override
            public void send(Map<String, String> params) {
                Timber.tag("Analytics").d(String.valueOf(params));
            }
        };
    }
    GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(app);
    Tracker tracker = googleAnalytics.newTracker(BuildConfig.ANALYTICS_KEY);
    // ms? s? better be s.
    tracker.setSessionTimeout(300);
    return new Analytics.GoogleAnalytics(tracker);
}
Also used : GoogleAnalytics(com.google.android.gms.analytics.GoogleAnalytics) Tracker(com.google.android.gms.analytics.Tracker) Map(java.util.Map) GoogleAnalytics(com.google.android.gms.analytics.GoogleAnalytics) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 9 with Singleton

use of javax.inject.Singleton in project OpenAM by OpenRock.

the class CoreRestGuiceModule method getServerAttributeSyntax.

@Provides
@Singleton
@Named("ServerAttributeSyntax")
public Properties getServerAttributeSyntax() throws IOException {
    Properties syntaxProperties = new Properties();
    syntaxProperties.load(getClass().getClassLoader().getResourceAsStream("validserverconfig.properties"));
    return syntaxProperties;
}
Also used : SystemProperties(com.iplanet.am.util.SystemProperties) Properties(java.util.Properties) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 10 with Singleton

use of javax.inject.Singleton in project SpotiQ by ZinoKader.

the class AppModule method providePartiesRepository.

@Provides
@Singleton
PartiesRepository providePartiesRepository() {
    FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
    DatabaseReference databaseReference = firebaseDatabase.getReference().child(FirebaseConstants.CHILD_PARTYLIST);
    return new PartiesRepository(databaseReference);
}
Also used : FirebaseDatabase(com.google.firebase.database.FirebaseDatabase) DatabaseReference(com.google.firebase.database.DatabaseReference) PartiesRepository(se.zinokader.spotiq.repository.PartiesRepository) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

Singleton (javax.inject.Singleton)168 Provides (dagger.Provides)98 Provides (com.google.inject.Provides)57 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)21 Named (javax.inject.Named)17 OkHttpClient (okhttp3.OkHttpClient)17 Cache (okhttp3.Cache)10 List (java.util.List)9 ConfigBinder.configBinder (com.facebook.airlift.configuration.ConfigBinder.configBinder)8 Binder (com.google.inject.Binder)8 Module (com.google.inject.Module)8 CachingStripeMetadataSource (com.facebook.presto.orc.CachingStripeMetadataSource)7 DwrfAwareStripeMetadataSourceFactory (com.facebook.presto.orc.DwrfAwareStripeMetadataSourceFactory)7 OrcDataSourceId (com.facebook.presto.orc.OrcDataSourceId)7 StorageStripeMetadataSource (com.facebook.presto.orc.StorageStripeMetadataSource)7 StripeMetadataSource (com.facebook.presto.orc.StripeMetadataSource)7 StripeMetadataSourceFactory (com.facebook.presto.orc.StripeMetadataSourceFactory)7 CachingOrcFileTailSource (com.facebook.presto.orc.cache.CachingOrcFileTailSource)7 OrcCacheConfig (com.facebook.presto.orc.cache.OrcCacheConfig)7 OrcFileTailSource (com.facebook.presto.orc.cache.OrcFileTailSource)7