use of com.google.inject.Provides in project VocabHunter by VocabHunter.
the class OsxEventSourceModule method provideExternalEventBroker.
@Provides
public ExternalEventBroker provideExternalEventBroker(final CommandLineEventSource commandLineEventSource, final OsxEventSource osxEventSource, final ThreadPoolTool threadPoolTool) {
ExternalEventBrokerImpl externalEventBroker = new ExternalEventBrokerImpl(threadPoolTool);
commandLineEventSource.setListener(externalEventBroker);
osxEventSource.setListener(externalEventBroker);
return externalEventBroker;
}
use of com.google.inject.Provides in project VocabHunter by VocabHunter.
the class StandardEventSourceModule method provideExternalEventBroker.
@Provides
public ExternalEventBroker provideExternalEventBroker(final CommandLineEventSource commandLineEventSource, final ThreadPoolTool threadPoolTool) {
ExternalEventBrokerImpl externalEventBroker = new ExternalEventBrokerImpl(threadPoolTool);
commandLineEventSource.setListener(externalEventBroker);
return externalEventBroker;
}
use of com.google.inject.Provides in project aroma-data-operations by RedRoma.
the class ModuleTesting method provideDataSource.
@Provides
DataSource provideDataSource() throws MalformedURLException, SQLException {
String url = createProductionTestConnection();
PGSimpleDataSource dataSource = new PGSimpleDataSource();
dataSource.setUrl(url);
try (Connection conn = dataSource.getConnection()) {
System.out.println("Connected");
}
return dataSource;
}
use of com.google.inject.Provides in project aroma-data-operations by RedRoma.
the class ModuleCassandraDevCluster method provideReconnectPolicy.
@Provides
ReconnectionPolicy provideReconnectPolicy() {
long baseAttempt = TimeUnit.SECONDS.toMillis(5);
long maxTimeWaiting = TimeUnit.MINUTES.toMillis(1);
ExponentialReconnectionPolicy policy = new ExponentialReconnectionPolicy(baseAttempt, maxTimeWaiting);
return policy;
}
use of com.google.inject.Provides in project EventHub by Codecademy.
the class Module method getEventHubHandler.
@Provides
private EventHubHandler getEventHubHandler(Injector injector, EventHub eventHub) throws ClassNotFoundException {
Map<String, Provider<Command>> commandsMap = Maps.newHashMap();
Reflections reflections = new Reflections(PACKAGE_NAME);
Set<Class<? extends Command>> commandClasses = reflections.getSubTypesOf(Command.class);
for (Class<? extends Command> commandClass : commandClasses) {
String path = commandClass.getAnnotation(Path.class).value();
//noinspection unchecked
commandsMap.put(path, (Provider<Command>) injector.getProvider(commandClass));
}
return new EventHubHandler(eventHub, commandsMap);
}
Aggregations