Example usage for org.apache.lucene.codecs Codec availableCodecs

List of usage examples for org.apache.lucene.codecs Codec availableCodecs

Introduction

In this page you can find the example usage for org.apache.lucene.codecs Codec availableCodecs.

Prototype

public static Set<String> availableCodecs() 

Source Link

Document

returns a list of all available codec names

Usage

From source file:org.elasticsearch.index.codec.CodecService.java

License:Apache License

@Inject
public CodecService(Index index, @IndexSettings Settings indexSettings,
        PostingsFormatService postingsFormatService, DocValuesFormatService docValuesFormatService,
        MapperService mapperService) {/*  w  w  w.j a v  a 2  s. c om*/
    super(index, indexSettings);
    this.postingsFormatService = postingsFormatService;
    this.docValuesFormatService = docValuesFormatService;
    this.mapperService = mapperService;
    MapBuilder<String, Codec> codecs = MapBuilder.<String, Codec>newMapBuilder();
    if (mapperService == null) {
        codecs.put(DEFAULT_CODEC, Codec.getDefault());
    } else {
        codecs.put(DEFAULT_CODEC,
                new PerFieldMappingPostingFormatCodec(mapperService,
                        postingsFormatService.get(PostingsFormatService.DEFAULT_FORMAT).get(),
                        docValuesFormatService.get(DocValuesFormatService.DEFAULT_FORMAT).get(), logger));
    }
    for (String codec : Codec.availableCodecs()) {
        codecs.put(codec, Codec.forName(codec));
    }
    this.codecs = codecs.immutableMap();
    this.loadBloomFilter = indexSettings.getAsBoolean(INDEX_CODEC_BLOOM_LOAD, INDEX_CODEC_BLOOM_LOAD_DEFAULT);
}

From source file:org.elasticsearch.node.internal.InternalNode.java

License:Apache License

public InternalNode(Settings preparedSettings, boolean loadConfigSettings) throws ElasticsearchException {
    final Settings pSettings = settingsBuilder().put(preparedSettings)
            .put(Client.CLIENT_TYPE_SETTING, CLIENT_TYPE).build();
    Tuple<Settings, Environment> tuple = InternalSettingsPreparer.prepareSettings(pSettings,
            loadConfigSettings);/*from  w w w .  ja v  a 2s .c  o  m*/
    tuple = new Tuple<>(TribeService.processSettings(tuple.v1()), tuple.v2());

    // The only place we can actually fake the version a node is running on:
    Version version = pSettings.getAsVersion("tests.mock.version", Version.CURRENT);

    ESLogger logger = Loggers.getLogger(Node.class, tuple.v1().get("name"));
    logger.info("version[{}], pid[{}], build[{}/{}]", version, JvmInfo.jvmInfo().pid(),
            Build.CURRENT.hashShort(), Build.CURRENT.timestamp());

    logger.info("initializing ...");

    if (logger.isDebugEnabled()) {
        Environment env = tuple.v2();
        logger.debug("using home [{}], config [{}], data [{}], logs [{}], work [{}], plugins [{}]",
                env.homeFile(), env.configFile(), Arrays.toString(env.dataFiles()), env.logsFile(),
                env.workFile(), env.pluginsFile());
    }

    // workaround for LUCENE-6482
    Codec.availableCodecs();

    this.pluginsService = new PluginsService(tuple.v1(), tuple.v2());
    this.settings = pluginsService.updatedSettings();
    // create the environment based on the finalized (processed) view of the settings
    this.environment = new Environment(this.settings());

    CompressorFactory.configure(settings);
    final NodeEnvironment nodeEnvironment;
    try {
        nodeEnvironment = new NodeEnvironment(this.settings, this.environment);
    } catch (IOException ex) {
        throw new ElasticsearchIllegalStateException("Failed to created node environment", ex);
    }

    final ThreadPool threadPool = new ThreadPool(settings);

    boolean success = false;
    try {
        ModulesBuilder modules = new ModulesBuilder();
        modules.add(new Version.Module(version));
        modules.add(new CacheRecyclerModule(settings));
        modules.add(new PageCacheRecyclerModule(settings));
        modules.add(new CircuitBreakerModule(settings));
        modules.add(new BigArraysModule(settings));
        modules.add(new PluginsModule(settings, pluginsService));
        modules.add(new SettingsModule(settings));
        modules.add(new NodeModule(this));
        modules.add(new NetworkModule());
        modules.add(new ScriptModule(settings));
        modules.add(new EnvironmentModule(environment));
        modules.add(new NodeEnvironmentModule(nodeEnvironment));
        modules.add(new ClusterNameModule(settings));
        modules.add(new ThreadPoolModule(threadPool));
        modules.add(new DiscoveryModule(settings));
        modules.add(new ClusterModule(settings));
        modules.add(new RestModule(settings));
        modules.add(new TransportModule(settings));
        if (settings.getAsBoolean(HTTP_ENABLED, true)) {
            modules.add(new HttpServerModule(settings));
        }
        modules.add(new RiversModule(settings));
        modules.add(new IndicesModule(settings));
        modules.add(new SearchModule());
        modules.add(new ActionModule(false));
        modules.add(new MonitorModule(settings));
        modules.add(new GatewayModule(settings));
        modules.add(new NodeClientModule());
        modules.add(new BulkUdpModule());
        modules.add(new ShapeModule());
        modules.add(new PercolatorModule());
        modules.add(new ResourceWatcherModule());
        modules.add(new RepositoriesModule());
        modules.add(new TribeModule());

        injector = modules.createInjector();

        client = injector.getInstance(Client.class);
        threadPool.setNodeSettingsService(injector.getInstance(NodeSettingsService.class));
        success = true;
    } finally {
        if (!success) {
            nodeEnvironment.close();
            ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS);
        }
    }

    logger.info("initialized");
}