Search in sources :

Example 1 with DefaultObjectParsingDelegate

use of org.mule.runtime.module.extension.internal.config.dsl.object.DefaultObjectParsingDelegate in project mule by mulesoft.

the class ExtensionDefinitionParser method parseRoute.

private void parseRoute(NestedRouteModel routeModel) {
    DslElementSyntax routeDsl = dslResolver.resolve(routeModel);
    Class<?> type = routeModel.getModelProperty(ImplementingTypeModelProperty.class).map(ImplementingTypeModelProperty::getType).orElseThrow(() -> new IllegalStateException("Missing route information"));
    MetadataType metadataType = typeLoader.load(type);
    addParameter(getChildKey(routeModel.getName()), new DefaultObjectParsingDelegate().parse(routeModel.getName(), (ObjectType) metadataType, routeDsl));
    try {
        new RouteComponentParser(baseDefinitionBuilder, routeModel, metadataType, getContextClassLoader(), routeDsl, dslResolver, parsingContext).parse().forEach(this::addDefinition);
    } catch (Exception e) {
        throw new MuleRuntimeException(new ConfigurationException(e));
    }
}
Also used : ObjectType(org.mule.metadata.api.model.ObjectType) ConfigurationException(org.mule.runtime.core.api.config.ConfigurationException) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) DefaultObjectParsingDelegate(org.mule.runtime.module.extension.internal.config.dsl.object.DefaultObjectParsingDelegate) MetadataType(org.mule.metadata.api.model.MetadataType) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) RouteComponentParser(org.mule.runtime.module.extension.internal.config.dsl.construct.RouteComponentParser) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) DateTimeParseException(java.time.format.DateTimeParseException) ConfigurationException(org.mule.runtime.core.api.config.ConfigurationException)

Example 2 with DefaultObjectParsingDelegate

use of org.mule.runtime.module.extension.internal.config.dsl.object.DefaultObjectParsingDelegate in project mule by mulesoft.

the class ExtensionDefinitionParser method parseInlineParameterGroup.

protected void parseInlineParameterGroup(ParameterGroupModel group) throws ConfigurationException {
    ParameterGroupDescriptor descriptor = group.getModelProperty(ParameterGroupModelProperty.class).map(ParameterGroupModelProperty::getDescriptor).orElse(null);
    DslElementSyntax dslElementSyntax = dslResolver.resolveInline(group);
    if (descriptor != null) {
        addParameter(getChildKey(getContainerName(descriptor.getContainer())), new DefaultObjectParsingDelegate().parse("", null, dslElementSyntax));
        new TypedInlineParameterGroupParser(baseDefinitionBuilder, group, descriptor, getContextClassLoader(), dslElementSyntax, dslResolver, parsingContext).parse().forEach(this::addDefinition);
    } else {
        AttributeDefinition.Builder builder = fromChildConfiguration(Map.class);
        if (dslElementSyntax.isWrapped()) {
            builder.withWrapperIdentifier(dslElementSyntax.getElementName());
        } else {
            builder.withIdentifier(dslElementSyntax.getElementName());
        }
        addParameter(getChildKey(group.getName()), builder);
        new AnonymousInlineParameterGroupParser(baseDefinitionBuilder, group, getContextClassLoader(), dslElementSyntax, dslResolver, parsingContext).parse().forEach(this::addDefinition);
    }
}
Also used : TypedInlineParameterGroupParser(org.mule.runtime.module.extension.internal.config.dsl.parameter.TypedInlineParameterGroupParser) ParameterGroupDescriptor(org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) DefaultObjectParsingDelegate(org.mule.runtime.module.extension.internal.config.dsl.object.DefaultObjectParsingDelegate) AttributeDefinition(org.mule.runtime.dsl.api.component.AttributeDefinition) AnonymousInlineParameterGroupParser(org.mule.runtime.module.extension.internal.config.dsl.parameter.AnonymousInlineParameterGroupParser)

Aggregations

DslElementSyntax (org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax)2 DefaultObjectParsingDelegate (org.mule.runtime.module.extension.internal.config.dsl.object.DefaultObjectParsingDelegate)2 DateTimeParseException (java.time.format.DateTimeParseException)1 MetadataType (org.mule.metadata.api.model.MetadataType)1 ObjectType (org.mule.metadata.api.model.ObjectType)1 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 ConfigurationException (org.mule.runtime.core.api.config.ConfigurationException)1 AttributeDefinition (org.mule.runtime.dsl.api.component.AttributeDefinition)1 RouteComponentParser (org.mule.runtime.module.extension.internal.config.dsl.construct.RouteComponentParser)1 AnonymousInlineParameterGroupParser (org.mule.runtime.module.extension.internal.config.dsl.parameter.AnonymousInlineParameterGroupParser)1 TypedInlineParameterGroupParser (org.mule.runtime.module.extension.internal.config.dsl.parameter.TypedInlineParameterGroupParser)1 ParameterGroupDescriptor (org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor)1