Search in sources :

Example 6 with ExtensionType

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.

the class SchemaBuilder method registerParameters.

List<TopLevelElement> registerParameters(ExtensionType type, Collection<ParameterModel> parameterModels) {
    List<TopLevelElement> all = new ArrayList<>(parameterModels.size());
    getSortedParameterModels(parameterModels).stream().filter(p -> !p.getModelProperty(QNameModelProperty.class).isPresent()).forEach(parameterModel -> {
        DslElementSyntax paramDsl = dslResolver.resolve(parameterModel);
        declareAsParameter(parameterModel.getType(), type, parameterModel, paramDsl, all);
    });
    return all;
}
Also used : InfrastructureParameterModelProperty(org.mule.runtime.extension.api.property.InfrastructureParameterModelProperty) SCHEDULING_STRATEGY_ELEMENT(org.mule.runtime.config.internal.dsl.SchemaConstants.SCHEDULING_STRATEGY_ELEMENT) CORE_PREFIX(org.mule.runtime.internal.dsl.DslConstants.CORE_PREFIX) ENUM_TYPE_SUFFIX(org.mule.runtime.config.internal.dsl.SchemaConstants.ENUM_TYPE_SUFFIX) ImportedTypeModel(org.mule.runtime.api.meta.model.ImportedTypeModel) TLS_PARAMETER_NAME(org.mule.runtime.extension.api.ExtensionConstants.TLS_PARAMETER_NAME) ExtensionType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType) ArrayType(org.mule.metadata.api.model.ArrayType) Union(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Union) BigInteger(java.math.BigInteger) ClassTypeLoader(org.mule.metadata.api.ClassTypeLoader) StringUtils(org.mule.runtime.core.api.util.StringUtils) ParameterDslConfiguration(org.mule.runtime.api.meta.model.ParameterDslConfiguration) ExtensionModelUtils.isContent(org.mule.runtime.extension.api.util.ExtensionModelUtils.isContent) ExtensionMetadataTypeUtils.isMap(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.isMap) ObjectType(org.mule.metadata.api.model.ObjectType) ObjectStore(org.mule.runtime.api.store.ObjectStore) EE_SCHEMA_LOCATION(org.mule.runtime.config.internal.dsl.SchemaConstants.EE_SCHEMA_LOCATION) SchemaConstants(org.mule.runtime.config.internal.dsl.SchemaConstants) Set(java.util.Set) OperationTransactionalAction(org.mule.runtime.extension.api.tx.OperationTransactionalAction) USE_OPTIONAL(org.mule.runtime.config.internal.dsl.SchemaConstants.USE_OPTIONAL) MetadataTypeVisitor(org.mule.metadata.api.visitor.MetadataTypeVisitor) Attribute(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Attribute) EnumAnnotation(org.mule.metadata.api.annotation.EnumAnnotation) StringUtils.isNotBlank(org.apache.commons.lang3.StringUtils.isNotBlank) StringType(org.mule.metadata.api.model.StringType) LocalComplexType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType) USE_REQUIRED(org.mule.runtime.config.internal.dsl.SchemaConstants.USE_REQUIRED) ParameterModelComparator(org.mule.runtime.extension.api.util.ParameterModelComparator) SPRING_FRAMEWORK_SCHEMA_LOCATION(org.mule.runtime.config.internal.dsl.SchemaConstants.SPRING_FRAMEWORK_SCHEMA_LOCATION) MetadataType(org.mule.metadata.api.model.MetadataType) DslSyntaxResolver(org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver) Import(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Import) QName(javax.xml.namespace.QName) ZERO(java.math.BigInteger.ZERO) FormChoice(org.mule.runtime.module.extension.internal.capability.xml.schema.model.FormChoice) ConnectionProviderModel(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel) ExtensionsTypeLoaderFactory(org.mule.runtime.extension.api.declaration.type.ExtensionsTypeLoaderFactory) VALUE_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.VALUE_ATTRIBUTE_NAME) ObjectTypeSchemaDelegate.getAbstractElementName(org.mule.runtime.module.extension.internal.capability.xml.schema.builder.ObjectTypeSchemaDelegate.getAbstractElementName) CORE_NAMESPACE(org.mule.runtime.internal.dsl.DslConstants.CORE_NAMESPACE) TLS_CONTEXT_TYPE(org.mule.runtime.config.internal.dsl.SchemaConstants.TLS_CONTEXT_TYPE) ArrayList(java.util.ArrayList) MULE_TLS_NAMESPACE(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_TLS_NAMESPACE) SPRING_FRAMEWORK_NAMESPACE(org.mule.runtime.config.internal.dsl.SchemaConstants.SPRING_FRAMEWORK_NAMESPACE) MULE_SCHEMA_LOCATION(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_SCHEMA_LOCATION) XML_NAMESPACE(org.mule.runtime.config.internal.dsl.SchemaConstants.XML_NAMESPACE) TopLevelSimpleType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelSimpleType) LinkedHashSet(java.util.LinkedHashSet) ParameterizedModel(org.mule.runtime.api.meta.model.parameter.ParameterizedModel) ExplicitGroup(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExplicitGroup) JAXBElement(javax.xml.bind.JAXBElement) ConfigurationModel(org.mule.runtime.api.meta.model.config.ConfigurationModel) TransactionType(org.mule.runtime.api.tx.TransactionType) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) STRING(org.mule.runtime.config.internal.dsl.SchemaConstants.STRING) NOT_SUPPORTED(org.mule.runtime.api.meta.ExpressionSupport.NOT_SUPPORTED) Documentation(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Documentation) PRIVATE_OBJECT_STORE_ELEMENT(org.mule.runtime.config.internal.dsl.SchemaConstants.PRIVATE_OBJECT_STORE_ELEMENT) MULE_TLS_SCHEMA_LOCATION(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_TLS_SCHEMA_LOCATION) SubstitutionGroup(org.mule.runtime.extension.api.declaration.type.annotation.SubstitutionGroup) ExtensionMetadataTypeUtils.getId(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.getId) ONE(java.math.BigInteger.ONE) MULE_TRANSACTION_TYPE(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_TRANSACTION_TYPE) Restriction(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Restriction) QNameModelProperty(org.mule.runtime.extension.api.property.QNameModelProperty) MAX_ONE(org.mule.runtime.config.internal.dsl.SchemaConstants.MAX_ONE) SourceModel(org.mule.runtime.api.meta.model.source.SourceModel) Collections.singleton(java.util.Collections.singleton) ExtensionModelUtils.componentHasAnImplicitConfiguration(org.mule.runtime.extension.api.util.ExtensionModelUtils.componentHasAnImplicitConfiguration) DslResolvingContext(org.mule.runtime.api.dsl.DslResolvingContext) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) SUPPORTED(org.mule.runtime.api.meta.ExpressionSupport.SUPPORTED) TopLevelElement(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement) Collection(java.util.Collection) String.format(java.lang.String.format) NAME_ATTRIBUTE_NAME(org.mule.runtime.internal.dsl.DslConstants.NAME_ATTRIBUTE_NAME) Objects(java.util.Objects) ExtensionMetadataTypeUtils.getSubstitutionGroup(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils.getSubstitutionGroup) List(java.util.List) NamedGroup(org.mule.runtime.module.extension.internal.capability.xml.schema.model.NamedGroup) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) XmlDslModel(org.mule.runtime.api.meta.model.XmlDslModel) Optional(java.util.Optional) EE_PREFIX(org.mule.runtime.internal.dsl.DslConstants.EE_PREFIX) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) EE_NAMESPACE(org.mule.runtime.internal.dsl.DslConstants.EE_NAMESPACE) Schema(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Schema) ComponentModel(org.mule.runtime.api.meta.model.ComponentModel) ObjectFactory(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ObjectFactory) TypeCatalog(org.mule.runtime.api.meta.type.TypeCatalog) LOCAL(org.mule.runtime.api.tx.TransactionType.LOCAL) EMPTY(org.apache.commons.lang3.StringUtils.EMPTY) NoFixedFacet(org.mule.runtime.module.extension.internal.capability.xml.schema.model.NoFixedFacet) Comparator.comparing(java.util.Comparator.comparing) LocalSimpleType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalSimpleType) LinkedList(java.util.LinkedList) ExpressionSupport(org.mule.runtime.api.meta.ExpressionSupport) SchemaTypeConversion(org.mule.runtime.module.extension.internal.capability.xml.schema.model.SchemaTypeConversion) ExtensionModelUtils(org.mule.runtime.extension.api.util.ExtensionModelUtils) MULE_ABSTRACT_EXTENSION_TYPE(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_ABSTRACT_EXTENSION_TYPE) ExtensionMetadataTypeUtils(org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils) MULE_OPERATION_TRANSACTIONAL_ACTION_TYPE(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_OPERATION_TRANSACTIONAL_ACTION_TYPE) NameUtils.sanitizeName(org.mule.runtime.extension.api.util.NameUtils.sanitizeName) Annotation(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Annotation) TopLevelElement(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) ArrayList(java.util.ArrayList)

