com.google.inject.Inject Java Examples

The following examples show how to use com.google.inject.Inject. 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 File: PlatformServiceDispatcher.java    From arcusplatform with 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 #2
Source File: VideoMetadataV2FavoriteTable.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@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 #3
Source File: CommandExecutor.java    From arcusplatform with 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 #4
Source File: CreateRequestHandler.java    From arcusplatform with 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 #5
Source File: PersonSetAttributesHandler.java    From arcusplatform with 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 #6
Source File: PlaceDeleter.java    From arcusplatform with 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 #7
Source File: HistoryTable.java    From arcusplatform with 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 #8
Source File: AlexaPlatformService.java    From arcusplatform with 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 #9
Source File: SessionHeartBeater.java    From arcusplatform with 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 #10
Source File: HubHeartbeatListener.java    From arcusplatform with 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 #11
Source File: FarmingTracker.java    From plugins with 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 #12
Source File: UpdateBillingInfoCCHandler.java    From arcusplatform with 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 #13
Source File: SetSecurityAnswersHandler.java    From arcusplatform with 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 #14
Source File: AccountActivateHandler.java    From arcusplatform with 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 #15
Source File: VideoRecordingServer.java    From arcusplatform with 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 #16
Source File: GetProductsByCategoryRESTHandler.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@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 #17
Source File: AbyssMinimapOverlay.java    From plugins with 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 #18
Source File: DriverServicesModule.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Inject
public DriverServicesModule(
      DriverModule driver,
      MessagesModule messages,
      KafkaModule kafka,
      GroovyProtocolPluginModule protocolPlugins,
      CassandraDAOModule daos,
      IpcdDeviceDaoModule ipcdDao,
      AttributeMapTransformModule attrTransforms,
      CapabilityRegistryModule capabilityRegistry,
      GroovyDriverModule groovy,
      PlatformModule platform,
      PlacePopulationCacheModule populationCache
) {
}
 
Example #19
Source File: ForceRemoveRequestHandler.java    From arcusplatform with 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 #20
Source File: DirectMessageExecutor.java    From arcusplatform with 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 #21
Source File: RemoveRequestHandler.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Inject
public RemoveRequestHandler(
		PlatformMessageBus bus,
		ProductLoader loader
) {
	this.bus = bus;
	this.loader = loader;
}
 
Example #22
Source File: KinesisMetadata.java    From presto with 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 #23
Source File: KinesisTableDescriptionSupplier.java    From presto with 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 #24
Source File: HttpRequestInitializer.java    From arcusplatform with 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 #25
Source File: GetProductsHandler.java    From arcusplatform with 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);
}
 
Example #26
Source File: TagHandler.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Inject
public TagHandler(IrisNettyMessageUtil messageUtil, AnalyticsMessageBus tagBus, PlacePopulationCacheManager populationCacheMgr)
{
   super(directExecutor());

   this.messageUtil = messageUtil;
   this.tagBus = tagBus;
   this.populationCacheMgr = populationCacheMgr;
}
 
Example #27
Source File: VideoMetadataV2Table.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Inject
public VideoMetadataV2Table(String ts, Session session) {
	super(ts, session);
	this.deleteField =
			CassandraQueryBuilder
				.delete(getTableName())
				.addWhereColumnEquals(COL_RECORDINGID)
				.addWhereColumnEquals(COL_EXPIRATION)
				.addWhereColumnEquals(COL_FIELD)
				.prepare(session);
}
 
Example #28
Source File: PlatformBusClient.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Inject
public PlatformBusClient(@Named(IpcdService.PROP_THREADPOOL) Executor executor, PlatformMessageBus bus) {
   this.executor = executor;
   this.bus = bus;
   timeoutPool = new HashedWheelTimer(new ThreadFactoryBuilder()
      .setDaemon(true)
      .setNameFormat(TIMEOUT_POOL_NAME + "-%d")
      .setUncaughtExceptionHandler(new LoggingUncaughtExceptionHandler(logger))
      .build());
}
 
Example #29
Source File: ApplicationModule.java    From realworld-serverless-application with Apache License 2.0 5 votes vote down vote up
@Singleton
@Inject
@Provides
SsmParameterCachingClient ssmParameterCachingClient() {
  String path = String.format("/applications/apprepo/%s/", System.getProperty("integtests.stage"));
  return new SsmParameterCachingClient(SsmClient.builder()
      .httpClientBuilder(UrlConnectionHttpClient.builder())
      .build(),
      Duration.ofMinutes(5), path);
}
 
Example #30
Source File: ApplicationModule.java    From realworld-serverless-application with Apache License 2.0 5 votes vote down vote up
@Singleton
@Inject
@Provides
S3Client s3Client(){
  return S3Client.builder()
      .httpClientBuilder(UrlConnectionHttpClient.builder())
      .build();
}