Java Code Examples for com.google.inject.Inject

The following examples show how to use com.google.inject.Inject. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: arcusplatform   Source File: SessionHeartBeater.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public SessionHeartBeater(
   Partitioner partitioner,
   IntraServiceMessageBus intraServiceBus,
   Supplier<Stream<PartitionedSession>> sessionSupplier
) {
   this.sessionSupplier = sessionSupplier;
   this.partitioner = partitioner;
   this.intraServiceBus = intraServiceBus;
   this.executor = Executors
      .newSingleThreadScheduledExecutor(
         ThreadPoolBuilder
            .defaultFactoryBuilder()
            .setNameFormat("ipcd-session-heartbeat")
            .build()
      );
   this.heartbeatTimer = IrisMetrics.metrics("bridge.ipcd").timer("heartbeat");
}
 
Example 2
Source Project: arcusplatform   Source File: AlexaPlatformService.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public AlexaPlatformService(AlexaPlatformServiceConfig config, PlatformMessageBus bus) {
   this.bus = bus;
   workerPool = new ThreadPoolBuilder()
      .withMaxPoolSize(config.getMaxListenerThreads())
      .withKeepAliveMs(config.getListenerThreadKeepAliveMs())
      .withNameFormat(DISPATCHER_POOL_NAME + "-%d")
      .withBlockingBacklog()
      .withMetrics("alexa.bridge")
      .build();
   timeoutPool = new HashedWheelTimer(new ThreadFactoryBuilder()
      .setDaemon(true)
      .setNameFormat(TIMEOUT_POOL_NAME + "-%d")
      .setUncaughtExceptionHandler(new LoggingUncaughtExceptionHandler(logger))
      .build());
   defaultTimeoutSecs = config.getDefaultTimeoutSecs();
}
 
Example 3
Source Project: arcusplatform   Source File: PlaceDeleter.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public PlaceDeleter(
      AccountDAO accountDao,
      PlaceDAO placeDao,
      PersonDAO personDao,
      AuthorizationGrantDAO grantDao,
      PreferencesDAO preferencesDao,
      SubscriptionUpdater subscriptionUpdater,
      PersonDeleter personDeleter,
      PlatformMessageBus bus
) {
   this.accountDao = accountDao;
   this.placeDao = placeDao;
   this.personDao = personDao;
   this.grantDao = grantDao;
   this.preferencesDao = preferencesDao;
   this.subscriptionUpdater = subscriptionUpdater;
   this.personDeleter = personDeleter;
   this.bus = bus;
}
 
Example 4
Source Project: arcusplatform   Source File: PlatformServiceDispatcher.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public PlatformServiceDispatcher(
      PlatformServiceConfig config,
      PlatformMessageBus bus,
      Set<PlatformService> services
  ) {
	this.bus = bus;
	this.services = IrisCollections.toUnmodifiableMap(services, (service) -> service.getAddress());
	this.executor =
	      new ThreadPoolBuilder()
	         .withMaxPoolSize(config.getThreads())
	         .withKeepAliveMs(config.getKeepAliveMs())
	         .withBlockingBacklog()
	         .withNameFormat("platform-service-%d")
	         .withMetrics("platform.service")
	         .build();
	         
}
 
Example 5
Source Project: arcusplatform   Source File: CreateRequestHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public CreateRequestHandler(
		ContextLoader loader,
      PlatformMessageBus platformBus,
      PlaceExecutorRegistry registry,
      PlaceDAO placeDao, 
      SceneDao sceneDao,
      BeanAttributesTransformer<SceneDefinition> transformer
) {
	this.loader = loader;
   this.platformBus = platformBus;
   this.registry = registry;
   this.placeDao = placeDao;
   this.sceneDao = sceneDao;
   this.transformer = transformer;
}
 
Example 6
Source Project: arcusplatform   Source File: CommandExecutor.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public CommandExecutor(
   PlatformMessageBus bus,
   @Named(VoiceConfig.NAME_EXECUTOR) ExecutorService executor,
   VoiceConfig config,
   @Named(VoiceConfig.NAME_TIMEOUT_TIMER) HashedWheelTimer timeoutTimer,
   ResponseCompleter responseCompleter,
   PlacePopulationCacheManager populationCacheMgr
) {
   this.executor = executor;
   this.config = config;
   this.timeoutTimer = timeoutTimer;
   this.responseCompleter = responseCompleter;
   this.populationCacheMgr = populationCacheMgr;
   this.busClient = new PlatformBusClient(bus, executor, ImmutableSet.of(AddressMatchers.equals(Address.platformService(VoiceService.NAMESPACE))));
}
 
