Search in sources :

Example 6 with ParameterizedModel

use of org.mule.runtime.api.meta.model.parameter.ParameterizedModel in project mule by mulesoft.

the class ParametersResolver method getParametersAsResolverSet.

/**
 * Constructs a {@link ResolverSet} from the parameters groups, using {@link #toValueResolver(Object, Set)} to process the values.
 *
 * @return a {@link ResolverSet}
 */
public ResolverSet getParametersAsResolverSet(MuleContext muleContext, ParameterizedModel model, List<ParameterGroupModel> groups) throws ConfigurationException {
    List<ParameterGroupModel> inlineGroups = getInlineGroups(groups);
    List<ParameterModel> allParameters = groups.stream().flatMap(g -> g.getParameterModels().stream()).collect(toList());
    ResolverSet resolverSet = getParametersAsResolverSet(model, getFlatParameters(inlineGroups, allParameters), muleContext);
    for (ParameterGroupModel group : inlineGroups) {
        getInlineGroupResolver(group, resolverSet, muleContext);
    }
    return resolverSet;
}
Also used : ResolverUtils.getDefaultValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ResolverUtils.getDefaultValueResolver) CollectionUtils.intersection(org.apache.commons.collections.CollectionUtils.intersection) IntrospectionUtils.getMemberName(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getMemberName) NameUtils.getModelName(org.mule.runtime.extension.api.util.NameUtils.getModelName) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) ConfigOverrideTypeAnnotation(org.mule.runtime.extension.api.declaration.type.annotation.ConfigOverrideTypeAnnotation) NullSafeModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.NullSafeModelProperty) Map(java.util.Map) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) ModelProperty(org.mule.runtime.api.meta.model.ModelProperty) MuleExtensionUtils.isNullSafe(org.mule.runtime.module.extension.internal.util.MuleExtensionUtils.isNullSafe) MetadataTypeUtils.getLocalPart(org.mule.metadata.api.utils.MetadataTypeUtils.getLocalPart) NestableElementModel(org.mule.runtime.api.meta.model.nested.NestableElementModel) ResolverUtils.getFieldDefaultValueValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ResolverUtils.getFieldDefaultValueValueResolver) Collectors.toImmutableList(org.mule.runtime.api.util.collection.Collectors.toImmutableList) ObjectType(org.mule.metadata.api.model.ObjectType) ParameterGroupDescriptor(org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor) ExclusiveParametersModel(org.mule.runtime.api.meta.model.parameter.ExclusiveParametersModel) ObjectStore(org.mule.runtime.api.store.ObjectStore) ConfigurationProvider(org.mule.runtime.extension.api.runtime.config.ConfigurationProvider) Collection(java.util.Collection) Set(java.util.Set) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) ReflectionCache(org.mule.runtime.module.extension.internal.util.ReflectionCache) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) IntrospectionUtils.getFieldByNameOrAlias(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getFieldByNameOrAlias) ExclusiveOptionalsTypeAnnotation(org.mule.runtime.extension.api.declaration.type.annotation.ExclusiveOptionalsTypeAnnotation) List(java.util.List) ObjectFieldType(org.mule.metadata.api.model.ObjectFieldType) NameUtils.getComponentModelTypeName(org.mule.runtime.extension.api.util.NameUtils.getComponentModelTypeName) ExclusiveParameterGroupObjectBuilder(org.mule.runtime.module.extension.internal.runtime.objectbuilder.ExclusiveParameterGroupObjectBuilder) MetadataType(org.mule.metadata.api.model.MetadataType) Optional(java.util.Optional) IntrospectionUtils.getContainerName(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getContainerName) IllegalModelDefinitionException(org.mule.runtime.extension.api.exception.IllegalModelDefinitionException) Joiner(com.google.common.base.Joiner) StackedTypesModelProperty.getStackedTypesModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.stackabletypes.StackedTypesModelProperty.getStackedTypesModelProperty) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) MetadataTypeUtils.getDefaultValue(org.mule.metadata.api.utils.MetadataTypeUtils.getDefaultValue) ComponentModel(org.mule.runtime.api.meta.model.ComponentModel) ExtensionsTypeLoaderFactory(org.mule.runtime.extension.api.declaration.type.ExtensionsTypeLoaderFactory) HashMap(java.util.HashMap) LifecycleUtils.initialiseIfNeeded(org.mule.runtime.core.api.lifecycle.LifecycleUtils.initialiseIfNeeded) LinkedHashMap(java.util.LinkedHashMap) ExtensionMetadataTypeUtils.isFlattenedParameterGroup(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.isFlattenedParameterGroup) MuleContext(org.mule.runtime.core.api.MuleContext) DefaultObjectBuilder(org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder) RequiredParameterNotSetException(org.mule.runtime.module.extension.internal.runtime.exception.RequiredParameterNotSetException) ParameterGroupModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty) LinkedList(java.util.LinkedList) ParameterizedModel(org.mule.runtime.api.meta.model.parameter.ParameterizedModel) Collections.emptySet(java.util.Collections.emptySet) NullSafeTypeAnnotation(org.mule.runtime.extension.api.declaration.type.annotation.NullSafeTypeAnnotation) ConfigurationException(org.mule.runtime.core.api.config.ConfigurationException) I18nMessageFactory.createStaticMessage(org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage) ImmutableList.copyOf(com.google.common.collect.ImmutableList.copyOf) IntrospectionUtils.getMetadataType(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getMetadataType) Field(java.lang.reflect.Field) Collectors.toList(java.util.stream.Collectors.toList) ExtensionMetadataTypeUtils(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils) JavaTypeUtils.getType(org.mule.metadata.java.api.utils.JavaTypeUtils.getType) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)

