Java Code Examples for org.elasticsearch.common.inject.multibindings.MapBinder#newMapBinder()

The following examples show how to use org.elasticsearch.common.inject.multibindings.MapBinder#newMapBinder() . 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: BlobShardExpressionModule.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
    MapBinder<ReferenceIdent, BlobShardReferenceImplementation> binder = MapBinder
            .newMapBinder(binder(), ReferenceIdent.class, BlobShardReferenceImplementation.class);
    if (settings.getAsBoolean(BlobIndices.SETTING_INDEX_BLOBS_ENABLED, false)){

        binder.addBinding(SysShardsTableInfo.ReferenceIdents.ID).to(BlobShardIdExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.NUM_DOCS).to(BlobShardNumDocsExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.PRIMARY).to(BlobShardPrimaryExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.RELOCATING_NODE).to(BlobShardRelocatingNodeExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.SCHEMA_NAME).to(BlobShardSchemaNameExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.SIZE).to(BlobShardSizeExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.STATE).to(BlobShardStateExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.ROUTING_STATE).to(BlobShardRoutingStateExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.TABLE_NAME).to(BlobShardTableNameExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.PARTITION_IDENT).to(BlobShardPartitionIdentExpression.class).asEagerSingleton();
        binder.addBinding(SysShardsTableInfo.ReferenceIdents.ORPHAN_PARTITION).to(BlobShardPartitionOrphanedExpression.class).asEagerSingleton();
    }
}
 
Example 2
Source File: SysShardExpressionModule.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
    MapBinder<ReferenceIdent, ShardReferenceImplementation> b = MapBinder
            .newMapBinder(binder(), ReferenceIdent.class, ShardReferenceImplementation.class);

    b.addBinding(SysShardsTableInfo.ReferenceIdents.ID).to(ShardIdExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.SIZE).to(ShardSizeExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.NUM_DOCS).to(ShardNumDocsExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.PRIMARY).to(ShardPrimaryExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.STATE).to(ShardStateExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.ROUTING_STATE).to(ShardRoutingStateExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.RELOCATING_NODE).to(ShardRelocatingNodeExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.TABLE_NAME).to(ShardTableNameExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.SCHEMA_NAME).to(ShardSchemaNameExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.PARTITION_IDENT).to(ShardPartitionIdentExpression.class).asEagerSingleton();
    b.addBinding(SysShardsTableInfo.ReferenceIdents.ORPHAN_PARTITION).to(ShardPartitionOrphanedExpression.class).asEagerSingleton();
}
 
Example 3
Source File: ReindexModule.java    From elasticsearch-inout-plugin with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
    bind(TransportReindexAction.class).asEagerSingleton();

    bind(ReindexParser.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder =
            MapBinder.newMapBinder(
                    binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(ReindexAction.INSTANCE).to(
            TransportReindexAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder
            .newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(ReindexAction.NAME).toInstance(
            ReindexAction.INSTANCE);

}
 
Example 4
Source File: PredicateModule.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    functionBinder = MapBinder.newMapBinder(binder(), FunctionIdent.class, FunctionImplementation.class);
    resolverBinder = MapBinder.newMapBinder(binder(), String.class, DynamicFunctionResolver.class);
    IsNullPredicate.register(this);
    NotPredicate.register(this);
    MatchPredicate.register(this);
}
 
Example 5
Source File: ExtensionPoint.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void bindExtensions(Binder binder) {
    MapBinder<K, V> mapBinder = MapBinder.newMapBinder(binder, keyType, valueType);
    for (Map.Entry<K, V> entry : map.entrySet()) {
        mapBinder.addBinding(entry.getKey()).toInstance(entry.getValue());
    }
}
 
Example 6
Source File: MetaDataSysModule.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    schemaBinder = MapBinder.newMapBinder(binder(), String.class, SchemaInfo.class);
    schemaBinder.addBinding(SysSchemaInfo.NAME).to(SysSchemaInfo.class).asEagerSingleton();
    bind(TableHealthService.class).asEagerSingleton();
    bind(SysTableDefinitions.class).asEagerSingleton();
}
 
Example 7
Source File: FileCollectModule.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    MapBinder<String, FileInputFactory> binder = MapBinder.newMapBinder(binder(), String.class, FileInputFactory.class);

    binder.addBinding(LocalFsFileInputFactory.NAME).to(LocalFsFileInputFactory.class).asEagerSingleton();
    binder.addBinding(S3FileInputFactory.NAME).to(S3FileInputFactory.class).asEagerSingleton();
}
 
Example 8
Source File: AbstractFunctionModule.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    configureFunctions();

    implementationsBinder = MapBinder.newMapBinder(
        binder(),
        new TypeLiteral<FunctionName>() {},
        new TypeLiteral<List<FunctionProvider>>() {});
    for (Map.Entry<FunctionName, List<FunctionProvider>> entry : functionImplementations.entrySet()) {
        implementationsBinder.addBinding(entry.getKey()).toProvider(entry::getValue);
    }

    // clear registration maps
    functionImplementations = null;
}
 
