Search in sources :

Example 1 with ConnectionProviderDefinitionParser

use of org.mule.runtime.module.extension.internal.config.dsl.connection.ConnectionProviderDefinitionParser in project mule by mulesoft.

the class DefaultExtensionBuildingDefinitionProvider method registerExtensionParsers.

private void registerExtensionParsers(ExtensionModel extensionModel) {
    XmlDslModel xmlDslModel = extensionModel.getXmlDslModel();
    final ExtensionParsingContext parsingContext = createParsingContext(extensionModel);
    final Builder definitionBuilder = new Builder().withNamespace(xmlDslModel.getPrefix());
    final DslSyntaxResolver dslSyntaxResolver = DslSyntaxResolver.getDefault(extensionModel, DslResolvingContext.getDefault(extensions));
    if (extensionModel.getModelProperty(CustomBuildingDefinitionProviderModelProperty.class).isPresent()) {
        return;
    }
    if (extensionModel.getModelProperty(XmlExtensionModelProperty.class).isPresent()) {
        registerXmlExtensionParsers(definitionBuilder, extensionModel, dslSyntaxResolver);
    } else {
        final ClassLoader extensionClassLoader = getClassLoader(extensionModel);
        withContextClassLoader(extensionClassLoader, () -> {
            ReflectionCache reflectionCache = new ReflectionCache();
            new IdempotentExtensionWalker() {

                @Override
                public void onConfiguration(ConfigurationModel model) {
                    parseWith(new ConfigurationDefinitionParser(definitionBuilder, extensionModel, model, dslSyntaxResolver, parsingContext));
                }

                @Override
                protected void onConstruct(ConstructModel model) {
                    parseWith(new ConstructDefinitionParser(definitionBuilder, extensionModel, model, dslSyntaxResolver, parsingContext));
                }

                @Override
                public void onOperation(OperationModel model) {
                    parseWith(new OperationDefinitionParser(definitionBuilder, extensionModel, model, dslSyntaxResolver, parsingContext));
                }

                @Override
                public void onConnectionProvider(ConnectionProviderModel model) {
                    parseWith(new ConnectionProviderDefinitionParser(definitionBuilder, model, extensionModel, dslSyntaxResolver, parsingContext));
                }

                @Override
                public void onSource(SourceModel model) {
                    parseWith(new SourceDefinitionParser(definitionBuilder, extensionModel, model, dslSyntaxResolver, parsingContext));
                }

                @Override
                protected void onParameter(ParameterGroupModel groupModel, ParameterModel model) {
                    registerTopLevelParameter(model.getType(), definitionBuilder, extensionClassLoader, dslSyntaxResolver, parsingContext, reflectionCache);
                }
            }.walk(extensionModel);
            registerExportedTypesTopLevelParsers(extensionModel, definitionBuilder, extensionClassLoader, dslSyntaxResolver, parsingContext, reflectionCache);
            registerSubTypes(definitionBuilder, extensionClassLoader, dslSyntaxResolver, parsingContext, reflectionCache);
        });
    }
}
Also used : ConfigurationModel(org.mule.runtime.api.meta.model.config.ConfigurationModel) ReflectionCache(org.mule.runtime.module.extension.internal.util.ReflectionCache) Builder(org.mule.runtime.dsl.api.component.ComponentBuildingDefinition.Builder) ModuleOperationMessageProcessorChainBuilder(org.mule.runtime.core.internal.processor.chain.ModuleOperationMessageProcessorChainBuilder) DslSyntaxResolver(org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver) CustomBuildingDefinitionProviderModelProperty(org.mule.runtime.core.internal.extension.CustomBuildingDefinitionProviderModelProperty) ConnectionProviderDefinitionParser(org.mule.runtime.module.extension.internal.config.dsl.connection.ConnectionProviderDefinitionParser) SourceModel(org.mule.runtime.api.meta.model.source.SourceModel) ConstructModel(org.mule.runtime.api.meta.model.construct.ConstructModel) XmlExtensionModelProperty(org.mule.runtime.extension.api.property.XmlExtensionModelProperty) ConstructDefinitionParser(org.mule.runtime.module.extension.internal.config.dsl.construct.ConstructDefinitionParser) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) SourceDefinitionParser(org.mule.runtime.module.extension.internal.config.dsl.source.SourceDefinitionParser) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) XmlDslModel(org.mule.runtime.api.meta.model.XmlDslModel) MuleExtensionUtils.getClassLoader(org.mule.runtime.module.extension.internal.util.MuleExtensionUtils.getClassLoader) ClassUtils.withContextClassLoader(org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader) ConfigurationDefinitionParser(org.mule.runtime.module.extension.internal.config.dsl.config.ConfigurationDefinitionParser) IdempotentExtensionWalker(org.mule.runtime.api.meta.model.util.IdempotentExtensionWalker) ConnectionProviderModel(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) OperationDefinitionParser(org.mule.runtime.module.extension.internal.config.dsl.operation.OperationDefinitionParser)

Aggregations

XmlDslModel (org.mule.runtime.api.meta.model.XmlDslModel)1 ConfigurationModel (org.mule.runtime.api.meta.model.config.ConfigurationModel)1 ConnectionProviderModel (org.mule.runtime.api.meta.model.connection.ConnectionProviderModel)1 ConstructModel (org.mule.runtime.api.meta.model.construct.ConstructModel)1 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)1 ParameterGroupModel (org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)1 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)1 SourceModel (org.mule.runtime.api.meta.model.source.SourceModel)1 IdempotentExtensionWalker (org.mule.runtime.api.meta.model.util.IdempotentExtensionWalker)1 ClassUtils.withContextClassLoader (org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader)1 CustomBuildingDefinitionProviderModelProperty (org.mule.runtime.core.internal.extension.CustomBuildingDefinitionProviderModelProperty)1 ModuleOperationMessageProcessorChainBuilder (org.mule.runtime.core.internal.processor.chain.ModuleOperationMessageProcessorChainBuilder)1 Builder (org.mule.runtime.dsl.api.component.ComponentBuildingDefinition.Builder)1 DslSyntaxResolver (org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver)1 XmlExtensionModelProperty (org.mule.runtime.extension.api.property.XmlExtensionModelProperty)1 ConfigurationDefinitionParser (org.mule.runtime.module.extension.internal.config.dsl.config.ConfigurationDefinitionParser)1 ConnectionProviderDefinitionParser (org.mule.runtime.module.extension.internal.config.dsl.connection.ConnectionProviderDefinitionParser)1 ConstructDefinitionParser (org.mule.runtime.module.extension.internal.config.dsl.construct.ConstructDefinitionParser)1 OperationDefinitionParser (org.mule.runtime.module.extension.internal.config.dsl.operation.OperationDefinitionParser)1 SourceDefinitionParser (org.mule.runtime.module.extension.internal.config.dsl.source.SourceDefinitionParser)1