Class SystemPluginLocator

java.lang.Object
org.apache.drill.exec.store.SystemPluginLocator
All Implemented Interfaces:
ConnectorLocator

public class SystemPluginLocator extends Object implements 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 Details

  • Method Details

    • init

      public void init()
      Dynamically loads system plugins annotated with SystemPlugin. Will skip plugin initialization if no matching constructor, incorrect class implementation, name absence are detected.
      Specified by:
      init in interface ConnectorLocator
    • bootstrapPlugins

      public StoragePlugins bootstrapPlugins() throws IOException
      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 interface ConnectorLocator
      Returns:
      the set of bootstrap plugins, or null if this locator does not provide bootstrap plugins
      Throws:
      IOException
    • updatedPlugins

      public StoragePlugins 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 interface ConnectorLocator
      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
      If 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.
      Specified by:
      onUpgrade in interface ConnectorLocator
    • get

      public StoragePlugin get(String name)
      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 interface ConnectorLocator
      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

      public Collection<StoragePlugin> 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 interface ConnectorLocator
      Returns:
      map of intrinsic plugins which require no configuration
    • create

      public StoragePlugin create(String name, StoragePluginConfig pluginConfig)
      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 interface ConnectorLocator
      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

      public Set<Class<? extends StoragePluginConfig>> 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 interface ConnectorLocator
      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 interface ConnectorLocator
      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 interface ConnectorLocator
    • close

      public void close()
      Specified by:
      close in interface ConnectorLocator