public interface ConnectorLocator
Terminology is a bit tortured. Drill overuses the term "plugin." Here we adopt the following conventions:
Connectors can be storable in the persistent store. All "normal" connectors have storable configurations. System plugins, however have a fixed config that is not storable.
Connectors can define bootstrap or upgrade plugin sets. "Normal" plugins usually provide bootstrap configs, system plugins do not.
This class instantiates a connector given a configuration and a name. The plugin registry caches the instance for the duration of the Drillbit run, or until the config changes.
Modifier and Type | Method and Description |
---|---|
StoragePlugins |
bootstrapPlugins()
When starting a new installation, called to load bootstrap
plugins (configurations) that come "out-of-the-box."
|
void |
close() |
Set<Class<? extends StoragePluginConfig>> |
configClasses()
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.
|
StoragePlugin |
create(String name,
StoragePluginConfig pluginConfig)
Create a connector instance given a named configuration.
|
StoragePlugin |
get(String name)
Retrieve an instance of the named connector with default configuration.
|
void |
init()
Initialize the locator.
|
Collection<StoragePlugin> |
intrinsicPlugins()
Enumerate the intrinsic plugins.
|
void |
onUpgrade()
If
updatedPlugins() returned non-null, then the
registry will call this method after successful update of
the persistent store. |
boolean |
storable() |
StoragePlugins |
updatedPlugins()
Identify plugins to be added to an existing system, typically
on the first run after an upgrade.
|
void init()
StoragePlugins bootstrapPlugins() throws IOException
null
if this locator
does not provide bootstrap pluginsIOException
StoragePlugins updatedPlugins()
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.
IOException
- for errorsvoid onUpgrade()
updatedPlugins()
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.Collection<StoragePlugin> intrinsicPlugins()
StoragePlugin get(String name)
name
- the name of a connector class (not the name of
a plugin (configuration)Set<Class<? extends StoragePluginConfig>> configClasses()
StoragePlugin create(String name, StoragePluginConfig pluginConfig) throws Exception
name
- name of the storage plugin (configuration).pluginConfig
- the deserialized Java configuration object.ExecutionSetupException
- for all errorsException
boolean storable()
Class<? extends StoragePlugin> connectorClassFor(Class<? extends StoragePluginConfig> configClass)
void close()
Copyright © 1970 The Apache Software Foundation. All rights reserved.