public class SystemPluginLocator extends Object implements ConnectorLocator
System plugins are defined in the Drill core, reside on the default class
path, and are annotated with @SystemPlugin
.
Constructor and Description |
---|
SystemPluginLocator(PluginRegistryContext context) |
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()
Dynamically loads system plugins annotated with
SystemPlugin . |
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.
|
public SystemPluginLocator(PluginRegistryContext context)
public void init()
SystemPlugin
.
Will skip plugin initialization if no matching constructor, incorrect
class implementation, name absence are detected.init
in interface ConnectorLocator
public StoragePlugins bootstrapPlugins() throws IOException
ConnectorLocator
bootstrapPlugins
in interface ConnectorLocator
null
if this locator
does not provide bootstrap pluginsIOException
public StoragePlugins updatedPlugins()
ConnectorLocator
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.
updatedPlugins
in interface ConnectorLocator
public void onUpgrade()
ConnectorLocator
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.onUpgrade
in interface ConnectorLocator
public StoragePlugin get(String name)
ConnectorLocator
get
in interface ConnectorLocator
name
- the name of a connector class (not the name of
a plugin (configuration)public Collection<StoragePlugin> intrinsicPlugins()
ConnectorLocator
intrinsicPlugins
in interface ConnectorLocator
public StoragePlugin create(String name, StoragePluginConfig pluginConfig)
ConnectorLocator
create
in interface ConnectorLocator
name
- name of the storage plugin (configuration).pluginConfig
- the deserialized Java configuration object.public Set<Class<? extends StoragePluginConfig>> configClasses()
ConnectorLocator
configClasses
in interface ConnectorLocator
public boolean storable()
storable
in interface ConnectorLocator
public Class<? extends StoragePlugin> connectorClassFor(Class<? extends StoragePluginConfig> configClass)
ConnectorLocator
connectorClassFor
in interface ConnectorLocator
public void close()
close
in interface ConnectorLocator
Copyright © 1970 The Apache Software Foundation. All rights reserved.