Search in sources :

Example 1 with TARGET_VALUE_PARAMETER_NAME

use of org.mule.runtime.extension.api.ExtensionConstants.TARGET_VALUE_PARAMETER_NAME in project mule by mulesoft.

the class AbstractComponentDefinitionParser method doParse.

@Override
protected Builder doParse(Builder definitionBuilder) throws ConfigurationException {
    Builder finalBuilder = definitionBuilder.withIdentifier(operationDsl.getElementName()).withTypeDefinition(fromType(getMessageProcessorType())).withObjectFactoryType(getMessageProcessorFactoryType()).withConstructorParameterDefinition(fromFixedValue(extensionModel).build()).withConstructorParameterDefinition(fromFixedValue(componentModel).build()).withConstructorParameterDefinition(fromReferenceObject(MuleContext.class).build()).withConstructorParameterDefinition(fromReferenceObject(Registry.class).build()).withConstructorParameterDefinition(fromReferenceObject(PolicyManager.class).build()).withSetterParameterDefinition(TARGET_PARAMETER_NAME, fromSimpleParameter(TARGET_PARAMETER_NAME).build()).withSetterParameterDefinition(TARGET_VALUE_PARAMETER_NAME, fromSimpleParameter(TARGET_VALUE_PARAMETER_NAME).build()).withSetterParameterDefinition(CONFIG_PROVIDER_ATTRIBUTE_NAME, fromSimpleReferenceParameter(CONFIG_ATTRIBUTE_NAME).build()).withSetterParameterDefinition(CURSOR_PROVIDER_FACTORY_FIELD_NAME, fromChildConfiguration(CursorProviderFactory.class).build()).withSetterParameterDefinition("retryPolicyTemplate", fromChildConfiguration(RetryPolicyTemplate.class).build());
    Optional<? extends NestableElementModel> nestedChain = componentModel.getNestedComponents().stream().filter(c -> c instanceof NestedChainModel).findFirst();
    if (nestedChain.isPresent()) {
        // TODO MULE-13483: improve parsers to support things like [source, chainOfProcessors, errorHandler]
        // or [chainOfProcessors, errorHandler]
        finalBuilder = finalBuilder.withSetterParameterDefinition("nestedProcessors", fromChildCollectionConfiguration(Processor.class).build());
        parseParameters(componentModel.getAllParameterModels());
    } else {
        List<ParameterGroupModel> inlineGroups = getInlineGroups(componentModel);
        parseParameters(getFlatParameters(inlineGroups, componentModel.getAllParameterModels()));
        for (ParameterGroupModel group : inlineGroups) {
            parseInlineParameterGroup(group);
        }
        // TODO MULE-13483
        parseNestedComponents(componentModel.getNestedComponents());
    }
    return finalBuilder;
}
Also used : ExtensionDefinitionParser(org.mule.runtime.module.extension.internal.config.dsl.ExtensionDefinitionParser) Builder.fromReferenceObject(org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromReferenceObject) RetryPolicyTemplate(org.mule.runtime.core.api.retry.policy.RetryPolicyTemplate) CONFIG_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.CONFIG_ATTRIBUTE_NAME) ExtensionParsingContext(org.mule.runtime.module.extension.internal.config.dsl.ExtensionParsingContext) ComponentModel(org.mule.runtime.api.meta.model.ComponentModel) Builder.fromChildConfiguration(org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromChildConfiguration) Builder.fromSimpleReferenceParameter(org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromSimpleReferenceParameter) Processor(org.mule.runtime.core.api.processor.Processor) Builder.fromFixedValue(org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromFixedValue) Builder.fromSimpleParameter(org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromSimpleParameter) OperationMessageProcessorObjectFactory(org.mule.runtime.module.extension.internal.config.dsl.operation.OperationMessageProcessorObjectFactory) TARGET_VALUE_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.TARGET_VALUE_PARAMETER_NAME) MuleContext(org.mule.runtime.core.api.MuleContext) TARGET_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.TARGET_PARAMETER_NAME) Registry(org.mule.runtime.api.artifact.Registry) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) PolicyManager(org.mule.runtime.core.internal.policy.PolicyManager) Builder.fromChildCollectionConfiguration(org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromChildCollectionConfiguration) TypeDefinition.fromType(org.mule.runtime.dsl.api.component.TypeDefinition.fromType) NestableElementModel(org.mule.runtime.api.meta.model.nested.NestableElementModel) ComponentMessageProcessorObjectFactory(org.mule.runtime.module.extension.internal.config.dsl.ComponentMessageProcessorObjectFactory) ConfigurationException(org.mule.runtime.core.api.config.ConfigurationException) NestedChainModel(org.mule.runtime.api.meta.model.nested.NestedChainModel) OperationMessageProcessor(org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessor) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) List(java.util.List) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) ComponentMessageProcessor(org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor) DslSyntaxResolver(org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver) Optional(java.util.Optional) CursorProviderFactory(org.mule.runtime.core.api.streaming.CursorProviderFactory) Builder(org.mule.runtime.dsl.api.component.ComponentBuildingDefinition.Builder) MuleContext(org.mule.runtime.core.api.MuleContext) PolicyManager(org.mule.runtime.core.internal.policy.PolicyManager) CursorProviderFactory(org.mule.runtime.core.api.streaming.CursorProviderFactory) Processor(org.mule.runtime.core.api.processor.Processor) OperationMessageProcessor(org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessor) ComponentMessageProcessor(org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor) NestedChainModel(org.mule.runtime.api.meta.model.nested.NestedChainModel) Builder(org.mule.runtime.dsl.api.component.ComponentBuildingDefinition.Builder) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)

Aggregations

List (java.util.List)1 Optional (java.util.Optional)1 Registry (org.mule.runtime.api.artifact.Registry)1 ComponentModel (org.mule.runtime.api.meta.model.ComponentModel)1 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)1 NestableElementModel (org.mule.runtime.api.meta.model.nested.NestableElementModel)1 NestedChainModel (org.mule.runtime.api.meta.model.nested.NestedChainModel)1 ParameterGroupModel (org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)1 MuleContext (org.mule.runtime.core.api.MuleContext)1 ConfigurationException (org.mule.runtime.core.api.config.ConfigurationException)1 Processor (org.mule.runtime.core.api.processor.Processor)1 RetryPolicyTemplate (org.mule.runtime.core.api.retry.policy.RetryPolicyTemplate)1 CursorProviderFactory (org.mule.runtime.core.api.streaming.CursorProviderFactory)1 PolicyManager (org.mule.runtime.core.internal.policy.PolicyManager)1 Builder.fromChildCollectionConfiguration (org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromChildCollectionConfiguration)1 Builder.fromChildConfiguration (org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromChildConfiguration)1 Builder.fromFixedValue (org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromFixedValue)1 Builder.fromReferenceObject (org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromReferenceObject)1 Builder.fromSimpleParameter (org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromSimpleParameter)1 Builder.fromSimpleReferenceParameter (org.mule.runtime.dsl.api.component.AttributeDefinition.Builder.fromSimpleReferenceParameter)1