public class SystemOptionManager extends BaseOptionManager implements AutoCloseable
OptionManager that holds options within
DrillbitContext. Only one instance of
this class exists per drillbit. Options set at the system level affect the
entire system and persist between restarts.
All the system options are externalized into conf file. While adding a new system option a validator should be added and the default value for the option should be set in the conf files(example : drill-module.conf) under the namespace drill.exec.options.
The SystemOptionManager loads all the validators and the default values for the options are fetched from the config. The validators are populated with the default values fetched from the config. If the option is not set in the conf files config option is missing exception will be thrown.
If the option is set using ALTER, the value that is set will be returned. Else the default value that is loaded into validator from the config will be returned.
| Constructor and Description |
|---|
SystemOptionManager(DrillConfig bootConfig)
Test-only, in-memory version of the system option manager.
|
SystemOptionManager(LogicalPlanPersistence lpPersistence,
PersistentStoreProvider provider,
DrillConfig bootConfig) |
SystemOptionManager(LogicalPlanPersistence lpPersistence,
PersistentStoreProvider provider,
DrillConfig bootConfig,
CaseInsensitiveMap<OptionDefinition> definitions) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static CaseInsensitiveMap<OptionDefinition> |
createDefaultOptionDefinitions()
Creates the
OptionDefinitions to be registered with the SystemOptionManager. |
void |
deleteAllLocalOptions()
Deletes all options.
|
void |
deleteLocalOption(String name)
Deletes the option.
|
OptionValue |
getDefault(String optionName)
Gets the default value for the specified option.
|
OptionValue |
getOption(String name)
Gets the option value for the given option name.
|
OptionDefinition |
getOptionDefinition(String name)
Gets the
OptionDefinition associated with the name. |
OptionList |
getOptionList()
Gets the list of options managed this manager.
|
protected OptionValue.OptionScope |
getScope() |
SystemOptionManager |
init()
Initializes this option manager.
|
Iterator<OptionValue> |
iterator() |
protected void |
setLocalOptionHelper(OptionValue value) |
getBoolean, getDouble, getInt, getInternalOptionList, getLong, getOption, getOption, getOption, getOption, getPublicOptionList, getString, setLocalOption, setLocalOption, setLocalOption, setLocalOption, setLocalOption, setLocalOptionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic SystemOptionManager(LogicalPlanPersistence lpPersistence, PersistentStoreProvider provider, DrillConfig bootConfig)
public SystemOptionManager(LogicalPlanPersistence lpPersistence, PersistentStoreProvider provider, DrillConfig bootConfig, CaseInsensitiveMap<OptionDefinition> definitions)
public SystemOptionManager(DrillConfig bootConfig)
bootConfig - Drill configpublic static CaseInsensitiveMap<OptionDefinition> createDefaultOptionDefinitions()
OptionDefinitions to be registered with the SystemOptionManager.public SystemOptionManager init() throws Exception
Exception - if unable to initialize option managerpublic Iterator<OptionValue> iterator()
iterator in interface Iterable<OptionValue>public OptionValue getOption(String name)
OptionSetOptionSet.getOption(TypeValidators.BooleanValidator validator),
OptionSet.getOption(TypeValidators.DoubleValidator validator),
OptionSet.getOption(TypeValidators.LongValidator validator), and
OptionSet.getOption(TypeValidators.StringValidator validator).public OptionValue getDefault(String optionName)
OptionSetgetDefault in interface OptionSetoptionName - The option to retrieve the default value for.protected void setLocalOptionHelper(OptionValue value)
setLocalOptionHelper in class BaseOptionManagerprotected OptionValue.OptionScope getScope()
getScope in class BaseOptionManagerpublic void deleteLocalOption(String name)
OptionManagercreateDefaultOptionDefinitions()),
but the option was not set within this manager, calling this method should be a no-op.deleteLocalOption in interface OptionManagername - option namepublic void deleteAllLocalOptions()
OptionManagerdeleteAllLocalOptions in interface OptionManagerpublic OptionDefinition getOptionDefinition(String name)
OptionDefinition associated with the name.getOptionDefinition in interface OptionManagername - name of the optionUserException - - if the definition is not foundpublic OptionList getOptionList()
OptionManagergetOptionList in interface OptionManagerpublic void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2021 The Apache Software Foundation. All rights reserved.