Example 7
@Inject
public VideoMetadataV2FavoriteTable(String ts, Session session) {
	super(ts, session);
	this.deleteField =
			CassandraQueryBuilder
				.delete(getTableName())
				.addWhereColumnEquals(COL_RECORDINGID)
				.addWhereColumnEquals(COL_FIELD)
				.prepare(session);
	this.insertField =
			CassandraQueryBuilder
				.insert(getTableName())
				.addColumns(COLUMNS)
				.withRetryPolicy(new LoggingRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE))
				.prepare(session);
}
 
Example 8
Source Project: arcusplatform   Source File: PersonSetAttributesHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public PersonSetAttributesHandler(
      CapabilityRegistry capabilityRegistry,
      BeanAttributesTransformer<Person> personTransformer,
      AccountDAO accountDao,
      PersonDAO personDao,
      PersonPlaceAssocDAO personPlaceAssocDao,
      BillingClient client,
      PlatformMessageBus platformBus,
      PlacePopulationCacheManager populationCacheMgr
) {
   super(capabilityRegistry, personTransformer, platformBus, populationCacheMgr);
   this.accountDao = accountDao;
   this.personDao = personDao;
   this.client = client;
   this.personPlaceAssocDao = personPlaceAssocDao;
}
 
Example 9
Source Project: arcusplatform   Source File: HistoryTable.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public DetailedHubTable(@Named(CassandraHistory.NAME) Session session, HistoryAppenderConfig config) {
   super(
         CassandraQueryBuilder
            .insert(TABLE_NAME)
            .addColumns(Columns.HUB_ID, Columns.TIMESTAMP, Columns.MESSAGE_KEY, Columns.PARAMS, Columns.SUBJECT_ADDRESS)
            .withTtlSec(TimeUnit.HOURS.toSeconds(config.getDetailedHubTtlHours()))
            .prepare(session),
         CassandraQueryBuilder
            .select(TABLE_NAME)
            .addColumns(Columns.HUB_ID, Columns.TIMESTAMP, Columns.MESSAGE_KEY, Columns.PARAMS, Columns.SUBJECT_ADDRESS)
            .addWhereColumnEquals(Columns.HUB_ID)
            .withConsistencyLevel(ConsistencyLevel.LOCAL_ONE)
            .prepare(session),
         CassandraQueryBuilder
            .select(TABLE_NAME)
            .addColumns(Columns.HUB_ID, Columns.TIMESTAMP, Columns.MESSAGE_KEY, Columns.PARAMS, Columns.SUBJECT_ADDRESS)
            .where(Columns.HUB_ID + " = ? AND " + Columns.TIMESTAMP + " <= ?")
            .withConsistencyLevel(ConsistencyLevel.LOCAL_ONE)
            .prepare(session)
   );
}
 
Example 10
Source Project: arcusplatform   Source File: ProtocolBusServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public ProtocolBusServiceImpl(
      ProtocolMessageBus protocolBus,
      BridgeMetrics bridgeMetrics,
      Set<ProtocolBusListener> listeners
) {
   super(protocolBus, ADDRESSES, bridgeMetrics);
   for(ProtocolBusListener listener: listeners) {
      addProtocolListener(listener);
   }
}
 
Example 11
@Inject
public PersistenceShutdownHookInstaller(
        final @NotNull ShutdownHooks shutdownHooks, final @NotNull PersistenceShutdownHook persistenceShutdownHook,
        final @NotNull PersistenceStartup persistenceStartup) {
    this.shutdownHooks = shutdownHooks;
    this.persistenceShutdownHook = persistenceShutdownHook;
    this.persistenceStartup = persistenceStartup;
}
 
Example 12
Source Project: arcusplatform   Source File: AppFallbackHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public AppFallbackHandler(
		AlwaysAllow authorizer, 
		BridgeMetrics metrics,
		BounceConfig config
) {
	super(authorizer, new HttpSender(WebRunHandler.class, metrics));
	this.androidStoreUrl = config.getAndroidStoreUrl();
	this.appleStoreUrl = config.getAppleStoreUrl();
	this.helpUrl = config.getHelpUrl();
}
 
