public class MuleExtensionUtils extends Object
extensions| Constructor and Description |
|---|
MuleExtensionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addInterceptorFactory(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration declaration,
org.mule.runtime.extension.api.runtime.InterceptorFactory interceptorFactory)
Adds the given
interceptorFactory to the declaration as the last interceptor in the list |
static void |
addInterceptorFactory(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration declaration,
org.mule.runtime.extension.api.runtime.InterceptorFactory interceptorFactory,
int position)
Adds the given
interceptorFactory to the declaration at the given position |
static List<org.mule.runtime.extension.api.runtime.operation.Interceptor> |
createInterceptors(org.mule.runtime.api.meta.model.EnrichableModel model)
Creates a new
List of interceptors using the factories returned by
InterceptorsModelProperty (if present). |
static List<org.mule.runtime.extension.api.runtime.operation.Interceptor> |
createInterceptors(List<org.mule.runtime.extension.api.runtime.InterceptorFactory> interceptorFactories)
|
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 Class<?> |
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 Object |
getDefaultValue(AccessibleObject object)
Tests the given
object to be annotated with Optional. |
static String |
getDefaultValue(org.mule.runtime.extension.api.annotation.param.Optional optional)
Returns the default value associated with the given annotation.
|
static String |
getExtensionsErrorNamespace(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration extensionDeclaration) |
static String |
getExtensionsErrorNamespace(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) |
static Method |
getImplementingMethod(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration operationDeclaration)
Returns the
Method that was used to declare the given operationDeclaration. |
static Event |
getInitialiserEvent() |
static Event |
getInitialiserEvent(MuleContext muleContext) |
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 org.mule.runtime.extension.api.runtime.operation.OperationExecutorFactory |
getOperationExecutorFactory(org.mule.runtime.api.meta.model.operation.OperationModel operationModel)
Tests the given
operationModel for a OperationExecutorModelProperty and if present
it returns the enclosed OperationExecutorFactory. |
static org.mule.runtime.extension.api.runtime.source.SourceFactory |
getSourceFactory(org.mule.runtime.api.meta.model.source.SourceModel sourceModel)
Tests the given
sourceModel for a SourceFactoryModelProperty and if present
it returns the enclosed SourceFactory. |
static <T> boolean |
hasAnyDynamic(Iterable<ValueResolver<T>> resolvers)
|
static void |
injectConfigName(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
String configName) |
static boolean |
isNullSafe(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel) |
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 org.mule.runtime.extension.api.exception.IllegalModelDefinitionException |
noClassLoaderException(String extensionName)
Creates an exception that says that no
ClassLoader was specified for the extension of the given extensionName |
static boolean |
returnsListOfMessages(org.mule.runtime.api.meta.model.ComponentModel componentModel) |
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 <T> T |
withExtensionClassLoader(org.mule.runtime.api.meta.model.ExtensionModel extensionModel,
Callable<T> callable)
|
public static boolean returnsListOfMessages(org.mule.runtime.api.meta.model.ComponentModel 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 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 List<org.mule.runtime.extension.api.runtime.operation.Interceptor> createInterceptors(org.mule.runtime.api.meta.model.EnrichableModel model)
List of interceptors using the factories returned by
InterceptorsModelProperty (if present).model - the model on which InterceptorsModelProperty is to be invokedList with instances of Interceptorpublic static void addInterceptorFactory(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration declaration,
org.mule.runtime.extension.api.runtime.InterceptorFactory interceptorFactory)
interceptorFactory to the declaration as the last interceptor in the listdeclaration - a BaseDeclarationinterceptorFactory - a InterceptorFactorypublic static void addInterceptorFactory(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration declaration,
org.mule.runtime.extension.api.runtime.InterceptorFactory interceptorFactory,
int position)
interceptorFactory to the declaration at the given positiondeclaration - a BaseDeclarationinterceptorFactory - a InterceptorFactoryposition - a valid list indexpublic static List<org.mule.runtime.extension.api.runtime.operation.Interceptor> createInterceptors(List<org.mule.runtime.extension.api.runtime.InterceptorFactory> interceptorFactories)
public static String getDefaultValue(org.mule.runtime.extension.api.annotation.param.Optional optional)
The reason for this method to be instead of simply using Optional.defaultValue() is a limitation on the Java language
to have an annotation which defaults to a null value. For that reason, this method tests the default value for
equality against the Optional.NULL. If such test is positive, then null is returned.
If a null optional is supplied, then this method returns null
optional - a nullable annotationnullpublic static Object getDefaultValue(AccessibleObject object)
object to be annotated with Optional.
If the annotation is present, then a default value is extracted by the rules of getDefaultValue(Optional).
Otherwise, null is returned.
Notice that a null return value doesn't necessarily mean that the annotation is not present. It could well be that
null happens to be the default value.
object - an object potentially annotated with Optionalnullpublic static Event getInitialiserEvent()
public static Event getInitialiserEvent(MuleContext muleContext)
public static Method getImplementingMethod(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration operationDeclaration)
Method that was used to declare the given operationDeclaration.operationDeclaration - a OperationDeclarationMethod or null if the operationDeclaration was defined by other meanspublic 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 void injectConfigName(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
String configName)
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 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 propertypublic 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.operation.OperationExecutorFactory getOperationExecutorFactory(org.mule.runtime.api.meta.model.operation.OperationModel operationModel)
operationModel for a OperationExecutorModelProperty and if present
it returns the enclosed OperationExecutorFactory. If no such property is found, then a
IllegalOperationModelDefinitionException is thrown.operationModel - an OperationModelOperationExecutorFactoryorg.mule.runtime.extension.api.exception.IllegalOperationModelDefinitionException - if the operation is not properly enrichedpublic static org.mule.runtime.extension.api.runtime.source.SourceFactory getSourceFactory(org.mule.runtime.api.meta.model.source.SourceModel sourceModel)
sourceModel for a SourceFactoryModelProperty and if present
it returns the enclosed SourceFactory. 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 Class<?> 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 org.mule.runtime.extension.api.exception.IllegalModelDefinitionException noClassLoaderException(String extensionName)
ClassLoader was specified for the extension of the given extensionNameextensionName - the name of the offending extensionIllegalModelDefinitionExceptionpublic static String getExtensionsErrorNamespace(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
ExtensionModelpublic static String getExtensionsErrorNamespace(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration extensionDeclaration)
ExtensionDeclarationpublic static org.mule.runtime.api.meta.model.ExtensionModel loadExtension(Class<?> clazz)
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.