Class ExtensionModelLoader
ExtensionModel for a Mule plugin artifact from a set of attributes read by the MulePluginModel.- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAvoids setting a default value offalseto parameters of boolean type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAllows adding pre-configured the givencontextbefore it's fed intodeclareExtension(ExtensionLoadingContext).protected abstract voiddeclareExtension(ExtensionLoadingContext context) This method uses theExtensionDeclarerfound throughExtensionLoadingContext.getExtensionDeclarer()to define theExtensionModelto be loaded.protected org.mule.runtime.api.meta.model.ExtensionModeldoCreate(ExtensionLoadingContext context) Creates anExtensionModelfrom thecontext.abstract StringgetId()final org.mule.runtime.api.meta.model.ExtensionModelloadExtensionModel(ClassLoader pluginClassLoader, org.mule.runtime.api.dsl.DslResolvingContext dslResolvingContext, Map<String, Object> attributes) Deprecated.since 1.5.0.final org.mule.runtime.api.meta.model.ExtensionModelloadExtensionModel(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer extensionDeclarer, ExtensionModelLoadingRequest request) Creates anExtensionModelfrom therequest.final org.mule.runtime.api.meta.model.ExtensionModelCreates anExtensionModelfrom therequest.
-
Field Details
-
DONT_SET_DEFAULT_VALUE_TO_BOOLEAN_PARAMS
Avoids setting a default value offalseto parameters of boolean type.This is used to avoid W-12003688.
- Since:
- 1.5.0
- See Also:
-
-
Constructor Details
-
ExtensionModelLoader
public ExtensionModelLoader()
-
-
Method Details
-
getId
- Returns:
- an identifier of this
ExtensionModelLoader. Non null neither blank. The ID must be unique among allExtensionModelLoader.
-
loadExtensionModel
@Deprecated public final org.mule.runtime.api.meta.model.ExtensionModel loadExtensionModel(ClassLoader pluginClassLoader, org.mule.runtime.api.dsl.DslResolvingContext dslResolvingContext, Map<String, Object> attributes) Deprecated.since 1.5.0. UseloadExtensionModel(ExtensionModelLoadingRequest)insteadCreates anExtensionModelfrom thepluginClassLoaderusing any attribute it needs from theattributesparameter. Bear in mind that, is up to each implementation of this method to validate theattributesparameter 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 (seeMulePluginModel) for a plugin in a generic way.This method delegates into
declareExtension(ExtensionLoadingContext)in order to obtain theExtensionDeclaration. That declaration is then transformed into an actualExtensionModel. While loading the extension, a default set ofDeclarationEnricherandExtensionModelValidatorwill be applied. TheExtensionLoadingContextreceived indeclareExtension(ExtensionLoadingContext)might additionally contain extra ones. TheconfigureContextBeforeDeclaration(ExtensionLoadingContext)allows to add custom configurations into the context before the declaration begins.- Parameters:
pluginClassLoader- contextClassLoaderthat holds all the needed classes and resources to properly generate anExtensionModel.dslResolvingContext- context with all theExtensionModels already loaded that are mandatory to execute the method properly.attributes- a set of attributes to work with in each concrete implementation ofExtensionModelLoader, which will be responsible for extracting the mandatory parameters (while casting, if needed).- Returns:
- an
ExtensionModelthat represents the plugin being described - Throws:
IllegalArgumentException- if there are missing entries inattributesor their type does not match the expected one.
-
loadExtensionModel
public final org.mule.runtime.api.meta.model.ExtensionModel loadExtensionModel(ExtensionModelLoadingRequest request) Creates anExtensionModelfrom therequest.This method delegates into
declareExtension(ExtensionLoadingContext)in order to obtain theExtensionDeclaration. That declaration is then transformed into an actualExtensionModel. While loading the extension, a default set ofDeclarationEnricherandExtensionModelValidatorwill be applied.The
ExtensionLoadingContextreceived indeclareExtension(ExtensionLoadingContext)might additionally contain extra ones. TheconfigureContextBeforeDeclaration(ExtensionLoadingContext)allows to add custom configurations into the context before the declaration begins.- Parameters:
request- aExtensionModelLoadingRequestwhich configures the loading operation- Returns:
- an
ExtensionModelthat represents the plugin being described - Throws:
IllegalArgumentException- if there are missing entries inattributesor their type does not match the expected one.
-
loadExtensionModel
public final org.mule.runtime.api.meta.model.ExtensionModel loadExtensionModel(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer extensionDeclarer, ExtensionModelLoadingRequest request) Creates anExtensionModelfrom therequest.This method delegates into
declareExtension(ExtensionLoadingContext)in order to obtain theExtensionDeclaration. That declaration is then transformed into an actualExtensionModel. While loading the extension, a default set ofDeclarationEnricherandExtensionModelValidatorwill be applied.The
ExtensionLoadingContextreceived indeclareExtension(ExtensionLoadingContext)might additionally contain extra ones. TheconfigureContextBeforeDeclaration(ExtensionLoadingContext)allows to add custom configurations into the context before the declaration begins.- Parameters:
extensionDeclarer- a base declarer for the extension to be loaded.request- aExtensionModelLoadingRequestwhich configures the loading operation- Returns:
- an
ExtensionModelthat represents the plugin being described - Throws:
IllegalArgumentException- if there are missing entries inattributesor their type does not match the expected one.- Since:
- 1.8
-
doCreate
Creates anExtensionModelfrom thecontext.This method delegates into
declareExtension(ExtensionLoadingContext)in order to obtain theExtensionDeclaration. That declaration is then transformed into an actualExtensionModel. While loading the extension, a default set ofDeclarationEnricherandExtensionModelValidatorwill be applied.- Parameters:
context- the context that will be used for the declaration.- Returns:
- an
ExtensionModelthat represents the plugin being described - Throws:
IllegalArgumentException- if there are missing entries inattributesor their type does not match the expected one.
-
configureContextBeforeDeclaration
Allows adding pre-configured the givencontextbefore it's fed intodeclareExtension(ExtensionLoadingContext). This is the ideal place to register custom parameters, enrichers, validators, etc.- Parameters:
context- the context that will be used for the declaration
-
declareExtension
This method uses theExtensionDeclarerfound throughExtensionLoadingContext.getExtensionDeclarer()to define theExtensionModelto 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.
- Parameters:
context- the context that will be used for the declaration
-