commit 063a76c3dbaa4b89d9a0a7492578ec0620b5bdbf Author: Jason Tedor Date: Fri Oct 6 14:46:39 2017 -0400 Introduce CCR container class This commit introduces the container class for CCR functionality. Future work will expose more specific CCR functionality to the X-Pack plugin through this class. Relates #2704 diff --git a/x-pack/plugin/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java b/x-pack/plugin/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java new file mode 100644 index 00000000000..b3409d496b3 --- /dev/null +++ b/x-pack/plugin/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.xpack.ccr; + +import org.elasticsearch.common.settings.Setting; +import org.elasticsearch.common.settings.Settings; + +import java.util.List; + +import static org.elasticsearch.xpack.ccr.CcrSettings.CCR_ENABLED_SETTING; + +/** + * Container class for CCR functionality. + */ +public final class Ccr { + + @SuppressWarnings("unused,FieldCanBeLocal") + private final boolean enabled; + + /** + * Construct an instance of the CCR container with the specified settings. + * + * @param settings the settings + */ + public Ccr(final Settings settings) { + this.enabled = CCR_ENABLED_SETTING.get(settings); + } + + /** + * The settings defined by CCR. + * + * @return the settings + */ + public List> getSettings() { + return CcrSettings.getSettings(); + } + +} diff --git a/x-pack/plugin/src/main/java/org/elasticsearch/xpack/ccr/CcrSettings.java b/x-pack/plugin/src/main/java/org/elasticsearch/xpack/ccr/CcrSettings.java new file mode 100644 index 00000000000..ea08f793647 --- /dev/null +++ b/x-pack/plugin/src/main/java/org/elasticsearch/xpack/ccr/CcrSettings.java @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.xpack.ccr; + +import org.elasticsearch.common.settings.Setting; +import org.elasticsearch.common.settings.Setting.Property; + +import java.util.Collections; +import java.util.List; + +/** + * Container class for CCR settings. + */ +final class CcrSettings { + + // prevent construction + private CcrSettings() { + + } + + /** + * Setting for controlling whether or not CCR is enabled. + */ + static final Setting CCR_ENABLED_SETTING = Setting.boolSetting("xpack.ccr.enabled", true, Property.NodeScope); + + static List> getSettings() { + return Collections.singletonList(CCR_ENABLED_SETTING); + } + +}