Search in sources :

Example 1 with ModuleNamespace

use of org.mule.runtime.api.el.ModuleNamespace in project mule by mulesoft.

the class ExtensionActivator method registerExpressionFunctions.

private void registerExpressionFunctions(ExtensionModel extensionModel) {
    if (extensionModel.getFunctionModels().isEmpty()) {
        return;
    }
    ExpressionModule.Builder moduleBuilder = new DefaultExpressionModuleBuilder(new ModuleNamespace(extensionModel.getXmlDslModel().getPrefix()));
    registerExpressionFunctions(extensionModel.getFunctionModels().stream(), moduleBuilder);
    try {
        final BindingContext bindingContext = new DefaultBindingContextBuilder().addModule(moduleBuilder.build()).build();
        registerObject(muleContext, extensionModel.getName() + "GlobalBindingContextProvider", (GlobalBindingContextProvider) () -> bindingContext);
    } catch (Exception e) {
        throw new MuleRuntimeException(createStaticMessage(e.getMessage()), e);
    }
}
Also used : DefaultExpressionModuleBuilder(org.mule.runtime.core.internal.el.DefaultExpressionModuleBuilder) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) DefaultBindingContextBuilder(org.mule.runtime.core.internal.el.DefaultBindingContextBuilder) ExpressionModule(org.mule.runtime.api.el.ExpressionModule) ModuleNamespace(org.mule.runtime.api.el.ModuleNamespace) BindingContext(org.mule.runtime.api.el.BindingContext) MuleException(org.mule.runtime.api.exception.MuleException) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException)

Aggregations

BindingContext (org.mule.runtime.api.el.BindingContext)1 ExpressionModule (org.mule.runtime.api.el.ExpressionModule)1 ModuleNamespace (org.mule.runtime.api.el.ModuleNamespace)1 MuleException (org.mule.runtime.api.exception.MuleException)1 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 DefaultBindingContextBuilder (org.mule.runtime.core.internal.el.DefaultBindingContextBuilder)1 DefaultExpressionModuleBuilder (org.mule.runtime.core.internal.el.DefaultExpressionModuleBuilder)1