Example 7 with ParameterizedModel

use of org.mule.runtime.api.meta.model.parameter.ParameterizedModel in project mule by mulesoft.

the class DefaultXmlArtifactDeclarationLoader method declareRoute.

private Optional<RouteElementDeclaration> declareRoute(ComposableModel model, DslElementSyntax elementDsl, ConfigLine child, ElementDeclarer extensionElementsDeclarer) {
    return model.getNestedComponents().stream().filter(nestedModel -> elementDsl.getContainedElement(nestedModel.getName()).map(nestedDsl -> child.getIdentifier().equals(nestedDsl.getElementName())).orElse(false)).filter(nestedModel -> nestedModel instanceof NestedRouteModel).findFirst().map(nestedModel -> {
        RouteElementDeclarer routeDeclarer = extensionElementsDeclarer.newRoute(nestedModel.getName());
        DslElementSyntax routeDsl = elementDsl.getContainedElement(nestedModel.getName()).get();
        declareParameterizedComponent((ParameterizedModel) nestedModel, routeDsl, routeDeclarer, child.getConfigAttributes(), child.getChildren());
        declareComposableModel((ComposableModel) nestedModel, elementDsl, child, routeDeclarer);
        return routeDeclarer.getDeclaration();
    });
}
Also used : Arrays(java.util.Arrays) CORE_PREFIX(org.mule.runtime.internal.dsl.DslConstants.CORE_PREFIX) SimpleConfigAttribute(org.mule.runtime.config.api.dsl.processor.SimpleConfigAttribute) TLS_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.TLS_PARAMETER_NAME) MuleApplicationClassLoader.resolveContextArtifactPluginClassLoaders(org.mule.runtime.deployment.model.internal.application.MuleApplicationClassLoader.resolveContextArtifactPluginClassLoaders) SpiServiceRegistry(org.mule.runtime.core.api.registry.SpiServiceRegistry) EXPIRATION_POLICY_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.EXPIRATION_POLICY_ELEMENT_IDENTIFIER) REDELIVERY_POLICY_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.REDELIVERY_POLICY_ELEMENT_IDENTIFIER) ArrayType(org.mule.metadata.api.model.ArrayType) Document(org.w3c.dom.Document) Map(java.util.Map) ParameterSimpleValue(org.mule.runtime.app.declaration.api.fluent.ParameterSimpleValue) ParameterGroupElementDeclarer(org.mule.runtime.app.declaration.api.fluent.ParameterGroupElementDeclarer) MetadataTypeUtils.getLocalPart(org.mule.metadata.api.utils.MetadataTypeUtils.getLocalPart) ElementDeclarer(org.mule.runtime.app.declaration.api.fluent.ElementDeclarer) RECONNECT_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.RECONNECT_ELEMENT_IDENTIFIER) ExtensionMetadataTypeUtils.isMap(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.isMap) ObjectType(org.mule.metadata.api.model.ObjectType) ElementDeclarer.newObjectValue(org.mule.runtime.app.declaration.api.fluent.ElementDeclarer.newObjectValue) Set(java.util.Set) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) POOLING_PROFILE_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.POOLING_PROFILE_PARAMETER_NAME) MetadataTypeVisitor(org.mule.metadata.api.visitor.MetadataTypeVisitor) NON_REPEATABLE_BYTE_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.NON_REPEATABLE_BYTE_STREAM_ALIAS) XmlArtifactDeclarationLoader(org.mule.runtime.config.internal.dsl.model.XmlArtifactDeclarationLoader) ExtensionModelUtils.isInfrastructure(org.mule.runtime.extension.api.util.ExtensionModelUtils.isInfrastructure) MetadataType(org.mule.metadata.api.model.MetadataType) DslSyntaxResolver(org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver) CONFIG_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.CONFIG_ATTRIBUTE_NAME) ConnectionProviderModel(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel) REPEATABLE_FILE_STORE_BYTES_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.REPEATABLE_FILE_STORE_BYTES_STREAM_ALIAS) RouteElementDeclaration(org.mule.runtime.app.declaration.api.RouteElementDeclaration) VALUE_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.VALUE_ATTRIBUTE_NAME) ParameterSimpleValue.cdata(org.mule.runtime.app.declaration.api.fluent.ParameterSimpleValue.cdata) ConfigurationElementDeclarer(org.mule.runtime.app.declaration.api.fluent.ConfigurationElementDeclarer) ParameterListValue(org.mule.runtime.app.declaration.api.fluent.ParameterListValue) ParameterSimpleValue.plain(org.mule.runtime.app.declaration.api.fluent.ParameterSimpleValue.plain) EXPIRATION_POLICY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.EXPIRATION_POLICY_PARAMETER_NAME) ConnectionElementDeclarer(org.mule.runtime.app.declaration.api.fluent.ConnectionElementDeclarer) ElementDeclarer.newListValue(org.mule.runtime.app.declaration.api.fluent.ElementDeclarer.newListValue) XmlConfigurationDocumentLoader.noValidationDocumentLoader(org.mule.runtime.config.api.XmlConfigurationDocumentLoader.noValidationDocumentLoader) ConstructElementDeclarer(org.mule.runtime.app.declaration.api.fluent.ConstructElementDeclarer) GlobalElementDeclaration(org.mule.runtime.app.declaration.api.GlobalElementDeclaration) ParameterizedModel(org.mule.runtime.api.meta.model.parameter.ParameterizedModel) ParameterValue(org.mule.runtime.app.declaration.api.ParameterValue) I18nMessageFactory.createStaticMessage(org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage) ConfigurationModel(org.mule.runtime.api.meta.model.config.ConfigurationModel) RECONNECTION_CONFIG_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.RECONNECTION_CONFIG_PARAMETER_NAME) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) STREAMING_STRATEGY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.STREAMING_STRATEGY_PARAMETER_NAME) ExtensionWalker(org.mule.runtime.api.meta.model.util.ExtensionWalker) Reference(org.mule.runtime.api.util.Reference) ParameterizedBuilder(org.mule.runtime.app.declaration.api.fluent.ParameterizedBuilder) ComponentElementDeclarer(org.mule.runtime.app.declaration.api.fluent.ComponentElementDeclarer) ElementDeclarer.forExtension(org.mule.runtime.app.declaration.api.fluent.ElementDeclarer.forExtension) ExtensionMetadataTypeUtils.getId(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.getId) TLS_REVOCATION_CHECK_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.TLS_REVOCATION_CHECK_ELEMENT_IDENTIFIER) RECONNECT_FOREVER_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.RECONNECT_FOREVER_ELEMENT_IDENTIFIER) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) HasNestedComponentDeclarer(org.mule.runtime.app.declaration.api.fluent.HasNestedComponentDeclarer) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ComposableModel(org.mule.runtime.api.meta.model.ComposableModel) SourceModel(org.mule.runtime.api.meta.model.source.SourceModel) Collectors.toMap(java.util.stream.Collectors.toMap) XmlApplicationParser(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser) ArtifactDeclarer(org.mule.runtime.app.declaration.api.fluent.ArtifactDeclarer) KEY_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.KEY_ATTRIBUTE_NAME) DslResolvingContext(org.mule.runtime.api.dsl.DslResolvingContext) REPEATABLE_IN_MEMORY_BYTES_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.REPEATABLE_IN_MEMORY_BYTES_STREAM_ALIAS) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) TLS_CONTEXT_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.TLS_CONTEXT_ELEMENT_IDENTIFIER) REDELIVERY_POLICY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.REDELIVERY_POLICY_PARAMETER_NAME) ConstructModel(org.mule.runtime.api.meta.model.construct.ConstructModel) CONNECTION(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel.CONNECTION) RECONNECTION_STRATEGY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.RECONNECTION_STRATEGY_PARAMETER_NAME) NAME_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.NAME_ATTRIBUTE_NAME) NestedRouteModel(org.mule.runtime.api.meta.model.nested.NestedRouteModel) List(java.util.List) HasOperationModels(org.mule.runtime.api.meta.model.operation.HasOperationModels) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) Optional(java.util.Optional) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) HasConstructModels(org.mule.runtime.api.meta.model.construct.HasConstructModels) POOLING_PROFILE_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.POOLING_PROFILE_ELEMENT_IDENTIFIER) ComponentModel(org.mule.runtime.api.meta.model.ComponentModel) RouteElementDeclarer(org.mule.runtime.app.declaration.api.fluent.RouteElementDeclarer) HashMap(java.util.HashMap) Function(java.util.function.Function) ArtifactDeclaration(org.mule.runtime.app.declaration.api.ArtifactDeclaration) XmlApplicationServiceRegistry(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationServiceRegistry) ParameterObjectValue(org.mule.runtime.app.declaration.api.fluent.ParameterObjectValue) ConfigLine(org.mule.runtime.config.api.dsl.processor.ConfigLine) ElementDeclarer.newParameterGroup(org.mule.runtime.app.declaration.api.fluent.ElementDeclarer.newParameterGroup) ParameterizedElementDeclarer(org.mule.runtime.app.declaration.api.fluent.ParameterizedElementDeclarer) Consumer(java.util.function.Consumer) Collectors.toList(java.util.stream.Collectors.toList) TopLevelParameterDeclarer(org.mule.runtime.app.declaration.api.fluent.TopLevelParameterDeclarer) StringUtils.isBlank(org.apache.commons.lang3.StringUtils.isBlank) IS_CDATA(org.mule.runtime.config.internal.dsl.processor.xml.XmlCustomAttributeHandler.IS_CDATA) ComponentElementDeclaration(org.mule.runtime.app.declaration.api.ComponentElementDeclaration) ExtensibleTypeAnnotation(org.mule.runtime.extension.api.declaration.type.annotation.ExtensibleTypeAnnotation) HasSourceModels(org.mule.runtime.api.meta.model.source.HasSourceModels) InputStream(java.io.InputStream) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) RouteElementDeclarer(org.mule.runtime.app.declaration.api.fluent.RouteElementDeclarer) NestedRouteModel(org.mule.runtime.api.meta.model.nested.NestedRouteModel)

