public class MuleExtensionUtils extends Object
extensions| Constructor and Description |
|---|
MuleExtensionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkParameterGroupExclusiveness(Optional<org.mule.runtime.api.meta.model.parameter.ParameterizedModel> model,
List<org.mule.runtime.api.meta.model.parameter.ParameterGroupModel> groups,
Map<String,?> parameters,
Map<String,String> aliasedParameterNames)
Checks the given
ParameterGroupModels against the given resolved parameters and validates that the group
exclusiveness is honored. |
static Optional<String> |
extractExpression(Object value)
Parse the given value and remove expression markers if it is considered as an expression.
|
static List<org.mule.runtime.api.meta.model.connection.ConnectionProviderModel> |
getAllConnectionProviders(org.mule.runtime.api.meta.model.ExtensionModel extensionModel,
org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel)
Returns all the
ConnectionProviderModel instances available for the given configurationModel plus the ones
globally defined at the extensionModel. |
static ClassLoader |
getClassLoader(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
If the
extensionModel contains a ClassLoaderModelProperty, then it returns the ClassLoader associated
to such property. |
static org.mule.runtime.extension.api.runtime.config.ConfigurationFactory |
getConfigurationFactory(org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel)
Tests the
configurationModel for a ConfigurationFactoryModelProperty and returns the contained
ConfigurationFactory. |
static org.mule.runtime.extension.api.runtime.connectivity.ConnectionProviderFactory |
getConnectionProviderFactory(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel connectionProviderModel)
Tests the given
connectionProviderModel for a ConnectionProviderFactoryModelProperty and if present it
returns the enclosed ConnectionProviderFactory. |
static Type |
getConnectionType(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel connectionProviderModel)
Tests the given
connectionProviderModel for a ConnectionTypeModelProperty and if present it returns the
enclosed connection type. |
static Optional<String> |
getDefaultValue(org.mule.sdk.api.annotation.param.Optional optionalAnnotation) |
static Optional<String> |
getDefaultValue(org.mule.runtime.extension.api.annotation.param.Optional optionalAnnotation) |
static String |
getExtensionsNamespace(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration extensionDeclaration) |
static String |
getExtensionsNamespace(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) |
static Optional<Class> |
getImplementingType(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel)
Tests the given
enrichableModel for a ImplementingTypeModelProperty and if present it returns the enclosed
implementing type. |
static String |
getImplicitConfigurationProviderName(org.mule.runtime.api.meta.model.ExtensionModel extensionModel,
org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel,
ArtifactType extendedArtifactType,
String extendedArtifactId,
org.mule.runtime.api.config.FeatureFlaggingService extendedArtifactFeatureFlaggingService)
Resolves the
ConfigurationProvider name for an extension. |
static <T extends org.mule.runtime.api.meta.model.ComponentModel> |
getLegacyOperationExecutorFactory(T operationModel)
Deprecated.
since 4.3. Use
getOperationExecutorFactory(ComponentModel) instead |
static org.mule.runtime.extension.api.metadata.MetadataResolverFactory |
getMetadataResolverFactory(org.mule.runtime.api.meta.model.EnrichableModel model)
Tests the given
model for a MetadataResolverFactoryModelProperty and if present it returns the contained
MetadataResolverFactory. |
static MutableConfigurationStats |
getMutableConfigurationStats(org.mule.runtime.extension.api.runtime.operation.ExecutionContext<?> context) |
static <T extends org.mule.runtime.api.meta.model.ComponentModel> |
getOperationExecutorFactory(T operationModel) |
static org.mule.runtime.extension.api.runtime.source.SdkSourceFactory |
getSdkSourceFactory(org.mule.runtime.api.meta.model.source.SourceModel sourceModel)
Tests the given
sourceModel for a SdkSourceFactoryModelProperty and if present it returns the enclosed
SdkSourceFactory. |
static <T> boolean |
hasAnyDynamic(Iterable<ValueResolver<T>> resolvers)
|
static boolean |
isCompileTime(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
Indicates if the extension model is being built on compile time.
|
static boolean |
isConnectedStreamingOperation(org.mule.runtime.api.meta.model.ComponentModel componentModel) |
static boolean |
isExpression(Object value)
TODO MULE-14603 - This should not exist after MULE-14603 is fixed
|
static boolean |
isNonBlocking(org.mule.runtime.api.meta.model.ComponentModel model) |
static boolean |
isNullSafe(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel) |
static boolean |
isSynthetic(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel)
Indicates whether a give
EnrichableModel is synthetic or not. |
static org.mule.runtime.api.meta.model.ExtensionModel |
loadExtension(Class<?> clazz) |
static org.mule.runtime.api.meta.model.ExtensionModel |
loadExtension(Class<?> clazz,
Map<String,Object> params) |
static boolean |
returnsListOfMessages(org.mule.runtime.api.meta.model.HasOutputModel componentModel) |
static boolean |
supportsOAuth(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
Whether at least one
ConnectionProviderModel in the given supports OAuth authentication |
static byte |
toActionCode(org.mule.runtime.extension.api.tx.OperationTransactionalAction action)
Converts the given
action to its equivalent transactional action as defined in TransactionConfig |
static byte |
toActionCode(org.mule.runtime.extension.api.tx.SourceTransactionalAction action)
Converts the given
action to its equivalent transactional action as defined in TransactionConfig |
static Optional<org.mule.runtime.extension.api.runtime.source.BackPressureAction> |
toBackPressureAction(MessageSource.BackPressureStrategy backPressureStrategy) |
static MessageSource.BackPressureStrategy |
toBackPressureStrategy(org.mule.runtime.extension.api.runtime.source.BackPressureMode mode) |
static MessageSource.BackPressureStrategy |
toBackPressureStrategy(String backPressureModeName) |
static Map<String,Object> |
toMap(ResolverSet resolverSet,
ValueResolvingContext ctx) |
static <T> T |
withExtensionClassLoader(org.mule.runtime.api.meta.model.ExtensionModel extensionModel,
Callable<T> callable)
|
public static boolean returnsListOfMessages(org.mule.runtime.api.meta.model.HasOutputModel componentModel)
componentModel - a ComponentModelcomponentModel returns a list of messagespublic static <T> boolean hasAnyDynamic(Iterable<ValueResolver<T>> resolvers)
T - the generic type of the ValueResolver itemsresolvers - a Iterable with instances of ValueResolvertrue if at least one ValueResolver is dynamic, false otherwisepublic static Map<String,Object> toMap(ResolverSet resolverSet, ValueResolvingContext ctx) throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionpublic static boolean isNullSafe(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel)
parameterModel - a ParameterModelpublic static List<org.mule.runtime.api.meta.model.connection.ConnectionProviderModel> getAllConnectionProviders(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel)
ConnectionProviderModel instances available for the given configurationModel plus the ones
globally defined at the extensionModel. The List will first contain those defined at a
HasConnectionProviderModels.getConnectionProviders() level and finally the ones at
ExtensionModel.getConnectionProviders()extensionModel - the ExtensionModel which owns the configurationModelconfigurationModel - a ConfigurationModelList. Might be empty but will never be nullpublic static boolean supportsOAuth(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
ConnectionProviderModel in the given supports OAuth authenticationextensionModel - a ExtensionModeltrue if a ConnectionProviderModel exist which is OAuth enabledpublic static ClassLoader getClassLoader(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
extensionModel contains a ClassLoaderModelProperty, then it returns the ClassLoader associated
to such property. Otherwise, it returns the current TCCLextensionModel - a ExtensionModelClassLoaderpublic static <T> T withExtensionClassLoader(org.mule.runtime.api.meta.model.ExtensionModel extensionModel,
Callable<T> callable)
throws Exception
public static byte toActionCode(org.mule.runtime.extension.api.tx.OperationTransactionalAction action)
action to its equivalent transactional action as defined in TransactionConfigaction - a OperationTransactionalActionpublic static byte toActionCode(org.mule.runtime.extension.api.tx.SourceTransactionalAction action)
action to its equivalent transactional action as defined in TransactionConfigaction - a SourceTransactionalActionpublic static MessageSource.BackPressureStrategy toBackPressureStrategy(org.mule.runtime.extension.api.runtime.source.BackPressureMode mode)
mode - a BackPressureModeMessageSource.BackPressureStrategypublic static MessageSource.BackPressureStrategy toBackPressureStrategy(String backPressureModeName)
backPressureModeName - the name of a BackPressureModeMessageSource.BackPressureStrategypublic static Optional<org.mule.runtime.extension.api.runtime.source.BackPressureAction> toBackPressureAction(MessageSource.BackPressureStrategy backPressureStrategy)
public static org.mule.runtime.extension.api.runtime.config.ConfigurationFactory getConfigurationFactory(org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel)
configurationModel for a ConfigurationFactoryModelProperty and returns the contained
ConfigurationFactory.configurationModel - a ConfigurationModelConfigurationFactoryorg.mule.runtime.extension.api.exception.IllegalConfigurationModelDefinitionException - if the configurationModel doesn't contain such model property@Deprecated public static <T extends org.mule.runtime.api.meta.model.ComponentModel> org.mule.runtime.extension.api.runtime.operation.ComponentExecutorFactory<T> getLegacyOperationExecutorFactory(T operationModel)
getOperationExecutorFactory(ComponentModel) insteadoperationModel for a ComponentExecutorModelProperty and if present it returns the enclosed
ComponentExecutorFactory. If no such property is found, then a IllegalOperationModelDefinitionException is
thrown.operationModel - an OperationModelComponentExecutorFactoryorg.mule.runtime.extension.api.exception.IllegalOperationModelDefinitionException - if the operation is not properly enrichedpublic static <T extends org.mule.runtime.api.meta.model.ComponentModel> org.mule.runtime.extension.api.runtime.operation.CompletableComponentExecutorFactory<T> getOperationExecutorFactory(T operationModel)
public static boolean isNonBlocking(org.mule.runtime.api.meta.model.ComponentModel model)
public static org.mule.runtime.extension.api.metadata.MetadataResolverFactory getMetadataResolverFactory(org.mule.runtime.api.meta.model.EnrichableModel model)
model for a MetadataResolverFactoryModelProperty and if present it returns the contained
MetadataResolverFactory. If no such property is found, then a NullMetadataResolverFactory is returnedmodel - an enriched modelMetadataResolverFactorypublic static org.mule.runtime.extension.api.runtime.source.SdkSourceFactory getSdkSourceFactory(org.mule.runtime.api.meta.model.source.SourceModel sourceModel)
sourceModel for a SdkSourceFactoryModelProperty and if present it returns the enclosed
SdkSourceFactory. If no such property is found, then a IllegalSourceModelDefinitionException is thrownsourceModel - a SourceModelSourceFactoryorg.mule.runtime.extension.api.exception.IllegalSourceModelDefinitionException - if the source is not properly enrichedpublic static org.mule.runtime.extension.api.runtime.connectivity.ConnectionProviderFactory getConnectionProviderFactory(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel connectionProviderModel)
connectionProviderModel for a ConnectionProviderFactoryModelProperty and if present it
returns the enclosed ConnectionProviderFactory. If no such property is found, then a
IllegalConnectionProviderModelDefinitionException is thrownconnectionProviderModel - a ConnectionProviderModelSourceFactoryorg.mule.runtime.extension.api.exception.IllegalConnectionProviderModelDefinitionException - if the connection provider is not properly enrichedpublic static Type getConnectionType(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel connectionProviderModel)
connectionProviderModel for a ConnectionTypeModelProperty and if present it returns the
enclosed connection type. If no such property is found, then a IllegalConnectionProviderModelDefinitionException is
thrownconnectionProviderModel - a ConnectionProviderModelClassorg.mule.runtime.extension.api.exception.IllegalConnectionProviderModelDefinitionException - if the connection provider is not properly enrichedpublic static String getExtensionsNamespace(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
ExtensionModelpublic static String getExtensionsNamespace(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration extensionDeclaration)
ExtensionDeclarationpublic static org.mule.runtime.api.meta.model.ExtensionModel loadExtension(Class<?> clazz)
public static org.mule.runtime.api.meta.model.ExtensionModel loadExtension(Class<?> clazz, Map<String,Object> params)
public static String getImplicitConfigurationProviderName(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel, ArtifactType extendedArtifactType, String extendedArtifactId, org.mule.runtime.api.config.FeatureFlaggingService extendedArtifactFeatureFlaggingService)
ConfigurationProvider name for an extension.extensionModel - The ExtensionModel of the extension.configurationModel - The ConfigurationModel of the extension.extendedArtifactType - The ArtifactType of the extended artifact.extendedArtifactId - The unique id of the extended artifact.extendedArtifactFeatureFlaggingService - The FeatureFlaggingService of the extended artifact.ConfigurationProvider name.public static boolean isExpression(Object value)
Indicates if the given value is considered as an expression
value - Value to checkpublic static Optional<String> extractExpression(Object value)
value - Value to parsepublic static boolean isCompileTime(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
extensionModel - the extension model to checkpublic static boolean isSynthetic(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel)
EnrichableModel is synthetic or not.enrichableModel - the enrichable model that may be syntheticpublic static Optional<Class> getImplementingType(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel)
enrichableModel for a ImplementingTypeModelProperty and if present it returns the enclosed
implementing type.enrichableModel - the provider to get the implemented type fromOptional that either has the provider implementing type, or is emptypublic static MutableConfigurationStats getMutableConfigurationStats(org.mule.runtime.extension.api.runtime.operation.ExecutionContext<?> context)
MutableConfigurationStats for a given ExecutionContextpublic static boolean isConnectedStreamingOperation(org.mule.runtime.api.meta.model.ComponentModel componentModel)
ComponentModel defines a streaming operation that uses a connection.public static Optional<String> getDefaultValue(org.mule.sdk.api.annotation.param.Optional optionalAnnotation)
public static Optional<String> getDefaultValue(org.mule.runtime.extension.api.annotation.param.Optional optionalAnnotation)
public static void checkParameterGroupExclusiveness(Optional<org.mule.runtime.api.meta.model.parameter.ParameterizedModel> model, List<org.mule.runtime.api.meta.model.parameter.ParameterGroupModel> groups, Map<String,?> parameters, Map<String,String> aliasedParameterNames) throws ConfigurationException
ParameterGroupModels against the given resolved parameters and validates that the group
exclusiveness is honored.model - the model that owns the parameter groupsgroups - the parameter groups in the model whose exclusiveness must be honoredparameters - the resolved parametersaliasedParameterNames - the alias for each parameter if it has oneConfigurationException - if the group exclusiveness is not honored by the resolved parameters.Copyright © 2003–2024 MuleSoft, Inc.. All rights reserved.