Example 13
Source Project: arcusplatform   Source File: VideoRecordingServer.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public VideoRecordingServer(
      PlaceDAO placeDao,
      VideoRecordingManager dao,
      RecordingEventPublisher eventPublisher,
      VideoStorage videoStorage,
      VideoRecordingServerConfig videoConfig,
      VideoSessionRegistry registry,
      BridgeServerTlsContext serverTlsContext,
      Provider<TrafficHandler> trafficHandlerProvider,
      @Named("videoBossGroup") EventLoopGroup videoBossGroup,
      @Named("videoWorkerGroup") EventLoopGroup videoWorkerGroup,
      @Named("videoTcpChannelOptions") Map<ChannelOption<?>, Object> videoChildChannelOptions,
      @Named("videoTcpParentChannelOptions") Map<ChannelOption<?>, Object> videoParentChannelOptions,
      @Named("bridgeEventLoopProvider") BridgeServerEventLoopProvider eventLoopProvider,
      VideoTtlResolver ttlResolver
 ) {
   this.placeDao = placeDao;
   this.dao = dao;
   this.eventPublisher = eventPublisher;
   this.videoStorage = videoStorage;
   this.videoConfig = videoConfig;
   this.registry = registry;
   this.videoBossGroup = videoBossGroup;
   this.videoWorkerGroup = videoWorkerGroup;
   this.serverTlsContext = serverTlsContext;
   this.videoChildChannelOptions = videoChildChannelOptions;
   this.videoParentChannelOptions = videoParentChannelOptions;
   this.trafficHandlerProvider = trafficHandlerProvider;
   this.eventLoopProvider = eventLoopProvider;
   this.ttlResolver = ttlResolver;
}
 
Example 14
@Inject
public GetProductsByCategoryRESTHandler(AlwaysAllow alwaysAllow, BridgeMetrics metrics,
		ProductCatalogManager manager, PopulationDAO populationDao, PlaceDAO placeDao, HubDAO hubDao,
		BeanAttributesTransformer<ProductCatalogEntry> transformer, @Named("UseChunkedSender") RESTHandlerConfig restHandlerConfig) {
	super(alwaysAllow, new HttpSender(GetProductsByCategoryRESTHandler.class, metrics), manager, populationDao, placeDao, hubDao, restHandlerConfig);
	this.listTransformer = new BeanListTransformer<ProductCatalogEntry>(transformer);
}
 
Example 15
Source Project: plugins   Source File: AbyssMinimapOverlay.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Inject
AbyssMinimapOverlay(Client client, RunecraftPlugin plugin, RunecraftConfig config, ItemManager itemManager)
{
	setPosition(OverlayPosition.DYNAMIC);
	setLayer(OverlayLayer.ABOVE_WIDGETS);
	this.client = client;
	this.plugin = plugin;
	this.config = config;
	this.itemManager = itemManager;
}
 
Example 16
Source Project: arcusplatform   Source File: UpdateBillingInfoCCHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public UpdateBillingInfoCCHandler(
      AccountDAO accountDao,
      PersonDAO personDao,
      BillingClient client,
      PlatformMessageBus platformBus) {

   this.accountDao = accountDao;
   this.personDao = personDao;
   this.client = client;
   this.platformBus = platformBus;
}
 
Example 17
Source Project: plugins   Source File: BankGridOverlay.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Inject
private BankGridOverlay(InventoryGridConfig config, Client client, ItemManager itemManager, InventoryGridPlugin plugin)
{
	this.plugin = plugin;
	this.itemManager = itemManager;
	this.client = client;
	this.config = config;

	setPosition(OverlayPosition.DYNAMIC);
	setLayer(OverlayLayer.ABOVE_WIDGETS);
}
 
Example 18
Source Project: plugins   Source File: FarmingTracker.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Inject
private FarmingTracker(Client client, ItemManager itemManager, ConfigManager configManager, TimeTrackingConfig config, FarmingWorld farmingWorld)
{
	this.client = client;
	this.itemManager = itemManager;
	this.configManager = configManager;
	this.config = config;
	this.farmingWorld = farmingWorld;
}
 
Example 19
Source Project: arcusplatform   Source File: HttpHealthCheckServer.java    License: Apache License 2.0 5 votes vote down vote up
@Inject 
public HttpHealthCheckServer(
      HealthCheckServerConfig config,
      BridgeMetrics metrics,
      @Named(HealthCheckServerConfig.NAME_HEALTHCHECK_RESOURCES)
      Set<HttpResource> resources
) {
   this.initializer = new HttpServerChannelInitializer();
   this.initializer.setMaxRequestSizeBytes(config.getMaxRequestSizeBytes());
   this.initializer.setHandler(new HttpRequestHandler(resources, metrics));
   this.initializer.setClientFactory(new NoAuthClientRegistry());
   this.port = config.getPort();
}
 
Example 20
@Inject
public DefinitionTransformCapabilityRegistry(DefinitionRegistry registry) {
	capabilitiesByName = new HashMap<String, CapabilityDefinition>();
	capabilitiesByNamespace = new HashMap<String, CapabilityDefinition>();
	capabilities = new ArrayList<>();
	ingest(registry.getCapabilities());
}
 
