public interface ExtensionManager
Extensions available in the current context and their state.
Going beyond the introspection model defined by Extension, Configuration
and Operation class, at runtime there will be instances implementing the extension
components modeled by them. Those instances need to be registered with this manager in order to be used.
The workflow for this manager would be to first discover the currently available extensions
through discoverExtensions(ClassLoader). Additionally, Extension instances
can also be added in runtime through registerExtension(Extension).
Instances serving as realization of a Configuration model need to be registered
with the registerConfigurationInstanceProvider(Extension, String, ConfigurationInstanceProvider)
method in order for this manager to provision the underlying infrastructure to host and execute such configuration.| Modifier and Type | Method and Description |
|---|---|
List<Extension> |
discoverExtensions(ClassLoader classLoader)
Scans the classpath visible to the given
ClassLoader and registers them. |
Set<Extension> |
getExtensions()
|
<C> Set<Extension> |
getExtensionsCapableOf(Class<C> capability)
|
<C> void |
registerConfigurationInstanceProvider(Extension extension,
String providerName,
ConfigurationInstanceProvider<C> configurationInstanceProvider)
Registers the
configurationInstanceProvider. |
boolean |
registerExtension(Extension extension)
|
List<Extension> discoverExtensions(ClassLoader classLoader)
ClassLoader and registers them.
The discovery process works as follows:
Describer interfaceExtensionFactory and transformed in Extension instancesregisterExtension(Extension) methodList is returned with all the extensions available after the discovery process finishes.classLoader - a not null ClassLoader in which to search for extensionsList with all the available extensionsboolean registerExtension(Extension extension)
Extension
If a matching Extension is already registered,
then this manager will apply whatever policy finds more convenient to decide if the existing
registration is kept or replaced. That is up to the implementation. The only thing this contract
guarantees is that each extension type will be registered only once and that the discovery process
will not fail if many discovery runs are triggered over the same classpath.extension - the Extension to be registered. Cannot be nulltrue if the extension was registered. false if the platform decided
to kept an existing declaration<C> void registerConfigurationInstanceProvider(Extension extension, String providerName, ConfigurationInstanceProvider<C> configurationInstanceProvider)
configurationInstanceProvider.
The provider can later be referenced by the given
providerNameC - the type of the configurations instances that configurationInstanceProvider providesproviderName - the name under which the configurationInstanceProvider will be referencedconfigurationInstanceProvider - a ConfigurationInstanceProviderCopyright © 2015 MuleSoft, Inc.. All rights reserved.