Example 7 with ExtensionType

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.

the class ConfigurationSchemaDelegate method registerExtension.

private ExtensionType registerExtension(String name) {
    LocalComplexType complexType = new LocalComplexType();
    Element extension = new TopLevelElement();
    extension.setName(name);
    extension.setSubstitutionGroup(MULE_ABSTRACT_SHARED_EXTENSION);
    extension.setComplexType(complexType);
    ComplexContent complexContent = new ComplexContent();
    complexType.setComplexContent(complexContent);
    ExtensionType complexContentExtension = new ExtensionType();
    complexContentExtension.setBase(MULE_ABSTRACT_EXTENSION_TYPE);
    complexContent.setExtension(complexContentExtension);
    schema.getSimpleTypeOrComplexTypeOrGroup().add(extension);
    return complexContentExtension;
}
Also used : TopLevelElement(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement) TopLevelElement(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement) Element(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Element) ExtensionType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType) LocalComplexType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType) ComplexContent(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ComplexContent)

Example 8 with ExtensionType

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.

the class ExecutableTypeSchemaDelegate method createExecutableType.

protected ExtensionType createExecutableType(String name, QName base, DslElementSyntax dslSyntax, boolean hasImplicitConfig) {
    TopLevelComplexType complexType = new TopLevelComplexType();
    complexType.setName(name);
    ComplexContent complexContent = new ComplexContent();
    complexType.setComplexContent(complexContent);
    final ExtensionType complexContentExtension = new ExtensionType();
    complexContentExtension.setBase(base);
    complexContent.setExtension(complexContentExtension);
    if (dslSyntax.requiresConfig()) {
        Attribute configAttr = builder.createAttribute(CONFIG_ATTRIBUTE_NAME, CONFIG_ATTRIBUTE_DESCRIPTION, hasImplicitConfig, SUBSTITUTABLE_NAME);
        complexContentExtension.getAttributeOrAttributeGroup().add(configAttr);
    }
    this.builder.getSchema().getSimpleTypeOrComplexTypeOrGroup().add(complexType);
    return complexContentExtension;
}
Also used : TopLevelComplexType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelComplexType) Attribute(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Attribute) ExtensionType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType) ComplexContent(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ComplexContent)

