diff --git a/modules/extensions-support/api-changes.json b/modules/extensions-support/api-changes.json index a0a712f18f81..54a54d0f697d 100644 --- a/modules/extensions-support/api-changes.json +++ b/modules/extensions-support/api-changes.json @@ -3,6 +3,12 @@ "revapi": { "differences": { "differences": [ + { + "ignore": true, + "code": "java.method.removed", + "old": "method org.mule.runtime.api.metadata.MetadataContext org.mule.runtime.module.extension.api.runtime.config.ExtensionDesignTimeResolversFactory::createMetadataContext(java.util.function.Supplier>, org.mule.runtime.core.api.connector.ConnectionManager, org.mule.runtime.api.metadata.MetadataCache, org.mule.metadata.api.ClassTypeLoader, java.util.Optional, java.util.Optional, java.util.Optional)", + "justification": "W-17050998: Cleanup, removing things not needed from the API. API still experimental, only used by the Mule Framework." + }, { "ignore": true, "code": "java.method.numberOfParametersChanged", diff --git a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/api/runtime/config/ExtensionDesignTimeResolversFactory.java b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/api/runtime/config/ExtensionDesignTimeResolversFactory.java index fdbc092cb969..ccabc9523861 100644 --- a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/api/runtime/config/ExtensionDesignTimeResolversFactory.java +++ b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/api/runtime/config/ExtensionDesignTimeResolversFactory.java @@ -7,7 +7,6 @@ package org.mule.runtime.module.extension.api.runtime.config; import org.mule.metadata.api.ClassTypeLoader; -import org.mule.metadata.message.api.el.TypeBindings; import org.mule.runtime.api.component.Component; import org.mule.runtime.api.component.ConfigurationProperties; import org.mule.runtime.api.config.PoolingProfile; @@ -145,15 +144,6 @@ MetadataContext createMetadataContext(Supplier> Optional scopeOutputMetadataContext, Optional routerOutputMetadataContext); - /** - * Creates a new instance of a {@link MetadataContext}. - */ - MetadataContext createMetadataContext(Supplier> configurationSupplier, - ConnectionManager connectionManager, MetadataCache cache, ClassTypeLoader typeLoader, - Optional scopeOutputMetadataContext, - Optional routerOutputMetadataContext, - Optional typeBindings); - /** * Creates a new instance of a {@link MetadataMediator}. */ diff --git a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/DefaultMetadataContext.java b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/DefaultMetadataContext.java index c25e80f498c5..bfb2e22b877b 100644 --- a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/DefaultMetadataContext.java +++ b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/DefaultMetadataContext.java @@ -9,19 +9,15 @@ import static org.mule.metadata.api.model.MetadataFormat.JAVA; import static java.util.Optional.empty; -import static java.util.Optional.ofNullable; import org.mule.metadata.api.ClassTypeLoader; import org.mule.metadata.api.builder.BaseTypeBuilder; -import org.mule.metadata.message.api.el.TypeBindings; -import org.mule.runtime.api.metadata.ExpressionLanguageMetadataService; -import org.mule.runtime.api.metadata.ScopeOutputMetadataContext; import org.mule.runtime.api.metadata.MetadataCache; import org.mule.runtime.api.metadata.MetadataContext; import org.mule.runtime.api.metadata.RouterOutputMetadataContext; +import org.mule.runtime.api.metadata.ScopeOutputMetadataContext; import org.mule.runtime.core.api.connector.ConnectionManager; import org.mule.runtime.extension.api.runtime.config.ConfigurationInstance; -import org.mule.runtime.privileged.metadata.InternalMetadataContext; import org.mule.runtime.module.extension.internal.ExtensionResolvingContext; import java.util.Optional; @@ -33,15 +29,12 @@ * * @since 4.0 */ -public class DefaultMetadataContext extends ExtensionResolvingContext implements ConnectionProviderAwareMetadataContext, - InternalMetadataContext { +public class DefaultMetadataContext extends ExtensionResolvingContext implements ConnectionProviderAwareMetadataContext { private final MetadataCache cache; private final ClassTypeLoader classTypeLoader; private final Optional scopePropagationContext; private final Optional routerPropagationContext; - private final Optional expressionLanguageMetadataService; - private final Optional typeBindings; /** * Retrieves the configuration for the related component @@ -74,37 +67,11 @@ public DefaultMetadataContext(Supplier> configur ConnectionManager connectionManager, MetadataCache cache, ClassTypeLoader typeLoader, Optional scopePropagationContext, Optional routerPropagationContext) { - this(configurationSupplier, connectionManager, cache, typeLoader, null, scopePropagationContext, routerPropagationContext, - empty()); - } - - /** - * Retrieves the configuration for the related component - * - * @param configurationSupplier Supplier of optional configurations - * @param connectionManager {@link ConnectionManager} which is able to find a connection for the component using the - * {@param configInstance} - * @param cache instance of the {@link MetadataCache} for this context - * @param typeLoader instance of a {@link ClassTypeLoader} in the context of this extension - * @param scopePropagationContext an optional {@link ScopeOutputMetadataContext} for the inner chain. Value is only present for - * scope components - * @param routerPropagationContext an optional {@link RouterOutputMetadataContext} with routes information. Value is only - * present for router components - * @since 4.8 - */ - public DefaultMetadataContext(Supplier> configurationSupplier, - ConnectionManager connectionManager, MetadataCache cache, ClassTypeLoader typeLoader, - ExpressionLanguageMetadataService expressionLanguageMetadataService, - Optional scopePropagationContext, - Optional routerPropagationContext, - Optional typeBindings) { super(configurationSupplier, connectionManager); this.cache = cache; this.classTypeLoader = typeLoader; - this.expressionLanguageMetadataService = ofNullable(expressionLanguageMetadataService); this.scopePropagationContext = scopePropagationContext; this.routerPropagationContext = routerPropagationContext; - this.typeBindings = typeBindings; } /** @@ -140,14 +107,4 @@ public ClassTypeLoader getTypeLoader() { public BaseTypeBuilder getTypeBuilder() { return BaseTypeBuilder.create(JAVA); } - - @Override - public Optional getExpressionLanguageMetadataService() { - return expressionLanguageMetadataService; - } - - @Override - public Optional getTypeBindings() { - return typeBindings; - } } diff --git a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/InternalMetadataContext.java b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/InternalMetadataContext.java deleted file mode 100644 index ef82934f58c8..000000000000 --- a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/InternalMetadataContext.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - * The software in this package is published under the terms of the CPAL v1.0 - * license, a copy of which has been included with this distribution in the - * LICENSE.txt file. - */ -package org.mule.runtime.module.extension.internal.metadata; - -import org.mule.metadata.api.model.MetadataType; -import org.mule.metadata.message.api.el.TypeBindings; -import org.mule.runtime.api.metadata.ExpressionLanguageMetadataService; -import org.mule.sdk.api.metadata.MetadataContext; - -import java.util.Optional; - - -/** - * A {@link MetadataContext} with additional capabilities, for internal use only. - * - * @since 4.8.0 - */ -public interface InternalMetadataContext extends MetadataContext { - - /** - * @return the {@link ExpressionLanguageMetadataService}, if available. - */ - Optional getExpressionLanguageMetadataService(); - - /** - * Allows for specifying the {@link MetadataType}s of the different bindings provided to the expression language. - *

- * Examples could be payload, attributes, variables, errors and even module definitions. - *

- * This, in combination with the {@link ExpressionLanguageMetadataService}, can be used by a type resolver to provide more - * precise information about the types involved in an expression. - * - * @return the {@link TypeBindings} in context, if available. - */ - Optional getTypeBindings(); -} diff --git a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/MuleMetadataContextAdapter.java b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/MuleMetadataContextAdapter.java index cf7cfa21a80d..806928e87ada 100644 --- a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/MuleMetadataContextAdapter.java +++ b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/MuleMetadataContextAdapter.java @@ -10,19 +10,16 @@ import org.mule.metadata.api.ClassTypeLoader; import org.mule.metadata.api.builder.BaseTypeBuilder; -import org.mule.metadata.message.api.el.TypeBindings; import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.ExpressionLanguageMetadataService; import org.mule.runtime.api.metadata.ScopeOutputMetadataContext; import org.mule.runtime.api.metadata.RouterOutputMetadataContext; import org.mule.runtime.module.extension.internal.metadata.SdkMetadataContextAdapter.SdkRouterOutputMetadataContextAdapter; import org.mule.runtime.module.extension.internal.metadata.SdkMetadataContextAdapter.SdkScopeOutputMetadataContext; -import org.mule.runtime.privileged.metadata.InternalMetadataContext; import org.mule.sdk.api.metadata.MetadataContext; import java.util.Optional; -public class MuleMetadataContextAdapter implements org.mule.runtime.api.metadata.MetadataContext, InternalMetadataContext { +public class MuleMetadataContextAdapter implements org.mule.runtime.api.metadata.MetadataContext { private final MetadataContext delegate; @@ -71,20 +68,4 @@ public Optional getRouterOutputMetadataContext() { public Optional getConfig() { return empty(); } - - @Override - public Optional getExpressionLanguageMetadataService() { - if (delegate instanceof SdkMetadataContextAdapter) { - return ((SdkMetadataContextAdapter) delegate).getExpressionLanguageMetadataService(); - } - return empty(); - } - - @Override - public Optional getTypeBindings() { - if (delegate instanceof SdkMetadataContextAdapter) { - return ((SdkMetadataContextAdapter) delegate).getTypeBindings(); - } - return empty(); - } } diff --git a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/SdkMetadataContextAdapter.java b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/SdkMetadataContextAdapter.java index f47e8876c0b0..46b200247130 100644 --- a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/SdkMetadataContextAdapter.java +++ b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/SdkMetadataContextAdapter.java @@ -9,9 +9,7 @@ import org.mule.metadata.api.ClassTypeLoader; import org.mule.metadata.api.builder.BaseTypeBuilder; import org.mule.metadata.message.api.MessageMetadataType; -import org.mule.metadata.message.api.el.TypeBindings; import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.ExpressionLanguageMetadataService; import org.mule.sdk.api.metadata.MetadataCache; import org.mule.sdk.api.metadata.MetadataContext; import org.mule.sdk.api.metadata.RouterOutputMetadataContext; @@ -26,7 +24,7 @@ * * @since 4.7.0 */ -public class SdkMetadataContextAdapter implements InternalMetadataContext { +public class SdkMetadataContextAdapter implements MetadataContext { private final org.mule.runtime.api.metadata.MetadataContext delegate; @@ -69,20 +67,6 @@ public Optional getRouterOutputMetadataContext() { return delegate.getRouterOutputMetadataContext().map(SdkRouterOutputMetadataContextAdapter::new); } - public Optional getExpressionLanguageMetadataService() { - if (delegate instanceof org.mule.runtime.privileged.metadata.InternalMetadataContext) { - return ((org.mule.runtime.privileged.metadata.InternalMetadataContext) delegate).getExpressionLanguageMetadataService(); - } - return Optional.empty(); - } - - public Optional getTypeBindings() { - if (delegate instanceof org.mule.runtime.privileged.metadata.InternalMetadataContext) { - return ((org.mule.runtime.privileged.metadata.InternalMetadataContext) delegate).getTypeBindings(); - } - return Optional.empty(); - } - static class SdkScopeOutputMetadataContext implements ScopeOutputMetadataContext { private final org.mule.runtime.api.metadata.ScopeOutputMetadataContext delegate; diff --git a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/chain/DefaultChainInputMetadataContext.java b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/chain/DefaultChainInputMetadataContext.java index 6b0ab9a0d3dc..a88686f594f7 100644 --- a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/chain/DefaultChainInputMetadataContext.java +++ b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/metadata/chain/DefaultChainInputMetadataContext.java @@ -10,14 +10,11 @@ import org.mule.metadata.api.builder.BaseTypeBuilder; import org.mule.metadata.api.model.MetadataType; import org.mule.metadata.message.api.MessageMetadataType; -import org.mule.metadata.message.api.el.TypeBindings; import org.mule.runtime.api.connection.ConnectionException; -import org.mule.runtime.api.metadata.ExpressionLanguageMetadataService; import org.mule.runtime.api.metadata.MetadataResolvingException; import org.mule.runtime.api.metadata.descriptor.InputMetadataDescriptor; import org.mule.runtime.api.util.LazyValue; import org.mule.runtime.module.extension.api.metadata.PropagatedParameterTypeResolver; -import org.mule.runtime.module.extension.internal.metadata.InternalMetadataContext; import org.mule.runtime.module.extension.internal.metadata.SdkMetadataContextAdapter; import org.mule.sdk.api.metadata.ChainInputMetadataContext; import org.mule.sdk.api.metadata.MetadataCache; @@ -34,7 +31,7 @@ * * @since 4.7.0 */ -public class DefaultChainInputMetadataContext implements ChainInputMetadataContext, InternalMetadataContext { +public class DefaultChainInputMetadataContext implements ChainInputMetadataContext { private final Supplier inputMessageMetadataType; private final InputMetadataDescriptor inputMetadataDescriptor; @@ -108,18 +105,4 @@ public Optional getRouterOutputMetadataContext() { public Optional getScopeOutputMetadataContext() { return rootContext.getScopeOutputMetadataContext(); } - - public Optional getExpressionLanguageMetadataService() { - if (rootContext instanceof InternalMetadataContext) { - return ((InternalMetadataContext) rootContext).getExpressionLanguageMetadataService(); - } - return Optional.empty(); - } - - public Optional getTypeBindings() { - if (rootContext instanceof InternalMetadataContext) { - return ((InternalMetadataContext) rootContext).getTypeBindings(); - } - return Optional.empty(); - } } diff --git a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/runtime/config/DefaultExtensionDesignTimeResolversFactory.java b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/runtime/config/DefaultExtensionDesignTimeResolversFactory.java index c33fb129538d..dc1335218a50 100644 --- a/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/runtime/config/DefaultExtensionDesignTimeResolversFactory.java +++ b/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/runtime/config/DefaultExtensionDesignTimeResolversFactory.java @@ -14,7 +14,6 @@ import static java.util.stream.Collectors.toMap; import org.mule.metadata.api.ClassTypeLoader; -import org.mule.metadata.message.api.el.TypeBindings; import org.mule.runtime.api.artifact.Registry; import org.mule.runtime.api.component.Component; import org.mule.runtime.api.component.ConfigurationProperties; @@ -28,7 +27,6 @@ import org.mule.runtime.api.meta.model.connection.ConnectionProviderModel; import org.mule.runtime.api.meta.model.parameter.ParameterModel; import org.mule.runtime.api.meta.model.parameter.ParameterizedModel; -import org.mule.runtime.api.metadata.ExpressionLanguageMetadataService; import org.mule.runtime.api.metadata.MetadataCache; import org.mule.runtime.api.metadata.MetadataContext; import org.mule.runtime.api.metadata.RouterOutputMetadataContext; @@ -87,9 +85,6 @@ public class DefaultExtensionDesignTimeResolversFactory implements ExtensionDesi @Inject private ExpressionManager expressionManager; - @Inject - private ExpressionLanguageMetadataService expressionLanguageMetadataService; - @Inject private Registry registry; @@ -281,18 +276,6 @@ public MetadataContext createMetadataContext(Supplier> configurationSupplier, - ConnectionManager connectionManager, MetadataCache cache, - ClassTypeLoader typeLoader, - Optional scopeOutputMetadataContext, - Optional routerOutputMetadataContext, - Optional typeBindings) { - return new DefaultMetadataContext(configurationSupplier, connectionManager, cache, typeLoader, - expressionLanguageMetadataService, - scopeOutputMetadataContext, routerOutputMetadataContext, typeBindings); - } - @Override public MetadataMediator createMetadataMediator(CM componentModel) { return new DefaultMetadataMediator<>(componentModel,