Example 8 with ParameterizedModel

use of org.mule.runtime.api.meta.model.parameter.ParameterizedModel in project mule by mulesoft.

the class ConfigurationBasedElementModelFactory method populateComposableElements.

private void populateComposableElements(ComposableModel model, DslElementSyntax elementDsl, DslElementModel.Builder builder, ComponentConfiguration configuration) {
    configuration.getNestedComponents().forEach(nestedComponentConfig -> {
        DslElementModel nestedElement = createIdentifiedElement(nestedComponentConfig);
        if (nestedElement != null) {
            builder.containing(nestedElement);
        } else {
            model.getNestedComponents().stream().filter(nestedModel -> nestedModel instanceof NestedRouteModel).filter(nestedModel -> elementDsl.getContainedElement(nestedModel.getName()).map(nestedDsl -> getIdentifier(nestedDsl).map(id -> nestedComponentConfig.getIdentifier().equals(id)).orElse(false)).orElse(false)).findFirst().ifPresent(nestedModel -> {
                DslElementSyntax routeDsl = elementDsl.getContainedElement(nestedModel.getName()).get();
                DslElementModel.Builder<? extends NestableElementModel> routeBuilder = DslElementModel.<NestableElementModel>builder().withModel(nestedModel).withDsl(routeDsl).withConfig(nestedComponentConfig).isExplicitInDsl(true);
                populateParameterizedElements((ParameterizedModel) nestedModel, routeDsl, routeBuilder, nestedComponentConfig);
                nestedComponentConfig.getNestedComponents().forEach(routeElement -> {
                    DslElementModel nestableElementModel = createIdentifiedElement(routeElement);
                    if (nestableElementModel != null) {
                        routeBuilder.containing(nestableElementModel);
                    }
                });
                builder.containing(routeBuilder.build());
            });
        }
    });
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) ExtensionMetadataTypeUtils.getId(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.getId) RECONNECT_FOREVER_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.RECONNECT_FOREVER_ELEMENT_IDENTIFIER) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) CORE_PREFIX(org.mule.runtime.internal.dsl.DslConstants.CORE_PREFIX) Optional.of(java.util.Optional.of) TLS_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.TLS_PARAMETER_NAME) FlattenedTypeAnnotation(org.mule.runtime.extension.api.declaration.type.annotation.FlattenedTypeAnnotation) ComposableModel(org.mule.runtime.api.meta.model.ComposableModel) EXPIRATION_POLICY_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.EXPIRATION_POLICY_ELEMENT_IDENTIFIER) SourceModel(org.mule.runtime.api.meta.model.source.SourceModel) REDELIVERY_POLICY_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.REDELIVERY_POLICY_ELEMENT_IDENTIFIER) ArrayType(org.mule.metadata.api.model.ArrayType) KEY_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.KEY_ATTRIBUTE_NAME) Map(java.util.Map) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) REPEATABLE_IN_MEMORY_BYTES_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.REPEATABLE_IN_MEMORY_BYTES_STREAM_ALIAS) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) ClassTypeLoader(org.mule.metadata.api.ClassTypeLoader) REDELIVERY_POLICY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.REDELIVERY_POLICY_PARAMETER_NAME) ConstructModel(org.mule.runtime.api.meta.model.construct.ConstructModel) DslElementModelFactory(org.mule.runtime.config.api.dsl.model.DslElementModelFactory) MetadataTypeUtils.getLocalPart(org.mule.metadata.api.utils.MetadataTypeUtils.getLocalPart) NestableElementModel(org.mule.runtime.api.meta.model.nested.NestableElementModel) ExtensionModelUtils.isContent(org.mule.runtime.extension.api.util.ExtensionModelUtils.isContent) RECONNECT_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.RECONNECT_ELEMENT_IDENTIFIER) ExtensionMetadataTypeUtils.isMap(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.isMap) SCHEDULING_STRATEGY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.SCHEDULING_STRATEGY_PARAMETER_NAME) ObjectType(org.mule.metadata.api.model.ObjectType) RECONNECTION_STRATEGY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.RECONNECTION_STRATEGY_PARAMETER_NAME) Set(java.util.Set) ExtensionModelUtils.isText(org.mule.runtime.extension.api.util.ExtensionModelUtils.isText) InternalComponentConfiguration(org.mule.runtime.dsl.internal.component.config.InternalComponentConfiguration) POOLING_PROFILE_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.POOLING_PROFILE_PARAMETER_NAME) MetadataTypeVisitor(org.mule.metadata.api.visitor.MetadataTypeVisitor) Objects(java.util.Objects) NestedRouteModel(org.mule.runtime.api.meta.model.nested.NestedRouteModel) List(java.util.List) StringUtils.isNotBlank(org.apache.commons.lang3.StringUtils.isNotBlank) NON_REPEATABLE_BYTE_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.NON_REPEATABLE_BYTE_STREAM_ALIAS) HasOperationModels(org.mule.runtime.api.meta.model.operation.HasOperationModels) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) REPEATABLE_FILE_STORE_OBJECTS_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.REPEATABLE_FILE_STORE_OBJECTS_STREAM_ALIAS) ExtensionModelUtils.isInfrastructure(org.mule.runtime.extension.api.util.ExtensionModelUtils.isInfrastructure) MetadataType(org.mule.metadata.api.model.MetadataType) DslSyntaxResolver(org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver) Optional(java.util.Optional) EE_PREFIX(org.mule.runtime.internal.dsl.DslConstants.EE_PREFIX) ComponentIdentifier.builder(org.mule.runtime.api.component.ComponentIdentifier.builder) NON_REPEATABLE_OBJECTS_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.NON_REPEATABLE_OBJECTS_STREAM_ALIAS) ExtensionModelUtils.isRequired(org.mule.runtime.extension.api.util.ExtensionModelUtils.isRequired) Optional.empty(java.util.Optional.empty) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) CronScheduler(org.mule.runtime.core.api.source.scheduler.CronScheduler) CRON_STRATEGY_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.CRON_STRATEGY_ELEMENT_IDENTIFIER) REPEATABLE_IN_MEMORY_OBJECTS_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.REPEATABLE_IN_MEMORY_OBJECTS_STREAM_ALIAS) HasConstructModels(org.mule.runtime.api.meta.model.construct.HasConstructModels) ExtensionsTypeLoaderFactory(org.mule.runtime.extension.api.declaration.type.ExtensionsTypeLoaderFactory) REPEATABLE_FILE_STORE_BYTES_STREAM_ALIAS(org.mule.runtime.extension.api.declaration.type.StreamingStrategyTypeBuilder.REPEATABLE_FILE_STORE_BYTES_STREAM_ALIAS) VALUE_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.VALUE_ATTRIBUTE_NAME) ComponentConfiguration(org.mule.runtime.dsl.api.component.config.ComponentConfiguration) Multimap(com.google.common.collect.Multimap) Deque(java.util.Deque) EXPIRATION_POLICY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.EXPIRATION_POLICY_PARAMETER_NAME) ExtensionModelUtils.getDefaultValue(org.mule.runtime.extension.api.util.ExtensionModelUtils.getDefaultValue) Stream.concat(java.util.stream.Stream.concat) ParameterizedModel(org.mule.runtime.api.meta.model.parameter.ParameterizedModel) Iterator(java.util.Iterator) ConfigurationModel(org.mule.runtime.api.meta.model.config.ConfigurationModel) RECONNECTION_CONFIG_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.RECONNECTION_CONFIG_PARAMETER_NAME) FixedFrequencyScheduler(org.mule.runtime.core.api.source.scheduler.FixedFrequencyScheduler) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) DslElementModel(org.mule.runtime.config.api.dsl.model.DslElementModel) Collectors.toList(java.util.stream.Collectors.toList) STREAMING_STRATEGY_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.STREAMING_STRATEGY_PARAMETER_NAME) StringUtils.isBlank(org.apache.commons.lang3.StringUtils.isBlank) ExtensionWalker(org.mule.runtime.api.meta.model.util.ExtensionWalker) Reference(org.mule.runtime.api.util.Reference) SCHEDULING_STRATEGY_ELEMENT_IDENTIFIER(org.mule.runtime.internal.dsl.DslConstants.SCHEDULING_STRATEGY_ELEMENT_IDENTIFIER) ComponentIdentifier(org.mule.runtime.api.component.ComponentIdentifier) ArrayDeque(java.util.ArrayDeque) HasSourceModels(org.mule.runtime.api.meta.model.source.HasSourceModels) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) DslElementModel(org.mule.runtime.config.api.dsl.model.DslElementModel) NestedRouteModel(org.mule.runtime.api.meta.model.nested.NestedRouteModel) NestableElementModel(org.mule.runtime.api.meta.model.nested.NestableElementModel)

