Package org.apache.drill.exec.store
Class SystemPluginLocator
java.lang.Object
org.apache.drill.exec.store.SystemPluginLocator
- All Implemented Interfaces:
ConnectorLocator
Locates system storage plugins. These are special in that they take
no configuration: the configuration and connector names are the same so
that the configuration name can be resolved directly to the connector.
System plugins are defined in the Drill core, reside on the default class
path, and are annotated with @SystemPlugin.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWhen starting a new installation, called to load bootstrap plugins (configurations) that come "out-of-the-box."voidclose()Set<Class<? extends StoragePluginConfig>> Return the set of known storage plugin configuration classes for which the user can create configs.Class<? extends StoragePlugin> connectorClassFor(Class<? extends StoragePluginConfig> configClass) Given a configuration class, return the corresponding connector (plugin) class.create(String name, StoragePluginConfig pluginConfig) Create a connector instance given a named configuration.Retrieve an instance of the named connector with default configuration.voidinit()Dynamically loads system plugins annotated withSystemPlugin.Enumerate the intrinsic plugins.voidIfupdatedPlugins()returned non-null, then the registry will call this method after successful update of the persistent store.booleanstorable()Identify plugins to be added to an existing system, typically on the first run after an upgrade.
-
Constructor Details
-
SystemPluginLocator
-
-
Method Details
-
init
public void init()Dynamically loads system plugins annotated withSystemPlugin. Will skip plugin initialization if no matching constructor, incorrect class implementation, name absence are detected.- Specified by:
initin interfaceConnectorLocator
-
bootstrapPlugins
Description copied from interface:ConnectorLocatorWhen starting a new installation, called to load bootstrap plugins (configurations) that come "out-of-the-box."- Specified by:
bootstrapPluginsin interfaceConnectorLocator- Returns:
- the set of bootstrap plugins, or
nullif this locator does not provide bootstrap plugins - Throws:
IOException
-
updatedPlugins
Description copied from interface:ConnectorLocatorIdentify plugins to be added to an existing system, typically on the first run after an upgrade.TODO: The current mechanism depends on deleting a file after the first run, which is unreliable. It won't, for example, correctly handle a restored ZK. A better mechanism would store a version number in the persistent store, and pass that version number into this method.
- Specified by:
updatedPluginsin interfaceConnectorLocator- Returns:
- the set of plugin configurations to refresh in the persistent store, or null if none to update
-
onUpgrade
public void onUpgrade()Description copied from interface:ConnectorLocatorIfupdatedPlugins()returned non-null, then the registry will call this method after successful update of the persistent store. This method can do any post-update cleanup, such as deleting the file mentioned above.- Specified by:
onUpgradein interfaceConnectorLocator
-
get
Description copied from interface:ConnectorLocatorRetrieve an instance of the named connector with default configuration. Typically used for connectors with no configuration, such as system storage plugins.- Specified by:
getin interfaceConnectorLocator- Parameters:
name- the name of a connector class (not the name of a plugin (configuration)- Returns:
- a plugin with default configuration, or null if this locator does not support such plugins
-
intrinsicPlugins
Description copied from interface:ConnectorLocatorEnumerate the intrinsic plugins. An intrinsic plugin is one which takes no configuration and which therefore cannot be disabled, and thus is always available. Example: Drill's system plugins. For an intrinsic plugin, the plugin name is also the name of the configuration.- Specified by:
intrinsicPluginsin interfaceConnectorLocator- Returns:
- map of intrinsic plugins which require no configuration
-
create
Description copied from interface:ConnectorLocatorCreate a connector instance given a named configuration. The configuration and/or name is used to locate the connector class.- Specified by:
createin interfaceConnectorLocator- Parameters:
name- name of the storage plugin (configuration).pluginConfig- the deserialized Java configuration object.- Returns:
- a connector of the proper class that matches the configuration or name, initialized with the configuration
-
configClasses
Description copied from interface:ConnectorLocatorReturn the set of known storage plugin configuration classes for which the user can create configs. Excludes system plugin configs. Used to map config classes to this locator to create plugin instances.- Specified by:
configClassesin interfaceConnectorLocator- Returns:
- the unuordered set of storage plugin configuration classes available from this locator. Can be null if this locator offers only system plugins
-
storable
public boolean storable()- Specified by:
storablein interfaceConnectorLocator- Returns:
- true if configs for this locator should be persisted, false if these are ad-hoc or otherwise per-run connectors
-
connectorClassFor
public Class<? extends StoragePlugin> connectorClassFor(Class<? extends StoragePluginConfig> configClass) Description copied from interface:ConnectorLocatorGiven a configuration class, return the corresponding connector (plugin) class.- Specified by:
connectorClassForin interfaceConnectorLocator
-
close
public void close()- Specified by:
closein interfaceConnectorLocator
-