Java Code Examples for com.google.inject.multibindings.Multibinder#newSetBinder()

The following examples show how to use com.google.inject.multibindings.Multibinder#newSetBinder() . 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: KuduModule.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure()
{
    bind(TypeManager.class).toInstance(typeManager);

    bind(KuduConnector.class).in(Scopes.SINGLETON);
    bind(KuduMetadata.class).in(Scopes.SINGLETON);
    bind(KuduTableProperties.class).in(Scopes.SINGLETON);
    bind(ConnectorSplitManager.class).to(KuduSplitManager.class).in(Scopes.SINGLETON);
    bind(ConnectorPageSourceProvider.class).to(KuduPageSourceProvider.class)
            .in(Scopes.SINGLETON);
    bind(ConnectorPageSinkProvider.class).to(KuduPageSinkProvider.class).in(Scopes.SINGLETON);
    bind(KuduHandleResolver.class).in(Scopes.SINGLETON);
    bind(KuduRecordSetProvider.class).in(Scopes.SINGLETON);
    configBinder(binder()).bindConfig(KuduClientConfig.class);

    bind(RangePartitionProcedures.class).in(Scopes.SINGLETON);
    Multibinder.newSetBinder(binder(), Procedure.class);
}
 
Example 2
Source File: VideoPreviewServerModule.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
   bind(BridgeServerConfig.class);
   bind(PreviewConfig.class);
   bind(BridgeServerTlsContext.class).to(BridgeServerTlsContextImpl.class);
   bind(BridgeServerTrustManagerFactory.class).to(NullTrustManagerFactoryImpl.class);
   bind(ChannelInboundHandler.class).toProvider(BaseWebSocketServerHandlerProvider.class);
   bind(new TypeLiteral<ChannelInitializer<SocketChannel>>(){}).to(HttpRequestInitializer.class);
   bind(Authenticator.class).to(ShiroAuthenticator.class);
   bind(SessionFactory.class).to(DefaultSessionFactoryImpl.class);
   bind(SessionRegistry.class).to(DefaultSessionRegistryImpl.class);
   bind(RequestMatcher.class).annotatedWith(Names.named("WebSocketUpgradeMatcher")).to(NeverMatcher.class);
   bind(RequestAuthorizer.class).annotatedWith(Names.named("SessionAuthorizer")).to(SessionAuth.class);
   bind(IrisNettyAuthorizationContextLoader.class).to(SubscriberAuthorizationContextLoader.class);

   // No Session Listeners
   Multibinder<SessionListener> slBindings = Multibinder.newSetBinder(binder(), SessionListener.class);

   // Bind Http Handlers
   Multibinder<RequestHandler> rhBindings = Multibinder.newSetBinder(binder(), RequestHandler.class);
   rhBindings.addBinding().to(RootRedirect.class);
   rhBindings.addBinding().to(IndexPage.class);
   rhBindings.addBinding().to(CheckPage.class);
   rhBindings.addBinding().to(PreviewHandler.class);
}
 
Example 3
Source File: AlexaServerModule.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {

   bind(Address.class).annotatedWith(Names.named(VoiceBridgeConfig.NAME_BRIDGEADDRESS)).toInstance(AlexaUtil.ADDRESS_BRIDGE);
   bind(String.class).annotatedWith(Names.named(VoiceBridgeConfig.NAME_BRIDGEASSISTANT)).toInstance(VoiceService.StartPlaceRequest.ASSISTANT_ALEXA);

   bind(AlexaPlatformService.class).asEagerSingleton();

   Multibinder<SmartHomeSkillHandler> handlers = Multibinder.newSetBinder(binder(), SmartHomeSkillHandler.class);
   handlers.addBinding().to(SmartHomeSkillV2Handler.class);
   handlers.addBinding().to(SmartHomeSkillV3Handler.class);

   // Bind Http Handlers
   Multibinder<RequestHandler> rhBindings = Multibinder.newSetBinder(binder(), RequestHandler.class);
   rhBindings.addBinding().to(SmartHomeSkillRequestHandler.class);

   VoiceBridgeMetrics metrics = new VoiceBridgeMetrics("alexa-bridge","alexa.bridge", "directive");
   bind(BridgeMetrics.class).toInstance(metrics);
   bind(VoiceBridgeMetrics.class).toInstance(metrics);
}
 