Example 21
Source Project: arcusplatform   Source File: HubHeartbeatListener.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
@Inject
public HubHeartbeatListener(
      PlatformMessageBus platformBus,
      HubRegistry hubs,
      Partitioner partitioner
) {
   super(platformBus);
   this.hubs = hubs;
   this.partitioner = partitioner;
}
 
Example 22
Source Project: arcusplatform   Source File: SetSecurityAnswersHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public SetSecurityAnswersHandler(
      PersonDAO personDao,
      @Named(NAME_RESOURCE_BUNDLE) ResourceBundle securityQuestionBundle,
      PlatformMessageBus platformBus
) {
   this.personDao = personDao;
   this.securityQuestionBundle = securityQuestionBundle;
   this.platformBus = platformBus;
}
 
Example 23
Source Project: arcusplatform   Source File: AccountActivateHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public AccountActivateHandler(AccountDAO accountDao, 
		PersonDAO personDao, 
		PlatformMessageBus platformBus,
		PlacePopulationCacheManager populationCacheMgr) {
   this.accountDao = accountDao;
   this.personDao = personDao;
   this.platformBus = platformBus;
   this.populationCacheMgr = populationCacheMgr;
}
 
Example 24
Source Project: arcusplatform   Source File: ForceRemoveRequestHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public ForceRemoveRequestHandler(
      DeviceDAO deviceDao,
      PlatformMessageBus platformBus,
      Set<GroovyDriverPlugin> plugins,
      DeviceService service
) {
   super(deviceDao, platformBus, plugins);
   this.service = service;
}
 
Example 25
Source Project: arcusplatform   Source File: DirectMessageExecutor.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public DirectMessageExecutor(Set<DirectMessageHandler> handlers) {
   if (handlers != null) {
      handlers.forEach((h) -> this.handlers.put(h.supportsMessageType(), h));
   }

   this.refuseConnection = new RefuseConnectionException();
}
 
Example 26
Source Project: arcusplatform   Source File: RemoveRequestHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public RemoveRequestHandler(
		PlatformMessageBus bus,
		ProductLoader loader
) {
	this.bus = bus;
	this.loader = loader;
}
 
Example 27
Source Project: presto   Source File: KinesisMetadata.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public KinesisMetadata(
        KinesisConfig kinesisConfig,
        Supplier<Map<SchemaTableName, KinesisStreamDescription>> tableDescriptionSupplier,
        Set<KinesisInternalFieldDescription> internalFieldDescriptions)
{
    requireNonNull(kinesisConfig, "kinesisConfig is null");
    isHideInternalColumns = kinesisConfig.isHideInternalColumns();
    this.tableDescriptionSupplier = requireNonNull(tableDescriptionSupplier);
    this.internalFieldDescriptions = requireNonNull(internalFieldDescriptions, "internalFieldDescriptions is null");
}
 
Example 28
Source Project: presto   Source File: KinesisTableDescriptionSupplier.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public KinesisTableDescriptionSupplier(
        KinesisConfig kinesisConfig,
        JsonCodec<KinesisStreamDescription> streamDescriptionCodec,
        S3TableConfigClient s3TableConfigClient)
{
    this.kinesisConfig = requireNonNull(kinesisConfig, "kinesisConfig is null");
    this.streamDescriptionCodec = requireNonNull(streamDescriptionCodec, "streamDescriptionCodec is null");
    this.s3TableConfigClient = requireNonNull(s3TableConfigClient, "S3 table config client is null");
}
 
Example 29
Source Project: arcusplatform   Source File: HttpRequestInitializer.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public HttpRequestInitializer(
   Provider<ChannelInboundHandler> channelInboundProvider,
   BridgeServerTlsContext tlsContext, 
   BridgeServerConfig serverConfig, 
   VideoConfig videoConfig,
   IrisNettyCorsConfig corsConfig
) {
   this.serverTlsContext = tlsContext;
   this.serverConfig = serverConfig;
   this.videoConfig = videoConfig;
   this.channelInboundProvider = channelInboundProvider;
   this.corsConfig = corsConfig;
}
 
Example 30
Source Project: arcusplatform   Source File: GetProductsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public GetProductsHandler(BeanAttributesTransformer<ProductCatalogEntry> transformer,
      PopulationDAO populationDao,
      ProductCatalogManager manager) {
   super(populationDao, manager);
   listTransformer = new BeanListTransformer<ProductCatalogEntry>(transformer);
}