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
-
Method Summary
Modifier and TypeMethodDescriptionWhen starting a new installation, called to load bootstrap plugins (configurations) that come "out-of-the-box."void
close()
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.void
init()
Dynamically loads system plugins annotated withSystemPlugin
.Enumerate the intrinsic plugins.void
IfupdatedPlugins()
returned non-null, then the registry will call this method after successful update of the persistent store.boolean
storable()
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:
init
in interfaceConnectorLocator
-
bootstrapPlugins
Description copied from interface:ConnectorLocator
When starting a new installation, called to load bootstrap plugins (configurations) that come "out-of-the-box."- Specified by:
bootstrapPlugins
in interfaceConnectorLocator
- Returns:
- the set of bootstrap plugins, or
null
if this locator does not provide bootstrap plugins - Throws:
IOException
-
updatedPlugins
Description copied from interface:ConnectorLocator
Identify 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:
updatedPlugins
in 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:ConnectorLocator
IfupdatedPlugins()
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:
onUpgrade
in interfaceConnectorLocator
-
get
Description copied from interface:ConnectorLocator
Retrieve an instance of the named connector with default configuration. Typically used for connectors with no configuration, such as system storage plugins.- Specified by:
get
in 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:ConnectorLocator
Enumerate 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:
intrinsicPlugins
in interfaceConnectorLocator
- Returns:
- map of intrinsic plugins which require no configuration
-
create
Description copied from interface:ConnectorLocator
Create a connector instance given a named configuration. The configuration and/or name is used to locate the connector class.- Specified by:
create
in 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:ConnectorLocator
Return 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:
configClasses
in 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:
storable
in 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:ConnectorLocator
Given a configuration class, return the corresponding connector (plugin) class.- Specified by:
connectorClassFor
in interfaceConnectorLocator
-
close
public void close()- Specified by:
close
in interfaceConnectorLocator
-