Example 9 with ParameterizedModel

use of org.mule.runtime.api.meta.model.parameter.ParameterizedModel in project mule by mulesoft.

the class ValueProviderModelValidator method validateModel.

private void validateModel(ParameterizedModel model, ProblemsReporter problemsReporter, boolean supportsConnectionsAndConfigs) {
    ReflectionCache reflectionCache = new ReflectionCache();
    model.getAllParameterModels().forEach(param -> param.getModelProperty(ValueProviderFactoryModelProperty.class).ifPresent(modelProperty -> validateOptionsResolver(param, modelProperty, model, problemsReporter, supportsConnectionsAndConfigs, reflectionCache)));
}
Also used : ValueProviderFactoryModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ValueProviderFactoryModelProperty) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) ConnectionProviderModel(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel) ValueProviderModel(org.mule.runtime.api.meta.model.parameter.ValueProviderModel) IntrospectionUtils(org.mule.runtime.module.extension.internal.util.IntrospectionUtils) ValueProvider(org.mule.runtime.extension.api.values.ValueProvider) SourceModel(org.mule.runtime.api.meta.model.source.SourceModel) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) IntrospectionUtils.isInstantiable(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.isInstantiable) IdempotentExtensionWalker(org.mule.runtime.api.meta.model.util.IdempotentExtensionWalker) Problem(org.mule.runtime.extension.api.loader.Problem) ConnectableComponentModel(org.mule.runtime.api.meta.model.ConnectableComponentModel) ExtensionModelValidator(org.mule.runtime.extension.api.loader.ExtensionModelValidator) ParameterizedModel(org.mule.runtime.api.meta.model.parameter.ParameterizedModel) ProblemsReporter(org.mule.runtime.extension.api.loader.ProblemsReporter) NameUtils(org.mule.runtime.extension.api.util.NameUtils) ReflectionCache(org.mule.runtime.module.extension.internal.util.ReflectionCache) ConfigurationModel(org.mule.runtime.api.meta.model.config.ConfigurationModel) InjectableParameterInfo(org.mule.runtime.module.extension.internal.loader.java.property.ValueProviderFactoryModelProperty.InjectableParameterInfo) String.format(java.lang.String.format) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) ExtensionMetadataTypeUtils.getType(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.getType) StringType(org.mule.metadata.api.model.StringType) MetadataType(org.mule.metadata.api.model.MetadataType) ReflectionCache(org.mule.runtime.module.extension.internal.util.ReflectionCache)

