use of com.google.inject.Provides in project camel by apache.
the class CamelModuleWithRouteTypes method routes.
@Provides
Set<RoutesBuilder> routes(Injector injector) {
Set<RoutesBuilder> answer = Sets.newHashSet();
for (Class<? extends RoutesBuilder> type : routes) {
RoutesBuilder route = injector.getInstance(type);
answer.add(route);
}
return answer;
}
use of com.google.inject.Provides in project presto by prestodb.
the class MongoClientModule method createMongoSession.
@Singleton
@Provides
public static MongoSession createMongoSession(TypeManager typeManager, MongoClientConfig config) {
requireNonNull(config, "config is null");
MongoClientOptions.Builder options = MongoClientOptions.builder();
options.connectionsPerHost(config.getConnectionsPerHost()).connectTimeout(config.getConnectionTimeout()).socketTimeout(config.getSocketTimeout()).socketKeepAlive(config.getSocketKeepAlive()).sslEnabled(config.getSslEnabled()).maxWaitTime(config.getMaxWaitTime()).minConnectionsPerHost(config.getMinConnectionsPerHost()).readPreference(config.getReadPreference().getReadPreference()).writeConcern(config.getWriteConcern().getWriteConcern());
if (config.getRequiredReplicaSetName() != null) {
options.requiredReplicaSetName(config.getRequiredReplicaSetName());
}
MongoClient client = new MongoClient(config.getSeeds(), config.getCredentials(), options.build());
return new MongoSession(typeManager, client, config);
}
use of com.google.inject.Provides in project PocketHub by pockethub.
the class PocketHubModule method issueStore.
@Provides
IssueStore issueStore(Context context) {
IssueStore store = issues != null ? issues.get() : null;
if (store == null) {
store = new IssueStore(context);
issues = new WeakReference<>(store);
}
return store;
}
use of com.google.inject.Provides in project PocketHub by pockethub.
the class PocketHubModule method commitStore.
@Provides
CommitStore commitStore(Context context) {
CommitStore store = commits != null ? commits.get() : null;
if (store == null) {
store = new CommitStore(context);
commits = new WeakReference<>(store);
}
return store;
}
use of com.google.inject.Provides in project PocketHub by pockethub.
the class PocketHubModule method gistStore.
@Provides
GistStore gistStore(Context context) {
GistStore store = gists != null ? gists.get() : null;
if (store == null) {
store = new GistStore(context);
gists = new WeakReference<>(store);
}
return store;
}
Aggregations