Search in sources :

Example 1 with GlobalBindingContextProvider

use of org.mule.runtime.core.privileged.el.GlobalBindingContextProvider in project mule by mulesoft.

the class DefaultExpressionManager method initialise.

@Override
public void initialise() throws InitialisationException {
    if (!initialized.getAndSet(true)) {
        final DataWeaveExpressionLanguageAdaptor dwExpressionLanguage = DataWeaveExpressionLanguageAdaptor.create(muleContext, registry);
        MVELExpressionLanguage mvelExpressionLanguage = null;
        if (registry.lookupByName(COMPATIBILITY_PLUGIN_INSTALLED).isPresent()) {
            mvelExpressionLanguage = registry.<MVELExpressionLanguage>lookupByName(OBJECT_EXPRESSION_LANGUAGE).get();
        }
        this.expressionLanguage = new ExpressionLanguageAdaptorHandler(dwExpressionLanguage, mvelExpressionLanguage);
        this.melDefault = expressionLanguage.isMelDefault();
        Collection<GlobalBindingContextProvider> contextProviders = registry.lookupAllByType(GlobalBindingContextProvider.class);
        contextProviders.stream().map(GlobalBindingContextProvider::getBindingContext).forEach(expressionLanguage::addGlobalBindings);
        if (melDefault) {
            LOGGER.warn("Using MEL as the default expression language.");
        }
    }
}
Also used : GlobalBindingContextProvider(org.mule.runtime.core.privileged.el.GlobalBindingContextProvider) MVELExpressionLanguage(org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguage) DataWeaveExpressionLanguageAdaptor(org.mule.runtime.core.internal.el.dataweave.DataWeaveExpressionLanguageAdaptor)

Aggregations

DataWeaveExpressionLanguageAdaptor (org.mule.runtime.core.internal.el.dataweave.DataWeaveExpressionLanguageAdaptor)1 MVELExpressionLanguage (org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguage)1 GlobalBindingContextProvider (org.mule.runtime.core.privileged.el.GlobalBindingContextProvider)1