org.elasticsearch.common.settings.Setting Java Examples
The following examples show how to use
org.elasticsearch.common.settings.Setting.
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: AnomalyDetectorPlugin.java From anomaly-detection with Apache License 2.0 | 6 votes |
@Override public List<Setting<?>> getSettings() { List<Setting<?>> enabledSetting = EnabledSetting.getInstance().getSettings(); List<Setting<?>> systemSetting = ImmutableList .of( AnomalyDetectorSettings.MAX_ANOMALY_DETECTORS, AnomalyDetectorSettings.MAX_ANOMALY_FEATURES, AnomalyDetectorSettings.REQUEST_TIMEOUT, AnomalyDetectorSettings.DETECTION_INTERVAL, AnomalyDetectorSettings.DETECTION_WINDOW_DELAY, AnomalyDetectorSettings.AD_RESULT_HISTORY_ROLLOVER_PERIOD, AnomalyDetectorSettings.AD_RESULT_HISTORY_MAX_DOCS, AnomalyDetectorSettings.AD_RESULT_ROLLOVER_PERIOD, AnomalyDetectorSettings.MAX_RETRY_FOR_UNRESPONSIVE_NODE, AnomalyDetectorSettings.COOLDOWN_MINUTES, AnomalyDetectorSettings.BACKOFF_MINUTES, AnomalyDetectorSettings.BACKOFF_INITIAL_DELAY, AnomalyDetectorSettings.MAX_RETRY_FOR_BACKOFF, AnomalyDetectorSettings.AD_RESULT_HISTORY_RETENTION_PERIOD, AnomalyDetectorSettings.MODEL_MAX_SIZE_PERCENTAGE ); return unmodifiableList(Stream.concat(enabledSetting.stream(), systemSetting.stream()).collect(Collectors.toList())); }
Example #2
Source File: GenericPropertiesConverter.java From crate with Apache License 2.0 | 6 votes |
@Nullable private static SettingHolder getSupportedSetting(Map<String, Setting<?>> supportedSettings, String settingName) { Setting<?> setting = supportedSettings.get(settingName); if (setting == null) { String groupKey = getPossibleGroup(settingName); if (groupKey != null) { setting = supportedSettings.get(groupKey); if (setting instanceof Setting.AffixSetting) { setting = ((Setting.AffixSetting) setting).getConcreteSetting(INDEX_SETTING_PREFIX + settingName); return new SettingHolder(setting, true); } } } if (setting != null) { return new SettingHolder(setting); } return null; }
Example #3
Source File: GenericPropertiesConverter.java From crate with Apache License 2.0 | 6 votes |
static void settingsFromProperties(Settings.Builder builder, GenericProperties<Object> properties, Map<String, Setting<?>> supportedSettings, boolean setDefaults, Predicate<String> ignoreProperty, String invalidMessage) { if (setDefaults) { setDefaults(builder, supportedSettings); } for (Map.Entry<String, Object> entry : properties.properties().entrySet()) { String settingName = entry.getKey(); if (ignoreProperty.test(settingName)) { continue; } String groupName = getPossibleGroup(settingName); if (groupName != null && ignoreProperty.test(groupName)) { continue; } SettingHolder settingHolder = getSupportedSetting(supportedSettings, settingName); if (settingHolder == null) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, invalidMessage, entry.getKey())); } settingHolder.apply(builder, entry.getValue()); } }
Example #4
Source File: TcpTransport.java From crate with Apache License 2.0 | 6 votes |
public ProfileSettings(Settings settings, String profileName) { this.profileName = profileName; isDefaultProfile = TransportSettings.DEFAULT_PROFILE.equals(profileName); tcpKeepAlive = TransportSettings.TCP_KEEP_ALIVE_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); tcpNoDelay = TransportSettings.TCP_NO_DELAY_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); reuseAddress = TransportSettings.TCP_REUSE_ADDRESS_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); sendBufferSize = TransportSettings.TCP_SEND_BUFFER_SIZE_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); receiveBufferSize = TransportSettings.TCP_RECEIVE_BUFFER_SIZE_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); List<String> profileBindHosts = TransportSettings.BIND_HOST_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); bindHosts = (profileBindHosts.isEmpty() ? NetworkService.GLOBAL_NETWORK_BIND_HOST_SETTING.get(settings) : profileBindHosts); publishHosts = TransportSettings.PUBLISH_HOST_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); Setting<String> concretePort = TransportSettings.PORT_PROFILE.getConcreteSettingForNamespace(profileName); if (concretePort.exists(settings) == false && isDefaultProfile == false) { throw new IllegalStateException("profile [" + profileName + "] has no port configured"); } portOrRange = TransportSettings.PORT_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); publishPort = isDefaultProfile ? TransportSettings.PUBLISH_PORT.get(settings) : TransportSettings.PUBLISH_PORT_PROFILE.getConcreteSettingForNamespace(profileName).get(settings); }
Example #5
Source File: BundlePlugin.java From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<Setting<?>> getSettings() { return Arrays.asList( new Setting<>("plugins.xbib.icu.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.autophrase.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.baseform.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.concat.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.pair.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.decompound.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.german_normalize.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.hyphen.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.sortform.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.standardnumber.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.fst_decompound.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.worddelimiter.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.worddelimiter2.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.symbolname.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.year.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.lemmatize.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.naturalsort.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.reference.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.langdetect.enabled", "true", Function.identity(), Setting.Property.NodeScope), new Setting<>("plugins.xbib.isbnformat.enabled", "true", Function.identity(), Setting.Property.NodeScope) ); }
Example #6
Source File: TablePropertiesAnalyzer.java From crate with Apache License 2.0 | 6 votes |
/** * Processes the property names which should be reset and updates the settings or mappings with the related * default value. */ public static void analyzeResetProperties(TableParameter tableParameter, TableParameters tableParameters, List<String> properties) { Map<String, Setting<?>> settingMap = tableParameters.supportedSettings(); Map<String, Setting<?>> mappingsMap = tableParameters.supportedMappings(); GenericPropertiesConverter.resetSettingsFromProperties( tableParameter.settingsBuilder(), properties, settingMap, mappingsMap::containsKey, INVALID_MESSAGE); GenericPropertiesConverter.resetSettingsFromProperties( tableParameter.mappingsBuilder(), properties, mappingsMap, settingMap::containsKey, INVALID_MESSAGE); }
Example #7
Source File: Ec2DiscoveryPlugin.java From crate with Apache License 2.0 | 6 votes |
@Override public List<Setting<?>> getSettings() { return Arrays.asList( // Register EC2 discovery settings: discovery.ec2 Ec2ClientSettings.ACCESS_KEY_SETTING, Ec2ClientSettings.SECRET_KEY_SETTING, Ec2ClientSettings.SESSION_TOKEN_SETTING, Ec2ClientSettings.ENDPOINT_SETTING, Ec2ClientSettings.PROTOCOL_SETTING, Ec2ClientSettings.PROXY_HOST_SETTING, Ec2ClientSettings.PROXY_PORT_SETTING, Ec2ClientSettings.PROXY_USERNAME_SETTING, Ec2ClientSettings.PROXY_PASSWORD_SETTING, Ec2ClientSettings.READ_TIMEOUT_SETTING, AwsEc2Service.HOST_TYPE_SETTING, AwsEc2Service.ANY_GROUP_SETTING, AwsEc2Service.GROUPS_SETTING, AwsEc2Service.AVAILABILITY_ZONES_SETTING, AwsEc2Service.NODE_CACHE_TIME_SETTING, AwsEc2Service.TAG_SETTING, // Register cloud node settings: cloud.node AwsEc2Service.AUTO_ATTRIBUTE_SETTING); }
Example #8
Source File: IndexMetaData.java From crate with Apache License 2.0 | 5 votes |
static Setting<Integer> buildNumberOfShardsSetting() { /* This is a safety limit that should only be exceeded in very rare and special cases. The assumption is that * 99% of the users have less than 1024 shards per index. We also make it a hard check that requires restart of nodes * if a cluster should allow to create more than 1024 shards per index. NOTE: this does not limit the number of shards per cluster. * this also prevents creating stuff like a new index with millions of shards by accident which essentially kills the entire cluster * with OOM on the spot.*/ final int maxNumShards = Integer.parseInt(System.getProperty("es.index.max_number_of_shards", "1024")); if (maxNumShards < 1) { throw new IllegalArgumentException("es.index.max_number_of_shards must be > 0"); } return Setting.intSetting(SETTING_NUMBER_OF_SHARDS, Math.min(5, maxNumShards), 1, maxNumShards, Property.IndexScope, Property.Final); }
Example #9
Source File: FixedExecutorBuilder.java From crate with Apache License 2.0 | 5 votes |
/** * Construct a fixed executor builder. * * @param settings the node-level settings * @param name the name of the executor * @param size the fixed number of threads * @param queueSize the size of the backing queue, -1 for unbounded * @param prefix the prefix for the settings keys */ public FixedExecutorBuilder(final Settings settings, final String name, final int size, final int queueSize, final String prefix) { super(name); final String sizeKey = settingsKey(prefix, "size"); this.sizeSetting = new Setting<>( sizeKey, s -> Integer.toString(size), s -> Setting.parseInt(s, 1, applyHardSizeLimit(settings, name), sizeKey), Setting.Property.NodeScope ); final String queueSizeKey = settingsKey(prefix, "queue_size"); this.queueSizeSetting = Setting.intSetting(queueSizeKey, queueSize, Setting.Property.NodeScope); }
Example #10
Source File: MetaDataUpdateSettingsService.java From crate with Apache License 2.0 | 5 votes |
/** * Updates the cluster block only iff the setting exists in the given settings */ public static void maybeUpdateClusterBlock(String[] actualIndices, ClusterBlocks.Builder blocks, ClusterBlock block, Setting<Boolean> setting, Settings openSettings) { if (setting.exists(openSettings)) { final boolean updateBlock = setting.get(openSettings); for (String index : actualIndices) { if (updateBlock) { blocks.addIndexBlock(index, block); } else { blocks.removeIndexBlock(index, block); } } } }
Example #11
Source File: DiskThresholdSettings.java From crate with Apache License 2.0 | 5 votes |
@Override public Iterator<Setting<String>> settings() { return Arrays.asList( CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING) .iterator(); }
Example #12
Source File: AzureDiscoveryPlugin.java From crate with Apache License 2.0 | 5 votes |
@Override public List<Setting<?>> getSettings() { return Arrays.asList( SUBSCRIPTION_ID, RESOURCE_GROUP_NAME, TENANT_ID, APP_ID, APP_SECRET, REFRESH, HOST_TYPE, DISCOVERY_METHOD ); }
Example #13
Source File: GenericPropertiesConverter.java From crate with Apache License 2.0 | 5 votes |
public static Settings genericPropertiesToSettings(GenericProperties<Object> genericProperties, Map<String, Setting<?>> supportedSettings) { Settings.Builder builder = Settings.builder(); genericPropertiesToSettings( builder, genericProperties, (settingKey) -> { if (!supportedSettings.containsKey(settingKey)) { throw new IllegalArgumentException( String.format(Locale.ENGLISH, INVALID_SETTING_MESSAGE, settingKey)); } }); return builder.build(); }
Example #14
Source File: Netty4Plugin.java From crate with Apache License 2.0 | 5 votes |
@Override public List<Setting<?>> getSettings() { return Arrays.asList( Netty4HttpServerTransport.SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS, Netty4HttpServerTransport.SETTING_HTTP_WORKER_COUNT, Netty4HttpServerTransport.SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE, Netty4Transport.WORKER_COUNT, Netty4Transport.NETTY_RECEIVE_PREDICTOR_SIZE, Netty4Transport.NETTY_RECEIVE_PREDICTOR_MIN, Netty4Transport.NETTY_RECEIVE_PREDICTOR_MAX, Netty4Transport.NETTY_BOSS_COUNT ); }
Example #15
Source File: BlobPlugin.java From crate with Apache License 2.0 | 5 votes |
@Override public List<Setting<?>> getSettings() { return Arrays.asList( BlobIndicesService.SETTING_BLOBS_PATH, BlobIndicesService.SETTING_INDEX_BLOBS_ENABLED, BlobIndicesService.SETTING_INDEX_BLOBS_PATH ); }
Example #16
Source File: GenericPropertiesConverter.java From crate with Apache License 2.0 | 5 votes |
private static void setDefaults(Settings.Builder builder, Map<String, Setting<?>> supportedSettings) { for (Map.Entry<String, Setting<?>> entry : supportedSettings.entrySet()) { SettingHolder settingHolder = new SettingHolder(entry.getValue()); // We'd set the "wrong" default for settings that base their default on other settings if (TableParameters.SETTINGS_NOT_INCLUDED_IN_DEFAULT.contains(settingHolder.setting)) { continue; } settingHolder.applyDefault(builder); } }
Example #17
Source File: OpenShiftElasticSearchPlugin.java From openshift-elasticsearch-plugin with Apache License 2.0 | 5 votes |
@Override public List<Setting<?>> getSettings() { List<Setting<?>> settings = sgPlugin.getSettings(); settings.add(Setting.intSetting(OPENSHIFT_CONTEXT_CACHE_MAXSIZE, DEFAULT_OPENSHIFT_CONTEXT_CACHE_MAXSIZE, Property.NodeScope)); settings.add(Setting.longSetting(OPENSHIFT_CONTEXT_CACHE_EXPIRE_SECONDS, DEFAULT_OPENSHIFT_CONTEXT_CACHE_EXPIRE_SECONDS, 0, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_ES_KIBANA_SEED_MAPPINGS_APP, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_ES_KIBANA_SEED_MAPPINGS_OPERATIONS, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_ES_KIBANA_SEED_MAPPINGS_EMPTY, Property.NodeScope)); settings.add(Setting.boolSetting(OPENSHIFT_CONFIG_COMMON_DATA_MODEL, true, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_CONFIG_PROJECT_INDEX_PREFIX, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_CONFIG_TIME_FIELD_NAME, Property.NodeScope)); settings.add(Setting.simpleString(SG_CLIENT_KS_PATH, Property.NodeScope)); settings.add(Setting.simpleString(SG_CLIENT_TS_PATH, Property.NodeScope)); settings.add(Setting.boolSetting(OPENSHIFT_CONFIG_OPS_ALLOW_CLUSTER_READER, false, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_KIBANA_INDEX_MODE, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_ACL_ROLE_STRATEGY, Property.NodeScope)); settings.add(Setting.listSetting(OPENSHIFT_KIBANA_OPS_INDEX_PATTERNS, Arrays.asList(DEFAULT_KIBANA_OPS_INDEX_PATTERNS), Function.identity(), Property.NodeScope, Property.Dynamic)); settings.add(Setting.simpleString(OPENSHIFT_ACL_EXPIRE_IN_MILLIS, Property.NodeScope)); settings.add(Setting.simpleString(KIBANA_CONFIG_INDEX_NAME, Property.NodeScope)); settings.add(Setting.simpleString(KIBANA_CONFIG_VERSION, Property.NodeScope)); settings.add(Setting.simpleString(KIBANA_VERSION_HEADER, Property.NodeScope)); settings.add(Setting.simpleString(OPENSHIFT_ES_USER_PROFILE_PREFIX, Property.NodeScope)); settings.add(Setting.listSetting(OPENSHIFT_CONFIG_OPS_PROJECTS,Arrays.asList(DEFAULT_OPENSHIFT_OPS_PROJECTS), Function.identity(), Property.NodeScope, Property.Dynamic)); return settings; }
Example #18
Source File: CrateDummyClusterServiceUnitTest.java From crate with Apache License 2.0 | 5 votes |
protected ClusterService createClusterService(Collection<Setting<?>> additionalClusterSettings, Version version) { Set<Setting<?>> clusterSettingsSet = Sets.newHashSet(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); clusterSettingsSet.addAll(additionalClusterSettings); ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, clusterSettingsSet); ClusterService clusterService = new ClusterService( Settings.builder() .put("cluster.name", "ClusterServiceTests") .put(Node.NODE_NAME_SETTING.getKey(), NODE_NAME) .build(), clusterSettings, THREAD_POOL ); clusterService.setNodeConnectionsService(createNoOpNodeConnectionsService()); DiscoveryNode discoveryNode = new DiscoveryNode( NODE_NAME, NODE_ID, buildNewFakeTransportAddress(), Collections.emptyMap(), new HashSet<>(Arrays.asList(DiscoveryNode.Role.values())), version ); DiscoveryNodes nodes = DiscoveryNodes.builder() .add(discoveryNode) .localNodeId(NODE_ID) .masterNodeId(NODE_ID) .build(); ClusterState clusterState = ClusterState.builder(new ClusterName(this.getClass().getSimpleName())) .nodes(nodes).blocks(ClusterBlocks.EMPTY_CLUSTER_BLOCK).build(); ClusterApplierService clusterApplierService = clusterService.getClusterApplierService(); clusterApplierService.setInitialState(clusterState); MasterService masterService = clusterService.getMasterService(); masterService.setClusterStatePublisher(createClusterStatePublisher(clusterApplierService)); masterService.setClusterStateSupplier(clusterApplierService::state); clusterService.start(); return clusterService; }
Example #19
Source File: TableParameters.java From crate with Apache License 2.0 | 5 votes |
public static Map<String, Object> tableParametersFromIndexMetaData(Settings settings) { ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder(); for (Setting<?> setting : SUPPORTED_SETTINGS) { boolean shouldBeExcluded = EXCLUDED_SETTING_FOR_METADATA_IMPORT.contains(setting); if (shouldBeExcluded == false) { if (setting instanceof Setting.AffixSetting) { flattenAffixSetting(builder, settings, (Setting.AffixSetting<?>) setting); } else if (settings.hasValue(setting.getKey())) { builder.put(setting.getKey(), convertEsSettingType(setting.get(settings))); } } } return builder.build(); }
Example #20
Source File: TableParameters.java From crate with Apache License 2.0 | 5 votes |
private static void flattenAffixSetting(ImmutableMap.Builder<String, Object> builder, Settings settings, Setting.AffixSetting<?> setting) { String prefix = setting.getKey(); setting.getNamespaces(settings) .forEach(s -> builder.put(prefix + s, setting.getConcreteSetting(prefix + s).get(settings))); }
Example #21
Source File: TypeSettings.java From crate with Apache License 2.0 | 5 votes |
public TypeSettings(Map<String, Setting<?>> required, Map<String, Setting<?>> optional) { this.required = required; all = new HashMap<>(required.size() + optional.size() + GENERIC.size()); all.putAll(required); all.putAll(optional); all.putAll(GENERIC); }
Example #22
Source File: RepositoryParamValidator.java From crate with Apache License 2.0 | 5 votes |
public void validate(String type, GenericProperties<?> genericProperties, Settings settings) { TypeSettings typeSettings = settingsForType(type); Map<String, Setting<?>> allSettings = typeSettings.all(); // create string settings for all dynamic settings GenericProperties<?> dynamicProperties = typeSettings.dynamicProperties(genericProperties); if (!dynamicProperties.isEmpty()) { // allSettings are immutable by default, copy map allSettings = new HashMap<>(allSettings); for (String key : dynamicProperties.properties().keySet()) { allSettings.put(key, Setting.simpleString(key)); } } // validate all settings Set<String> names = settings.keySet(); Sets.SetView<String> missingRequiredSettings = Sets.difference(typeSettings.required().keySet(), names); if (!missingRequiredSettings.isEmpty()) { throw new IllegalArgumentException( String.format( Locale.ENGLISH, "The following required parameters are missing to create a repository of type \"%s\": [%s]", type, String.join(", ", missingRequiredSettings)) ); } }
Example #23
Source File: IndexSettingsModule.java From crate with Apache License 2.0 | 5 votes |
public static IndexSettings newIndexSettings(Index index, Settings indexSetting, Settings nodeSettings, Setting<?>... setting) { Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(indexSetting) .build(); IndexMetaData metaData = IndexMetaData.builder(index.getName()).settings(build).build(); Set<Setting<?>> settingSet = new HashSet<>(IndexScopedSettings.BUILT_IN_INDEX_SETTINGS); if (setting.length > 0) { settingSet.addAll(Arrays.asList(setting)); } return new IndexSettings(metaData, nodeSettings, new IndexScopedSettings(Settings.EMPTY, settingSet)); }
Example #24
Source File: InformationTablesTableInfo.java From crate with Apache License 2.0 | 5 votes |
private static Function<RelationInfo, Long> fromByteSize(Setting<ByteSizeValue> byteSizeSetting) { return rel -> { if (rel instanceof StoredTable) { return byteSizeSetting.get(rel.parameters()).getBytes(); } return null; }; }
Example #25
Source File: InformationTablesTableInfo.java From crate with Apache License 2.0 | 5 votes |
private static <T> Function<RelationInfo, T> fromSetting(Setting<T> setting) { return rel -> { if (rel instanceof StoredTable) { return setting.get(rel.parameters()); } return null; }; }
Example #26
Source File: InformationTablesTableInfo.java From crate with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private static <T> Function<RelationInfo, Map<String, Object>> fromSetting(Setting.AffixSetting<T> setting) { return rel -> { if (rel instanceof StoredTable) { return (Map<String, Object>) setting.getAsMap(rel.parameters()); } return null; }; }
Example #27
Source File: InformationTablesTableInfo.java From crate with Apache License 2.0 | 5 votes |
private static <T, U> Function<RelationInfo, U> fromSetting(Setting<T> setting, Function<T, U> andThen) { return rel -> { if (rel instanceof StoredTable) { return andThen.apply(setting.get(rel.parameters())); } return null; }; }
Example #28
Source File: SrvPlugin.java From crate with Apache License 2.0 | 5 votes |
@Override public List<Setting<?>> getSettings() { return Arrays.asList( SrvUnicastHostsProvider.DISCOVERY_SRV_QUERY, SrvUnicastHostsProvider.DISCOVERY_SRV_RESOLVER ); }
Example #29
Source File: CrateSettings.java From crate with Apache License 2.0 | 5 votes |
public static void checkIfRuntimeSetting(String name) { for (CrateSetting<?> crateSetting : BUILT_IN_SETTINGS) { Setting<?> setting = crateSetting.setting(); if (setting.getKey().equals(name) && setting.isDynamic() == false) { throw new UnsupportedOperationException(String.format(Locale.ENGLISH, "Setting '%s' cannot be set/reset at runtime", name)); } } }
Example #30
Source File: CrateCircuitBreakerServiceTest.java From crate with Apache License 2.0 | 5 votes |
@Before public void registerSettings() { SQLPlugin sqlPlugin = new SQLPlugin(Settings.EMPTY); Set<Setting<?>> settings = new HashSet<>(); settings.addAll(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); settings.addAll(sqlPlugin.getSettings()); clusterSettings = new ClusterSettings(Settings.EMPTY, settings); }