@NoImplement public interface ExtensionManager
extension models
available in the current context and their state.
This class is also the access point to obtaining configuration instances
of the extensions in
use.
For an extension to be usable, it has to be registered in this manager through the registerExtension(ExtensionModel)
method
void registerExtension(ExtensionModel extensionModel)
ExtensionModel
.extensionModel
- the ExtensionModel
to be registered. Cannot be null
Set<ExtensionModel> getExtensions()
Set
listing all the discovered
extensionModels
.Set
. Will not be null
but might be emptyOptional<ExtensionModel> getExtension(String extensionName)
extensionName
- the name of the extensions you want.Optional
. It will be empty if no such extension is registeredConfigurationInstance getConfiguration(String configurationProviderName, CoreEvent event)
ConfigurationInstance
obtained through a previously registered ConfigurationProvider
named as
configurationProvider
After the ConfigurationProvider
has been located, an instance is returned by invoking its
ConfigurationProvider.get(Event)
with the muleEvent
as the argument.
By the mere fact of this configuration being returned, the value of ConfigurationStats.getLastUsedMillis()
will be
updated for the returned ConfigurationInstance
configurationProviderName
- the name of a previously registered ConfigurationProvider
event
- the current EventConfigurationInstance
Optional<ConfigurationInstance> getConfiguration(ExtensionModel extensionModel, ComponentModel componentModel, CoreEvent muleEvent)
ConfigurationInstance
for the given extensionModel
and componentModel
.
Because no ConfigurationProvider
is specified, the following algorithm will be applied to
try and determine the
instance to be returned:
ConfigurationProvider
is registered, capable of handing configurations of the given
componentModel
, then that provider is usedConfigurationProvider
meeting the criteria above is found, then a IllegalStateException
is thrownConfigurationProvider
is registered, then an attempt will be made to locate a
ConfigurationModel
for which an implicit configuration can be inferred. A model can be considered implicit if all its
parameters are either optional or provide a default value. If such a model is found and it is unique, then a
ConfigurationProvider
is created and registered for that model.IllegalStateException
is thrown
By the mere fact of this configuration being returned, the value of ConfigurationStats.getLastUsedMillis()
will be
updated for the returned ConfigurationInstance
extensionModel
- the ExtensionModel
for which a configuration is wantedcomponentModel
- the ComponentModel
associated to a ConfigurationInstance
muleEvent
- the current EventOptional
for a ConfigurationInstance
IllegalStateException
- if none or too many ConfigurationProvider
are found to be suitableOptional<ConfigurationProvider> getConfigurationProvider(String configurationProviderName)
ConfigurationProvider
which would serve an invocation to the
getConfiguration(String, CoreEvent)
method.
This means that the returned provided will be located using the same set of rules as the aforementioned method.
configurationProviderName
- the name of a previously registered ConfigurationProvider
Optional
ConfigurationProvider
Optional<ConfigurationProvider> getConfigurationProvider(ExtensionModel extensionModel, ComponentModel componentModel)
ConfigurationProvider
for the given ComponentModel
.extensionModel
- the ExtensionModel
for which a configuration is wantedcomponentModel
- the ComponentModel
for which a configuration is wantedOptional
ConfigurationProvider
void registerConfigurationProvider(ConfigurationProvider configurationProvider)
ConfigurationProvider
which should be later be used to serve invocations to
getConfigurationProvider(ExtensionModel, ComponentModel)
and getConfiguration(String, CoreEvent)
configurationProvider
- a ConfigurationProvider
Copyright © 2018. All rights reserved.