Example 4
Source File: CapabilityDispatcherModule.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
	annotatedObjects = Multibinder.newSetBinder(binder(), Object.class);
	resolvers = Multibinder.newSetBinder(binder(), new TypeLiteral<ArgumentResolverFactory<PlatformMessage, MessageBody>>() { });
	matchers = Multibinder.newSetBinder(binder(), AddressMatcher.class);
	matchers.addBinding().toInstance(matcher());
	bind(Dispatcher.class).asEagerSingleton();
}
 
Example 5
Source File: SystemConnectorModule.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(Binder binder)
{
    Multibinder<SystemTable> globalTableBinder = Multibinder.newSetBinder(binder, SystemTable.class);
    globalTableBinder.addBinding().to(NodeSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(QuerySystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(TaskSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(CatalogSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(TableCommentSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(SchemaPropertiesSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(TablePropertiesSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(ColumnPropertiesSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(AnalyzePropertiesSystemTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(TransactionsSystemTable.class).in(Scopes.SINGLETON);

    globalTableBinder.addBinding().to(AttributeJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(CatalogJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(ColumnJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(TypesJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(ProcedureColumnJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(ProcedureJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(PseudoColumnJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(SchemaJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(SuperTableJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(SuperTypeJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(TableJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(TableTypeJdbcTable.class).in(Scopes.SINGLETON);
    globalTableBinder.addBinding().to(UdtJdbcTable.class).in(Scopes.SINGLETON);

    Multibinder.newSetBinder(binder, Procedure.class);

    binder.bind(KillQueryProcedure.class).in(Scopes.SINGLETON);

    binder.bind(GlobalSystemConnectorFactory.class).in(Scopes.SINGLETON);
    binder.bind(SystemConnectorRegistrar.class).asEagerSingleton();
}
 
Example 6
Source File: ControlCenterInjectionModule.java    From openAGV with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a multibinder that can be used to register {@link ControlCenterPanel} implementations
 * for the kernel's operating mode.
 *
 * @return The multibinder.
 */
@SuppressWarnings("deprecation")
protected Multibinder<org.opentcs.components.kernel.ControlCenterPanel> controlCenterPanelBinderOperating() {
  return Multibinder.newSetBinder(binder(),
                                  org.opentcs.components.kernel.ControlCenterPanel.class,
                                  ActiveInOperatingMode.class);
}
 
Example 7
Source File: ClientBridgeHealthCheckModule.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
   super.configure();
   
   Multibinder<HttpResource> resourceBinder =
         Multibinder
            .newSetBinder(binder(), HttpResource.class, Names.named(HealthCheckServerConfig.NAME_HEALTHCHECK_RESOURCES));
   resourceBinder.addBinding().to(ClientSessionsPage.class);
   resourceBinder.addBinding().to(AdHocSessionAction.class);
}
 
Example 8
Source File: VoiceBridgeModule.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
   bind(BridgeServerConfig.class);
   bind(BridgeServerTlsContext.class).to(BridgeServerTlsContextImpl.class);
   bind(BridgeServerTrustManagerFactory.class).to(NullTrustManagerFactoryImpl.class);
   bind(ChannelInboundHandler.class).toProvider(BaseWebSocketServerHandlerProvider.class);
   bind(CHANNEL_INITIALIZER_TYPE_LITERAL).to(HttpRequestInitializer.class);
   bind(RequestMatcher.class).annotatedWith(Names.named("WebSocketUpgradeMatcher")).to(NeverMatcher.class);
   bind(IrisNettyAuthorizationContextLoader.class).to(IrisNettyNoopAuthorizationContextLoader.class);

   // No Session Listeners
   Multibinder<SessionListener> slBindings = Multibinder.newSetBinder(binder(), SessionListener.class);

   // Bind Http Handlers
   Multibinder<RequestHandler> rhBindings = Multibinder.newSetBinder(binder(), RequestHandler.class);
   rhBindings.addBinding().to(RootRedirect.class);
   rhBindings.addBinding().to(IndexPage.class);
   rhBindings.addBinding().to(CheckPage.class);

   rhBindings.addBinding().to(SessionLogin.class);
   rhBindings.addBinding().to(SessionLogout.class);
   rhBindings.addBinding().to(ListPlacesRESTHandler.class);
   rhBindings.addBinding().to(TokenHandler.class);
   rhBindings.addBinding().to(RevokeHandler.class);
   rhBindings.addBinding().to(AuthorizeHandler.class);

   // oauth
   bind(OAuthDAO.class).to(CassandraOAuthDAO.class);
   bind(RequestAuthorizer.class).annotatedWith(Names.named("SessionAuthorizer")).to(SessionAuth.class);
   bind(SessionFactory.class).to(DefaultSessionFactoryImpl.class);
   bind(SessionRegistry.class).to(DefaultSessionRegistryImpl.class);
   bind(Responder.class).annotatedWith(Names.named("SessionLogin")).to(SessionLoginResponder.class);
   bind(Responder.class).annotatedWith(Names.named("SessionLogout")).to(SessionLogoutResponder.class);
   bind(Authenticator.class).to(ShiroAuthenticator.class);
   bind(PlaceSelectionHandler.class).to(VoicePlaceSelectionHandler.class);
}
 
Example 9
Source File: KinesisModule.java    From presto with Apache License 2.0 4 votes vote down vote up
private static void bindInternalColumn(Binder binder, KinesisInternalFieldDescription fieldDescription)
{
    Multibinder<KinesisInternalFieldDescription> fieldDescriptionBinder = Multibinder.newSetBinder(binder, KinesisInternalFieldDescription.class);
    fieldDescriptionBinder.addBinding().toInstance(fieldDescription);
}
 
Example 10
Source File: AbstractIrisModule.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
protected <T> Multibinder<T> bindSetOf(TypeLiteral<T> type) {
	return Multibinder.newSetBinder(binder(), type);
}
 
Example 11
Source File: ProtocolMessagesModule.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
   Multibinder<TypeAdapterFactory> typeAdapterFactoryBinder = Multibinder.newSetBinder(binder(), new TypeLiteral<TypeAdapterFactory>() {});
   typeAdapterFactoryBinder.addBinding().to(ProtocolMessageTypeAdapterFactory.class);
}
 
Example 12
Source File: AbstractIrisModule.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
protected <T> Multibinder<T> bindSetOf(Class<T> type) {
	return Multibinder.newSetBinder(binder(), type);
}
 
Example 13
Source File: HubServerModule.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
    bind(TrustConfig.class);

    bind(HubMessageFilter.class).to(DefaultHubMessageFilterImpl.class);

    bind(BridgeServerTlsContext.class).to(BridgeServerTlsContextImpl.class);
    bind(BridgeServerTrustManagerFactory.class).to(HubTrustManagerFactoryImpl.class);
    bind(PlatformBusService.class).to(PlatformBusServiceImpl.class).asEagerSingleton();
    bind(ProtocolBusService.class).to(ProtocolBusServiceImpl.class).asEagerSingleton();
    bindSetOf(PlatformBusListener.class)
            .addBinding()
            .to(HubPlatformBusListener.class);

    bindSetOf(ProtocolBusListener.class)
            .addBinding()
            .to(HubProtocolBusListener.class);

    bind(new TypeLiteral<DeviceMessageHandler<ByteBuf>>() {
    }).to(HubMessageHandler.class);

    Multibinder<DirectMessageHandler> directHandlers = bindSetOf(DirectMessageHandler.class);
    directHandlers.addBinding().to(HubConnectedHandler.class);
    directHandlers.addBinding().to(HubRegisteredResponseHandler.class);
    directHandlers.addBinding().to(HubFirmwareUpgradeProcessEventHandler.class);
    directHandlers.addBinding().to(HubFirmwareUpdateResponseHandler.class);


    bind(new TypeLiteral<ChannelInitializer<SocketChannel>>() {
    }).to(Bridge10ChannelInitializer.class);
    bind(ChannelInboundHandler.class).toProvider(Binary10WebSocketServerHandlerProvider.class);

    bind(RequestMatcher.class).annotatedWith(Names.named("WebSocketUpgradeMatcher")).to(WebSocketUpgradeMatcher.class);
    bind(RequestAuthorizer.class).annotatedWith(Names.named("SessionAuthorizer")).to(AlwaysAllow.class);

    // No Session Listeners
    Multibinder<SessionListener> slBindings = Multibinder.newSetBinder(binder(), SessionListener.class);

    // Bind Http Handlers
    Multibinder<RequestHandler> rhBindings = Multibinder.newSetBinder(binder(), RequestHandler.class);
    if (clientAuthRequired) {
        rhBindings.addBinding().to(RootRedirect.class);
        rhBindings.addBinding().to(IndexPage.class);
    } else {
        rhBindings.addBinding().to(RootRemoteRedirect.class);
    }
    rhBindings.addBinding().to(CheckPage.class);

}
 
Example 14
Source File: KernelInjectionModule.java    From openAGV with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a multibinder that can be used to register 
 * {@link org.opentcs.components.kernel.ControlCenterPanel} implementations for the kernel's 
 * operating mode.
 *
 * @return The multibinder.
 * @deprecated Use {@link ControlCenterInjectionModule#controlCenterPanelBinderOperating()}
 * instead.
 */
@Deprecated
@ScheduledApiChange(when = "5.0")
protected Multibinder<org.opentcs.components.kernel.ControlCenterPanel> controlCenterPanelBinderOperating() {
  return Multibinder.newSetBinder(binder(),
                                  org.opentcs.components.kernel.ControlCenterPanel.class,
                                  ActiveInOperatingMode.class);
}
 
Example 15
Source File: PlantOverviewInjectionModule.java    From openAGV with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a multibinder that can be used to register plant model importers.
 *
 * @return The multibinder.
 */
protected Multibinder<PlantModelImporter> plantModelImporterBinder() {
  return Multibinder.newSetBinder(binder(), PlantModelImporter.class);
}
 
Example 16
Source File: PlantOverviewInjectionModule.java    From openAGV with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a multibinder that can be used to register location themes.
 *
 * @return The multibinder.
 * @deprecated The theme to be used is now set directly via configuration.
 */
@Deprecated
@ScheduledApiChange(when = "5.0", details = "Will be removed.")
protected Multibinder<LocationTheme> locationThemeBinder() {
  return Multibinder.newSetBinder(binder(), LocationTheme.class);
}
 
Example 17
Source File: PlantOverviewInjectionModule.java    From openAGV with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a multibinder that can be used to register plant model exporters.
 *
 * @return The multibinder.
 */
protected Multibinder<PlantModelExporter> plantModelExporterBinder() {
  return Multibinder.newSetBinder(binder(), PlantModelExporter.class);
}
 
Example 18
Source File: KernelInjectionModule.java    From openAGV with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a multibinder that can be used to register kernel extensions for all kernel states.
 *
 * @return The multibinder.
 */
protected Multibinder<KernelExtension> extensionsBinderAllModes() {
  return Multibinder.newSetBinder(binder(), KernelExtension.class, ActiveInAllModes.class);
}
 
Example 19
Source File: PlantOverviewInjectionModule.java    From openAGV with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a multibinder that can be used to register factories for pluggable panels.
 *
 * @return The multibinder.
 */
protected Multibinder<PluggablePanelFactory> pluggablePanelFactoryBinder() {
  return Multibinder.newSetBinder(binder(), PluggablePanelFactory.class);
}
 
Example 20
Source File: PlantOverviewInjectionModule.java    From openAGV with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a multibinder that can be used to register classes that provide suggested order
 * categories.
 *
 * @return The multibinder.
 */
protected Multibinder<OrderCategorySuggestions> orderCategorySuggestionsBinder() {
  return Multibinder.newSetBinder(binder(), OrderCategorySuggestions.class);
}