Example 9 with ExtensionType

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.

the class ObjectTypeSchemaDelegate method createTypeExtension.

LocalComplexType createTypeExtension(QName base) {
    final LocalComplexType complexType = new LocalComplexType();
    ComplexContent complexContent = new ComplexContent();
    complexType.setComplexContent(complexContent);
    final ExtensionType extension = new ExtensionType();
    extension.setBase(base);
    complexContent.setExtension(extension);
    return complexType;
}
Also used : ExtensionType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType) LocalComplexType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType) ComplexContent(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ComplexContent)

Example 10 with ExtensionType

use of org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType in project mule by mulesoft.

the class SourceSchemaDelegate method registerSourceType.

private void registerSourceType(String name, SourceModel sourceModel, DslElementSyntax dslSyntax, boolean hasImplicitConfig) {
    final ExtensionType sourceType = createExecutableType(name, MULE_ABSTRACT_MESSAGE_SOURCE_TYPE, dslSyntax, hasImplicitConfig);
    initialiseSequence(sourceType);
    ExplicitGroup sequence = sourceType.getSequence();
    builder.addInfrastructureParameters(sourceType, sourceModel, sequence);
    List<ParameterModel> visitedParameters = new LinkedList<>();
    sourceModel.getParameterGroupModels().forEach(group -> {
        registerParameterGroup(sourceType, group);
        visitedParameters.addAll(group.getParameterModels());
    });
    sourceModel.getSuccessCallback().map(ParameterizedModel::getParameterGroupModels).ifPresent(groups -> groups.forEach(group -> registerCallbackParameters(sourceType, visitedParameters, group)));
    sourceModel.getErrorCallback().map(ParameterizedModel::getParameterGroupModels).ifPresent(groups -> groups.forEach(group -> registerCallbackParameters(sourceType, visitedParameters, group)));
}
Also used : TYPE_SUFFIX(org.mule.runtime.config.internal.dsl.SchemaConstants.TYPE_SUFFIX) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) StringUtils.capitalize(org.apache.commons.lang3.StringUtils.capitalize) ParameterizedModel(org.mule.runtime.api.meta.model.parameter.ParameterizedModel) ExplicitGroup(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExplicitGroup) TopLevelElement(org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement) ExtensionType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType) Element(org.mule.runtime.module.extension.internal.capability.xml.schema.model.Element) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) SourceModel(org.mule.runtime.api.meta.model.source.SourceModel) MULE_ABSTRACT_MESSAGE_SOURCE(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_ABSTRACT_MESSAGE_SOURCE) DslElementSyntax(org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax) MULE_ABSTRACT_MESSAGE_SOURCE_TYPE(org.mule.runtime.config.internal.dsl.SchemaConstants.MULE_ABSTRACT_MESSAGE_SOURCE_TYPE) ParameterGroupModel(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel) SOURCE(org.mule.runtime.extension.api.stereotype.MuleStereotypes.SOURCE) QName(javax.xml.namespace.QName) LinkedList(java.util.LinkedList) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) ExtensionType(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType) LinkedList(java.util.LinkedList) ExplicitGroup(org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExplicitGroup)

Aggregations

ExtensionType (org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExtensionType)10 ExplicitGroup (org.mule.runtime.module.extension.internal.capability.xml.schema.model.ExplicitGroup)6 TopLevelElement (org.mule.runtime.module.extension.internal.capability.xml.schema.model.TopLevelElement)6 ComplexContent (org.mule.runtime.module.extension.internal.capability.xml.schema.model.ComplexContent)5 LocalComplexType (org.mule.runtime.module.extension.internal.capability.xml.schema.model.LocalComplexType)4 LinkedList (java.util.LinkedList)3 DslElementSyntax (org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax)3 List (java.util.List)2 QName (javax.xml.namespace.QName)2 Element (org.mule.runtime.module.extension.internal.capability.xml.schema.model.Element)2 String.format (java.lang.String.format)1 BigInteger (java.math.BigInteger)1 ONE (java.math.BigInteger.ONE)1 ZERO (java.math.BigInteger.ZERO)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections.singleton (java.util.Collections.singleton)1 Comparator.comparing (java.util.Comparator.comparing)1 LinkedHashSet (java.util.LinkedHashSet)1 Objects (java.util.Objects)1