Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W-17050998: Cleaning up privileged APIs no longer needed. #14054

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/extensions-support/api-changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -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<java.util.Optional<org.mule.runtime.extension.api.runtime.config.ConfigurationInstance>>, org.mule.runtime.core.api.connector.ConnectionManager, org.mule.runtime.api.metadata.MetadataCache, org.mule.metadata.api.ClassTypeLoader, java.util.Optional<org.mule.runtime.api.metadata.ScopeOutputMetadataContext>, java.util.Optional<org.mule.runtime.api.metadata.RouterOutputMetadataContext>, java.util.Optional<org.mule.metadata.message.api.el.TypeBindings>)",
"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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -145,15 +144,6 @@ MetadataContext createMetadataContext(Supplier<Optional<ConfigurationInstance>>
Optional<ScopeOutputMetadataContext> scopeOutputMetadataContext,
Optional<RouterOutputMetadataContext> routerOutputMetadataContext);

/**
* Creates a new instance of a {@link MetadataContext}.
*/
MetadataContext createMetadataContext(Supplier<Optional<ConfigurationInstance>> configurationSupplier,
ConnectionManager connectionManager, MetadataCache cache, ClassTypeLoader typeLoader,
Optional<ScopeOutputMetadataContext> scopeOutputMetadataContext,
Optional<RouterOutputMetadataContext> routerOutputMetadataContext,
Optional<TypeBindings> typeBindings);

/**
* Creates a new instance of a {@link MetadataMediator}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ScopeOutputMetadataContext> scopePropagationContext;
private final Optional<RouterOutputMetadataContext> routerPropagationContext;
private final Optional<ExpressionLanguageMetadataService> expressionLanguageMetadataService;
private final Optional<TypeBindings> typeBindings;

/**
* Retrieves the configuration for the related component
Expand Down Expand Up @@ -74,37 +67,11 @@ public DefaultMetadataContext(Supplier<Optional<ConfigurationInstance>> configur
ConnectionManager connectionManager, MetadataCache cache, ClassTypeLoader typeLoader,
Optional<ScopeOutputMetadataContext> scopePropagationContext,
Optional<RouterOutputMetadataContext> 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<Optional<ConfigurationInstance>> configurationSupplier,
ConnectionManager connectionManager, MetadataCache cache, ClassTypeLoader typeLoader,
ExpressionLanguageMetadataService expressionLanguageMetadataService,
Optional<ScopeOutputMetadataContext> scopePropagationContext,
Optional<RouterOutputMetadataContext> routerPropagationContext,
Optional<TypeBindings> typeBindings) {
super(configurationSupplier, connectionManager);
this.cache = cache;
this.classTypeLoader = typeLoader;
this.expressionLanguageMetadataService = ofNullable(expressionLanguageMetadataService);
this.scopePropagationContext = scopePropagationContext;
this.routerPropagationContext = routerPropagationContext;
this.typeBindings = typeBindings;
}

/**
Expand Down Expand Up @@ -140,14 +107,4 @@ public ClassTypeLoader getTypeLoader() {
public BaseTypeBuilder getTypeBuilder() {
return BaseTypeBuilder.create(JAVA);
}

@Override
public Optional<ExpressionLanguageMetadataService> getExpressionLanguageMetadataService() {
return expressionLanguageMetadataService;
}

@Override
public Optional<TypeBindings> getTypeBindings() {
return typeBindings;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -71,20 +68,4 @@ public Optional<RouterOutputMetadataContext> getRouterOutputMetadataContext() {
public <C> Optional<C> getConfig() {
return empty();
}

@Override
public Optional<ExpressionLanguageMetadataService> getExpressionLanguageMetadataService() {
if (delegate instanceof SdkMetadataContextAdapter) {
return ((SdkMetadataContextAdapter) delegate).getExpressionLanguageMetadataService();
}
return empty();
}

@Override
public Optional<TypeBindings> getTypeBindings() {
if (delegate instanceof SdkMetadataContextAdapter) {
return ((SdkMetadataContextAdapter) delegate).getTypeBindings();
}
return empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -69,20 +67,6 @@ public Optional<RouterOutputMetadataContext> getRouterOutputMetadataContext() {
return delegate.getRouterOutputMetadataContext().map(SdkRouterOutputMetadataContextAdapter::new);
}

public Optional<ExpressionLanguageMetadataService> getExpressionLanguageMetadataService() {
if (delegate instanceof org.mule.runtime.privileged.metadata.InternalMetadataContext) {
return ((org.mule.runtime.privileged.metadata.InternalMetadataContext) delegate).getExpressionLanguageMetadataService();
}
return Optional.empty();
}

public Optional<TypeBindings> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +31,7 @@
*
* @since 4.7.0
*/
public class DefaultChainInputMetadataContext implements ChainInputMetadataContext, InternalMetadataContext {
public class DefaultChainInputMetadataContext implements ChainInputMetadataContext {

private final Supplier<MessageMetadataType> inputMessageMetadataType;
private final InputMetadataDescriptor inputMetadataDescriptor;
Expand Down Expand Up @@ -108,18 +105,4 @@ public Optional<RouterOutputMetadataContext> getRouterOutputMetadataContext() {
public Optional<ScopeOutputMetadataContext> getScopeOutputMetadataContext() {
return rootContext.getScopeOutputMetadataContext();
}

public Optional<ExpressionLanguageMetadataService> getExpressionLanguageMetadataService() {
if (rootContext instanceof InternalMetadataContext) {
return ((InternalMetadataContext) rootContext).getExpressionLanguageMetadataService();
}
return Optional.empty();
}

public Optional<TypeBindings> getTypeBindings() {
if (rootContext instanceof InternalMetadataContext) {
return ((InternalMetadataContext) rootContext).getTypeBindings();
}
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -87,9 +85,6 @@ public class DefaultExtensionDesignTimeResolversFactory implements ExtensionDesi
@Inject
private ExpressionManager expressionManager;

@Inject
private ExpressionLanguageMetadataService expressionLanguageMetadataService;

@Inject
private Registry registry;

Expand Down Expand Up @@ -281,18 +276,6 @@ public MetadataContext createMetadataContext(Supplier<Optional<ConfigurationInst
routerOutputMetadataContext);
}

@Override
public MetadataContext createMetadataContext(Supplier<Optional<ConfigurationInstance>> configurationSupplier,
ConnectionManager connectionManager, MetadataCache cache,
ClassTypeLoader typeLoader,
Optional<ScopeOutputMetadataContext> scopeOutputMetadataContext,
Optional<RouterOutputMetadataContext> routerOutputMetadataContext,
Optional<TypeBindings> typeBindings) {
return new DefaultMetadataContext(configurationSupplier, connectionManager, cache, typeLoader,
expressionLanguageMetadataService,
scopeOutputMetadataContext, routerOutputMetadataContext, typeBindings);
}

@Override
public <CM extends ComponentModel> MetadataMediator createMetadataMediator(CM componentModel) {
return new DefaultMetadataMediator<>(componentModel,
Expand Down