Example 10 with ParameterizedModel

use of org.mule.runtime.api.meta.model.parameter.ParameterizedModel in project mule by mulesoft.

the class IntrospectionUtils method getParameterClasses.

/**
 * Traverses through all the {@link ParameterModel}s of the {@code extensionModel} and returns the {@link Class classes} that
 * are modeled by each parameter's {@link ParameterModel#getType()}.
 * <p>
 * This includes every single {@link ParameterModel} in the model, including configs, providers, operations, etc.
 *
 * @param extensionModel a {@link ExtensionModel}
 * @return a non {@code null} {@link Set}
 */
public static Set<Class<?>> getParameterClasses(ExtensionModel extensionModel, ClassLoader extensionClassLoader) {
    Set<Class<?>> parameterClasses = new HashSet<>();
    new ExtensionWalker() {

        @Override
        public void onParameter(ParameterizedModel owner, ParameterGroupModel groupModel, ParameterModel model) {
            parameterClasses.addAll(collectRelativeClasses(model.getType(), extensionClassLoader));
        }
    }.walk(extensionModel);
    return parameterClasses;
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) ParameterizedModel(org.mule.runtime.api.meta.model.parameter.ParameterizedModel) ExtensionWalker(org.mule.runtime.api.meta.model.util.ExtensionWalker) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) LinkedHashSet(java.util.LinkedHashSet) HashSet(java.util.HashSet)

Aggregations

ParameterizedModel (org.mule.runtime.api.meta.model.parameter.ParameterizedModel)10 ParameterGroupModel (org.mule.runtime.api.meta.model.parameter.ParameterGroupModel)9 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)9 ExtensionWalker (org.mule.runtime.api.meta.model.util.ExtensionWalker)7 List (java.util.List)6 MetadataType (org.mule.metadata.api.model.MetadataType)6 ObjectType (org.mule.metadata.api.model.ObjectType)6 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)6 SourceModel (org.mule.runtime.api.meta.model.source.SourceModel)6 Map (java.util.Map)5 Optional (java.util.Optional)5 Set (java.util.Set)5 Collectors.toList (java.util.stream.Collectors.toList)5 MetadataTypeUtils.getLocalPart (org.mule.metadata.api.utils.MetadataTypeUtils.getLocalPart)5 MetadataTypeVisitor (org.mule.metadata.api.visitor.MetadataTypeVisitor)5 ConfigurationModel (org.mule.runtime.api.meta.model.config.ConfigurationModel)5 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)5 String.format (java.lang.String.format)4 StringUtils.isBlank (org.apache.commons.lang3.StringUtils.isBlank)4 ArrayType (org.mule.metadata.api.model.ArrayType)4