public abstract class ExtensionModelLoader extends Object
ExtensionModel for a Mule plugin artifact from a set of attributes read by the MulePluginModel.| Constructor and Description |
|---|
ExtensionModelLoader() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureContextBeforeDeclaration(ExtensionLoadingContext context)
Allows to add pre configured the given
context before it's fed into declareExtension(ExtensionLoadingContext). |
protected abstract void |
declareExtension(ExtensionLoadingContext context)
This method uses the
ExtensionDeclarer found through ExtensionLoadingContext.getExtensionDeclarer()
to define the ExtensionModel to be loaded. |
abstract String |
getId() |
org.mule.runtime.api.meta.model.ExtensionModel |
loadExtensionModel(ClassLoader pluginClassLoader,
org.mule.runtime.api.dsl.DslResolvingContext dslResolvingContext,
Map<String,Object> attributes)
Creates an
ExtensionModel from the pluginClassLoader using any attribute it needs from the attributes
parameter. |
public abstract String getId()
ExtensionModelLoader. Non null neither blank.
The ID must be unique among all ExtensionModelLoader.public final org.mule.runtime.api.meta.model.ExtensionModel loadExtensionModel(ClassLoader pluginClassLoader, org.mule.runtime.api.dsl.DslResolvingContext dslResolvingContext, Map<String,Object> attributes)
ExtensionModel from the pluginClassLoader using any attribute it needs from the attributes
parameter.
Bear in mind that, is up to each implementation of this method to validate the attributes parameter has the needed
elements and that each of them is also of the expected Java class. This is by design, as the invokers of this method knows
how to parse descriptor files (see MulePluginModel) for a plugin in a generic way.
This method delegates into declareExtension(ExtensionLoadingContext) in order to obtain the
ExtensionDeclaration. That declaration is then transformed into an actual ExtensionModel.
While loading the extension, a default set of DeclarationEnricher and ExtensionModelValidator will be applied.
The ExtensionLoadingContext received in declareExtension(ExtensionLoadingContext) might additionally
contain extra ones. The configureContextBeforeDeclaration(ExtensionLoadingContext) allows to add custom
configurations into the context before the declaration begins.
pluginClassLoader - context ClassLoader that holds all the needed classes and resources to properly generate
an ExtensionModel.dslResolvingContext - context with all the ExtensionModels already loaded that are mandatory to execute the
method properly.attributes - a set of attributes to work with in each concrete implementation of ExtensionModelLoader, which will
be responsible of extracting the mandatory parameters (while casting, if needed).ExtensionModel that represents the plugin being describedIllegalArgumentException - if there are missing entries in attributes or the type of any of them does not apply
to the expected one.protected void configureContextBeforeDeclaration(ExtensionLoadingContext context)
context before it's fed into declareExtension(ExtensionLoadingContext).
This is the ideal place to register custom parameters, enrichers, validators, etc.context - the context that will be used for the declarationprotected abstract void declareExtension(ExtensionLoadingContext context)
ExtensionDeclarer found through ExtensionLoadingContext.getExtensionDeclarer()
to define the ExtensionModel to be loaded.
IMPORTANT: When this method is executed, the runtime automatically sets the current thread's context classloader
to ExtensionLoadingContext.getExtensionClassLoader(). The previous TCCL is restored after this method's execution.
This method should only be invoked by the runtime. Do not invoke manually.
context - the context that will be used for the declarationCopyright © 2017 MuleSoft, Inc.. All rights reserved.