当前位置: 首页>>代码示例>>Java>>正文


Java MapBinder类代码示例

本文整理汇总了Java中org.elasticsearch.common.inject.multibindings.MapBinder的典型用法代码示例。如果您正苦于以下问题:Java MapBinder类的具体用法?Java MapBinder怎么用?Java MapBinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapBinder类属于org.elasticsearch.common.inject.multibindings包,在下文中一共展示了MapBinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:20,代码来源:BlobShardExpressionModule.java

示例2: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:SysShardExpressionModule.java

示例3: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@Override
protected void configure() {
    MapBinder<String, NativeScriptFactory> scriptsBinder
            = MapBinder.newMapBinder(binder(), String.class, NativeScriptFactory.class);
    for (Map.Entry<String, Class<? extends NativeScriptFactory>> entry : scripts.entrySet()) {
        scriptsBinder.addBinding(entry.getKey()).to(entry.getValue()).asEagerSingleton();
    }

    Multibinder<ScriptEngineService> multibinder = Multibinder.newSetBinder(binder(), ScriptEngineService.class);
    multibinder.addBinding().to(NativeScriptEngineService.class);
    
    try {
        Class.forName("com.github.mustachejava.Mustache");
        multibinder.addBinding().to(MustacheScriptEngineService.class).asEagerSingleton();
    } catch (Throwable t) {
        Loggers.getLogger(ScriptService.class, settings).debug("failed to load mustache", t);
    }

    for (Class<? extends ScriptEngineService> scriptEngine : scriptEngines) {
        multibinder.addBinding().to(scriptEngine).asEagerSingleton();
    }

    bind(ScriptContextRegistry.class).toInstance(new ScriptContextRegistry(customScriptContexts));
    bind(ScriptService.class).asEagerSingleton();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:26,代码来源:ScriptModule.java

示例4: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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);

}
 
开发者ID:crate,项目名称:elasticsearch-inout-plugin,代码行数:20,代码来源:ReindexModule.java

示例5: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@Override
protected void configure() {
    bind(RepositoriesService.class).asEagerSingleton();
    bind(SnapshotsService.class).asEagerSingleton();
    bind(SnapshotShardsService.class).asEagerSingleton();
    bind(TransportNodesSnapshotsStatus.class).asEagerSingleton();
    bind(RestoreService.class).asEagerSingleton();
    MapBinder<String, Repository.Factory> typesBinder = MapBinder.newMapBinder(binder(), String.class, Repository.Factory.class);
    repositoryTypes.forEach((k, v) -> typesBinder.addBinding(k).toInstance(v));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:RepositoriesModule.java

示例6: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@Override
protected void configure() {
    Multibinder<ActionFilter> actionFilterMultibinder = Multibinder.newSetBinder(binder(), ActionFilter.class);
    for (Class<? extends ActionFilter> actionFilter : actionFilters) {
        actionFilterMultibinder.addBinding().to(actionFilter);
    }
    bind(ActionFilters.class).asEagerSingleton();
    bind(DestructiveOperations.class).toInstance(destructiveOperations);

    if (false == transportClient) {
        // Supporting classes only used when not a transport client
        bind(AutoCreateIndex.class).toInstance(autoCreateIndex);
        bind(TransportLivenessAction.class).asEagerSingleton();

        // register GenericAction -> transportAction Map used by NodeClient
        @SuppressWarnings("rawtypes")
        MapBinder<GenericAction, TransportAction> transportActionsBinder
                = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);
        for (ActionHandler<?, ?> action : actions.values()) {
            // bind the action as eager singleton, so the map binder one will reuse it
            bind(action.getTransportAction()).asEagerSingleton();
            transportActionsBinder.addBinding(action.getAction()).to(action.getTransportAction()).asEagerSingleton();
            for (Class<?> supportAction : action.getSupportTransportActions()) {
                bind(supportAction).asEagerSingleton();
            }
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:ActionModule.java

示例7: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:FileCollectModule.java

示例8: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:PredicateModule.java

示例9: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:TableFunctionModule.java

示例10: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:SysClusterExpressionModule.java

示例11: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:RepositorySettingsModule.java

示例12: bindExtensions

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@Override
protected final void bindExtensions(Binder binder) {
    MapBinder<String, T> parserMapBinder = MapBinder.newMapBinder(binder, String.class, extensionClass);
    for (Map.Entry<String, Class<? extends T>> clazz : extensions.entrySet()) {
        parserMapBinder.addBinding(clazz.getKey()).to(clazz.getValue());
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:ExtensionPoint.java

示例13: createGuiceModules

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@Override
public Collection<Module> createGuiceModules() {
    LOGGER.info("Registering new scalar function using MapBinder");
    return Collections.singletonList(new AbstractModule() {
        @Override
        protected void configure() {
            MapBinder<FunctionIdent, FunctionImplementation> functionBinder =
                    MapBinder.newMapBinder(binder(), FunctionIdent.class, FunctionImplementation.class);
            functionBinder.addBinding(new FunctionIdent(
                                              IsEvenScalarFunction.NAME,
                                              Collections.singletonList(DataTypes.LONG))
                                     ).toInstance(new IsEvenScalarFunction());
        }
    });
}
 
开发者ID:crate,项目名称:crate-example-plugin,代码行数:16,代码来源:ExamplePlugin.java

示例14: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@Override
protected void configure() {
    bind(TransportImportAction.class).asEagerSingleton();

    bind(ImportParser.class).asEagerSingleton();
    bind(Importer.class).asEagerSingleton();

    MapBinder<GenericAction, TransportAction> transportActionsBinder = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);
    transportActionsBinder.addBinding(ImportAction.INSTANCE).to(TransportImportAction.class).asEagerSingleton();

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

}
 
开发者ID:crate,项目名称:elasticsearch-inout-plugin,代码行数:15,代码来源:ImportModule.java

示例15: configure

import org.elasticsearch.common.inject.multibindings.MapBinder; //导入依赖的package包/类
@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));


}
 
开发者ID:crate,项目名称:elasticsearch-inout-plugin,代码行数:31,代码来源:SearchIntoModule.java


注:本文中的org.elasticsearch.common.inject.multibindings.MapBinder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。