Example 9
Source File: RepositorySettingsModule.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    typeSettingsBinder = MapBinder.newMapBinder(binder(), String.class, TypeSettings.class);
    typeSettingsBinder.addBinding(FS).toInstance(FS_SETTINGS);
    typeSettingsBinder.addBinding(URL).toInstance(URL_SETTINGS);
    typeSettingsBinder.addBinding(HDFS).toInstance(HDFS_SETTINGS);
    typeSettingsBinder.addBinding(S3).toInstance(S3_SETTINGS);
}
 
Example 10
Source File: SearchIntoModule.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(TransportSearchIntoAction.class).asEagerSingleton();

    bind(SearchIntoParser.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder =
            MapBinder.newMapBinder(
                    binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(SearchIntoAction.INSTANCE).to(
            TransportSearchIntoAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder
            .newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(SearchIntoAction.NAME).toInstance(
            SearchIntoAction.INSTANCE);


    MapBinder<String, WriterCollectorFactory> collectorBinder
            = MapBinder.newMapBinder(binder(),
            String.class, WriterCollectorFactory.class);

    collectorBinder.addBinding(BulkWriterCollector.NAME).toProvider(
            FactoryProvider
                    .newFactory(WriterCollectorFactory.class,
                            BulkWriterCollector.class));


}
 
Example 11
Source File: SysClusterExpressionModule.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    MapBinder<ReferenceIdent, ReferenceImplementation> b = MapBinder
            .newMapBinder(binder(), ReferenceIdent.class, ReferenceImplementation.class);

    b.addBinding(clusterIdent(ClusterIdExpression.NAME)).to(
            ClusterIdExpression.class).asEagerSingleton();
    b.addBinding(clusterIdent(ClusterNameExpression.NAME)).to(
            ClusterNameExpression.class).asEagerSingleton();
    b.addBinding(clusterIdent(ClusterMasterNodeExpression.NAME)).to(
            ClusterMasterNodeExpression.class).asEagerSingleton();
    b.addBinding(clusterIdent(ClusterSettingsExpression.NAME)).to(
            ClusterSettingsExpression.class).asEagerSingleton();
}
 
Example 12
Source File: TableFunctionModule.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    Unnest.register(this);
    MapBinder<String,TableFunctionImplementation> functionBinder =
            MapBinder.newMapBinder(binder(), String.class, TableFunctionImplementation.class);

    for (Map.Entry<String, TableFunctionImplementation> entry : functions.entrySet()) {
        functionBinder.addBinding(entry.getKey()).toInstance(entry.getValue());
    }
    functions.clear();
    functions = null;
}
 
Example 13
Source File: MetaDataInformationModule.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
    schemaBinder = MapBinder.newMapBinder(binder(), String.class, SchemaInfo.class);
    schemaBinder.addBinding(InformationSchemaInfo.NAME).to(InformationSchemaInfo.class).asEagerSingleton();
}
 
Example 14
Source File: MetaDataModule.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
protected void bindReferences() {
    referenceBinder = MapBinder.newMapBinder(binder(), ReferenceIdent.class, ReferenceImplementation.class);
    bind(NestedReferenceResolver.class).to(GlobalReferenceResolver.class).asEagerSingleton();
}
 
Example 15
Source File: MetaDataInformationModule.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
    schemaBinder = MapBinder.newMapBinder(binder(), String.class, SchemaInfo.class);
    schemaBinder.addBinding(InformationSchemaInfo.NAME).to(InformationSchemaInfo.class).asEagerSingleton();
    bind(InformationSchemaTableDefinitions.class).asEagerSingleton();
}
 
Example 16
Source File: MetaDataShardModule.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
protected void bindShardReferences() {
    MapBinder.newMapBinder(binder(), ReferenceIdent.class, ShardReferenceImplementation.class);
    bind(ShardReferenceResolver.class).asEagerSingleton();
}
 
Example 17
Source File: MetaDataBlobModule.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
    schemaBinder = MapBinder.newMapBinder(binder(), String.class, SchemaInfo.class);
    schemaBinder.addBinding(BlobSchemaInfo.NAME).to(BlobSchemaInfo.class).asEagerSingleton();
}
 
Example 18
Source File: MetaDataModule.java    From crate with Apache License 2.0 4 votes vote down vote up
private void bindSchemas() {
    MapBinder.newMapBinder(binder(), String.class, SchemaInfo.class);
    bind(Schemas.class).asEagerSingleton();
}
 
Example 19
Source File: DumpModule.java    From elasticsearch-inout-plugin with Apache License 2.0 3 votes vote down vote up
@Override
protected void configure() {
    bind(TransportDumpAction.class).asEagerSingleton();

    bind(DumpParser.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(DumpAction.INSTANCE).to(TransportDumpAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(DumpAction.NAME).toInstance(DumpAction.INSTANCE);
}
 
Example 20
Source File: ExtendedAnalyzeModule.java    From elasticsearch-extended-analyze with Apache License 2.0 3 votes vote down vote up
@Override
protected void configure() {
    bind(TransportExtendedAnalyzeAction.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder =
        MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);

    transportActionsBinder.addBinding(ExtendedAnalyzeAction.INSTANCE).to(TransportExtendedAnalyzeAction.class).asEagerSingleton();

    MapBinder<String, GenericAction> actionsBinder = MapBinder.newMapBinder(binder(), String.class, GenericAction.class);
    actionsBinder.addBinding(ExtendedAnalyzeAction.NAME).toInstance(ExtendedAnalyzeAction.INSTANCE);

}