use of org.mule.runtime.core.api.processor.Processor in project mule by mulesoft.
the class CoreComponentBuildingDefinitionProvider method getComponentBuildingDefinitions.
@Override
public List<ComponentBuildingDefinition> getComponentBuildingDefinitions() {
LinkedList<ComponentBuildingDefinition> componentBuildingDefinitions = new LinkedList<>();
AttributeDefinition messageProcessorListAttributeDefinition = fromChildCollectionConfiguration(Processor.class).build();
ComponentBuildingDefinition.Builder onErrorBaseBuilder = baseDefinition.withSetterParameterDefinition(MESSAGE_PROCESSORS, messageProcessorListAttributeDefinition).withSetterParameterDefinition(WHEN, fromSimpleParameter(WHEN).build()).withSetterParameterDefinition(ERROR_TYPE, fromSimpleParameter(TYPE).build()).withSetterParameterDefinition(LOG_EXCEPTION, fromSimpleParameter(LOG_EXCEPTION).withDefaultValue("true").build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(ON_ERROR).withTypeDefinition(fromType(TemplateOnErrorHandler.class)).withObjectFactoryType(OnErrorFactoryBean.class).withConstructorParameterDefinition(fromSimpleReferenceParameter("ref").build()).build());
componentBuildingDefinitions.add(onErrorBaseBuilder.withIdentifier(ON_ERROR_CONTINUE).withTypeDefinition(fromType(OnErrorContinueHandler.class)).asPrototype().build());
componentBuildingDefinitions.add(onErrorBaseBuilder.withIdentifier(ON_ERROR_PROPAGATE).withTypeDefinition(fromType(OnErrorPropagateHandler.class)).asPrototype().build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(ERROR_HANDLER).withTypeDefinition(fromType(ErrorHandler.class)).withObjectFactoryType(ErrorHandlerFactoryBean.class).withSetterParameterDefinition("delegate", fromSimpleReferenceParameter("ref").build()).withSetterParameterDefinition(NAME, fromSimpleParameter(NAME).build()).withSetterParameterDefinition("exceptionListeners", fromChildCollectionConfiguration(FlowExceptionHandler.class).build()).asPrototype().build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(SET_PAYLOAD).withTypeDefinition(fromType(SetPayloadMessageProcessor.class)).withSetterParameterDefinition("value", fromSimpleParameter("value").build()).withSetterParameterDefinition("mimeType", fromSimpleParameter("mimeType").build()).withSetterParameterDefinition("encoding", fromSimpleParameter("encoding").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(LOGGER).withTypeDefinition(fromType(LoggerMessageProcessor.class)).withSetterParameterDefinition("message", fromSimpleParameter("message").build()).withSetterParameterDefinition("category", fromSimpleParameter("category").build()).withSetterParameterDefinition("level", fromSimpleParameter("level").build()).build());
componentBuildingDefinitions.add(getSetVariablePropertyBaseBuilder(getAddVariableTransformerInstanceFactory(AddFlowVariableProcessor.class), AddFlowVariableProcessor.class, newBuilder().withKey("identifier").withAttributeDefinition(fromSimpleParameter("variableName").build()).build(), newBuilder().withKey("value").withAttributeDefinition(fromSimpleParameter("value").build()).build()).withIdentifier("set-variable").withTypeDefinition(fromType(AddFlowVariableProcessor.class)).build());
componentBuildingDefinitions.add(getCoreMuleMessageTransformerBaseBuilder().withIdentifier("remove-variable").withTypeDefinition(fromType(RemoveFlowVariableProcessor.class)).withSetterParameterDefinition("identifier", fromSimpleParameter("variableName").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("global-property").withTypeDefinition(fromType(String.class)).withConstructorParameterDefinition(fromSimpleParameter("value").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(TRANSFORMER).withTypeDefinition(fromType(Transformer.class)).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(CUSTOM_PROCESSOR).withTypeDefinition(fromConfigurationAttribute(CLASS_ATTRIBUTE).checkingThatIsClassOrInheritsFrom(MESSAGE_PROCESSOR_CLASS)).asPrototype().build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(PROCESSOR_CHAIN).withTypeDefinition(fromType(AnnotatedProcessor.class)).withObjectFactoryType(MessageProcessorChainObjectFactory.class).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).asPrototype().build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(ROUTE).withTypeDefinition(fromType(MessageProcessorChain.class)).withObjectFactoryType(MessageProcessorChainFactoryBean.class).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).asPrototype().build());
addModuleOperationChainParser(componentBuildingDefinitions);
componentBuildingDefinitions.add(baseDefinition.withIdentifier(SUB_FLOW).withTypeDefinition(fromType(MessageProcessorChain.class)).withObjectFactoryType(SubflowMessageProcessorChainFactoryBean.class).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).withSetterParameterDefinition(NAME, fromSimpleParameter(NAME).build()).asPrototype().build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(RESPONSE).withTypeDefinition(fromType(ResponseMessageProcessorAdapter.class)).withObjectFactoryType(ResponseMessageProcessorsFactoryBean.class).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(FLOW).withTypeDefinition(fromType(Flow.class)).withObjectFactoryType(DefaultFlowFactoryBean.class).withSetterParameterDefinition(NAME, fromSimpleParameter(NAME).build()).withSetterParameterDefinition("muleContext", fromReferenceObject(MuleContext.class).build()).withSetterParameterDefinition("initialState", fromSimpleParameter("initialState").withDefaultValue(INITIAL_STATE_STARTED).build()).withSetterParameterDefinition("messageSource", fromChildConfiguration(MessageSource.class).build()).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).withSetterParameterDefinition(EXCEPTION_LISTENER_ATTRIBUTE, fromChildConfiguration(FlowExceptionHandler.class).build()).withSetterParameterDefinition("maxConcurrency", fromSimpleParameter("maxConcurrency").build()).build());
Builder processorRefBuilder = baseDefinition.withTypeDefinition(fromType(AnnotatedProcessor.class)).withObjectFactoryType(FlowRefFactoryBean.class).withSetterParameterDefinition("muleContext", fromReferenceObject(MuleContext.class).build());
componentBuildingDefinitions.add(processorRefBuilder.withIdentifier(FLOW_REF).withSetterParameterDefinition("name", fromSimpleParameter("name").build()).withSetterParameterDefinition("target", fromSimpleParameter("target").build()).withSetterParameterDefinition("targetValue", fromSimpleParameter("targetValue").withDefaultValue("#[payload]").build()).build());
componentBuildingDefinitions.add(processorRefBuilder.withIdentifier(PROCESSOR).withSetterParameterDefinition("name", fromSimpleParameter("ref").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(COLLECT_LIST).withTypeDefinition(fromType(CollectListForkJoinStrategyFactory.class)).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(SCATTER_GATHER).withTypeDefinition(fromType(ScatterGatherRouter.class)).withSetterParameterDefinition("timeout", fromSimpleParameter("timeout").build()).withSetterParameterDefinition("maxConcurrency", fromSimpleParameter("maxConcurrency").build()).withSetterParameterDefinition("target", fromSimpleParameter("target").build()).withSetterParameterDefinition("targetValue", fromSimpleParameter("targetValue").withDefaultValue("#[payload]").build()).withSetterParameterDefinition(ROUTES, fromChildCollectionConfiguration(MessageProcessorChain.class).build()).withSetterParameterDefinition(FORK_JOIN_STRATEGY, fromChildConfiguration(ForkJoinStrategyFactory.class).build()).asScope().build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(SPLIT_AGGREGATE).withTypeDefinition(fromType(SplitAggregateScope.class)).withSetterParameterDefinition("collectionExpression", fromChildConfiguration(String.class).withIdentifier("collection").build()).withSetterParameterDefinition("timeout", fromSimpleParameter("timeout").build()).withSetterParameterDefinition("maxConcurrency", fromSimpleParameter("maxConcurrency").build()).withSetterParameterDefinition("target", fromSimpleParameter("target").build()).withSetterParameterDefinition("targetValue", fromSimpleParameter("targetValue").withDefaultValue("#[payload]").build()).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).asScope().build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("collection").withTypeDefinition(fromType(String.class)).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(ENRICHER).withObjectFactoryType(MessageEnricherObjectFactory.class).withTypeDefinition(fromType(MessageEnricher.class)).withSetterParameterDefinition("messageProcessor", fromChildConfiguration(Processor.class).build()).withSetterParameterDefinition("enrichExpressionPairs", fromChildCollectionConfiguration(MessageEnricher.EnrichExpressionPair.class).build()).withSetterParameterDefinition("source", fromSimpleParameter("source").build()).withSetterParameterDefinition("target", fromSimpleParameter("target").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("enrich").withTypeDefinition(fromType(MessageEnricher.EnrichExpressionPair.class)).withConstructorParameterDefinition(fromSimpleParameter("source").build()).withConstructorParameterDefinition(fromSimpleParameter("target").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(ASYNC).withTypeDefinition(fromType(AsyncDelegateMessageProcessor.class)).withObjectFactoryType(AsyncMessageProcessorsFactoryBean.class).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).withSetterParameterDefinition(NAME, fromSimpleParameter(NAME).build()).withSetterParameterDefinition("maxConcurrency", fromSimpleParameter("maxConcurrency").build()).build());
// TODO MULE-12726 Remove TryProcessorFactoryBean
componentBuildingDefinitions.add(baseDefinition.withIdentifier(TRY).withTypeDefinition(fromType(TryScope.class)).withObjectFactoryType(TryProcessorFactoryBean.class).withSetterParameterDefinition("exceptionListener", fromChildConfiguration(FlowExceptionHandler.class).build()).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).withSetterParameterDefinition(TX_ACTION, fromSimpleParameter(TX_ACTION).withDefaultValue(ACTION_INDIFFERENT_STRING).build()).withSetterParameterDefinition(TX_TYPE, fromSimpleParameter(TX_TYPE, getTransactionTypeConverter()).withDefaultValue(LOCAL.name()).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(UNTIL_SUCCESSFUL).withTypeDefinition(fromType(UntilSuccessful.class)).withSetterParameterDefinition("maxRetries", fromSimpleParameter("maxRetries").withDefaultValue(5).build()).withSetterParameterDefinition("millisBetweenRetries", fromSimpleParameter("millisBetweenRetries").withDefaultValue(60000).build()).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(FOREACH).withTypeDefinition(fromType(Foreach.class)).withSetterParameterDefinition("collectionExpression", fromSimpleParameter("collection").build()).withSetterParameterDefinition("batchSize", fromSimpleParameter("batchSize").build()).withSetterParameterDefinition("rootMessageVariableName", fromSimpleParameter("rootMessageVariableName").build()).withSetterParameterDefinition("counterVariableName", fromSimpleParameter("counterVariableName").build()).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(FIRST_SUCCESSFUL).withTypeDefinition(fromType(FirstSuccessful.class)).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(MessageProcessorChain.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(ROUND_ROBIN).withTypeDefinition(fromType(RoundRobin.class)).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(MessageProcessorChain.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(CHOICE).withTypeDefinition(fromType(ChoiceRouter.class)).withObjectFactoryType(ChoiceRouterObjectFactory.class).withSetterParameterDefinition("routes", fromChildCollectionConfiguration(MessageProcessorExpressionPair.class).build()).withSetterParameterDefinition("defaultRoute", fromChildConfiguration(MessageProcessorExpressionPair.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(WHEN).withTypeDefinition(fromType(MessageProcessorExpressionPair.class)).withObjectFactoryType(MessageProcessorFilterPairFactoryBean.class).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).withSetterParameterDefinition("expression", fromSimpleParameter("expression").withDefaultValue("true").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(OTHERWISE).withTypeDefinition(fromType(MessageProcessorExpressionPair.class)).withObjectFactoryType(MessageProcessorFilterPairFactoryBean.class).withSetterParameterDefinition(MESSAGE_PROCESSORS, fromChildCollectionConfiguration(Processor.class).build()).withSetterParameterDefinition("expression", fromFixedValue("true").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("message-chunk-splitter").withTypeDefinition(fromType(MessageChunkSplitter.class)).withSetterParameterDefinition("messageSize", fromSimpleParameter("messageSize").build()).build());
ComponentBuildingDefinition.Builder baseAggregatorDefinition = baseDefinition.withSetterParameterDefinition("timeout", fromSimpleParameter("timeout").build()).withSetterParameterDefinition("failOnTimeout", fromSimpleParameter("failOnTimeout").build()).withSetterParameterDefinition("processedGroupsObjectStore", fromSimpleReferenceParameter("processed-groups-object-store").build()).withSetterParameterDefinition("eventGroupsObjectStore", fromSimpleReferenceParameter("event-groups-object-store").build()).withSetterParameterDefinition("persistentStores", fromSimpleParameter("persistentStores").build()).withSetterParameterDefinition("storePrefix", fromSimpleParameter("storePrefix").build());
componentBuildingDefinitions.add(baseAggregatorDefinition.withIdentifier("message-chunk-aggregator").withTypeDefinition(fromType(MessageChunkAggregator.class)).build());
componentBuildingDefinitions.add(baseAggregatorDefinition.withIdentifier("collection-aggregator").withTypeDefinition(fromType(SimpleCollectionAggregator.class)).build());
componentBuildingDefinitions.add(baseAggregatorDefinition.withIdentifier("resequencer").withTypeDefinition(fromType(Resequencer.class)).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("splitter").withTypeDefinition(fromType(Splitter.class)).withSetterParameterDefinition("expression", fromSimpleParameter("expression").build()).withSetterParameterDefinition("filterOnErrorType", fromSimpleParameter("filterOnErrorType").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(REQUEST_REPLY).withTypeDefinition(fromType(SimpleAsyncRequestReplyRequester.class)).withSetterParameterDefinition("messageProcessor", fromChildConfiguration(Processor.class).build()).withSetterParameterDefinition("messageSource", fromChildConfiguration(MessageSource.class).build()).withSetterParameterDefinition("timeout", fromSimpleParameter("timeout").build()).withSetterParameterDefinition("storePrefix", fromSimpleParameter("storePrefix").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(SCHEDULER).withTypeDefinition(fromType(DefaultSchedulerMessageSource.class)).withObjectFactoryType(SchedulingMessageSourceFactoryBean.class).withSetterParameterDefinition("disallowConcurrentExecution", fromSimpleParameter("disallowConcurrentExecution").withDefaultValue(true).build()).withSetterParameterDefinition("scheduler", fromChildConfiguration(PeriodicScheduler.class).withWrapperIdentifier(SCHEDULING_STRATEGY_ELEMENT_IDENTIFIER).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(FIXED_FREQUENCY_STRATEGY_ELEMENT_IDENTIFIER).withTypeDefinition(fromType(FixedFrequencyScheduler.class)).withSetterParameterDefinition("frequency", fromSimpleParameter("frequency").build()).withSetterParameterDefinition("startDelay", fromSimpleParameter("startDelay").build()).withSetterParameterDefinition("timeUnit", fromSimpleParameter("timeUnit").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(CRON_STRATEGY_ELEMENT_IDENTIFIER).withTypeDefinition(fromType(CronScheduler.class)).withSetterParameterDefinition("expression", fromSimpleParameter("expression").build()).withSetterParameterDefinition("timeZone", fromSimpleParameter("timeZone").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("configuration").withTypeDefinition(fromType(MuleConfiguration.class)).withObjectFactoryType(MuleConfigurationConfigurator.class).withSetterParameterDefinition("defaultErrorHandlerName", fromSimpleParameter("defaultErrorHandler-ref").build()).withSetterParameterDefinition("defaultResponseTimeout", fromSimpleParameter("defaultResponseTimeout").build()).withSetterParameterDefinition("maxQueueTransactionFilesSize", fromSimpleParameter("maxQueueTransactionFilesSize").build()).withSetterParameterDefinition("defaultTransactionTimeout", fromSimpleParameter("defaultTransactionTimeout").build()).withSetterParameterDefinition("shutdownTimeout", fromSimpleParameter("shutdownTimeout").build()).withSetterParameterDefinition("defaultTransactionTimeout", fromSimpleParameter("defaultTransactionTimeout").build()).withSetterParameterDefinition("useExtendedTransformations", fromSimpleParameter("useExtendedTransformations").build()).withSetterParameterDefinition("flowEndingWithOneWayEndpointReturnsNull", fromSimpleParameter("flowEndingWithOneWayEndpointReturnsNull").build()).withSetterParameterDefinition("enricherPropagatesSessionVariableChanges", fromSimpleParameter("enricherPropagatesSessionVariableChanges").build()).withSetterParameterDefinition("defaultObjectSerializer", fromSimpleReferenceParameter("defaultObjectSerializer-ref").build()).withSetterParameterDefinition("extensions", fromChildCollectionConfiguration(ConfigurationExtension.class).build()).withSetterParameterDefinition("dynamicConfigExpiration", fromChildConfiguration(DynamicConfigExpiration.class).build()).withSetterParameterDefinition("extensions", fromChildCollectionConfiguration(Object.class).build()).alwaysEnabled(true).withRegistrationName(OBJECT_MULE_CONFIGURATION).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("dynamic-config-expiration").withTypeDefinition(fromType(DynamicConfigExpiration.class)).withObjectFactoryType(DynamicConfigExpirationObjectFactory.class).withConstructorParameterDefinition(fromSimpleParameter("frequency").withDefaultValue(DYNAMIC_CONFIG_EXPIRATION_FREQUENCY.getTime()).build()).withConstructorParameterDefinition(fromSimpleParameter("timeUnit", value -> TimeUnit.valueOf((String) value)).withDefaultValue(DYNAMIC_CONFIG_EXPIRATION_FREQUENCY.getUnit()).build()).withSetterParameterDefinition("expirationPolicy", fromChildConfiguration(ExpirationPolicy.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("expiration-policy").withTypeDefinition(fromType(ExpirationPolicy.class)).withObjectFactoryType(ExpirationPolicyObjectFactory.class).withSetterParameterDefinition("maxIdleTime", fromSimpleParameter("maxIdleTime").withDefaultValue(DYNAMIC_CONFIG_EXPIRATION_FREQUENCY.getTime()).build()).withSetterParameterDefinition("timeUnit", fromSimpleParameter("timeUnit", value -> TimeUnit.valueOf((String) value)).withDefaultValue(DYNAMIC_CONFIG_EXPIRATION_FREQUENCY.getUnit()).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("notifications").withTypeDefinition(fromType(ServerNotificationManagerConfigurator.class)).withSetterParameterDefinition("notificationDynamic", fromSimpleParameter("dynamic").build()).withSetterParameterDefinition("enabledNotifications", fromChildCollectionConfiguration(NotificationConfig.EnabledNotificationConfig.class).build()).withSetterParameterDefinition("disabledNotifications", fromChildCollectionConfiguration(NotificationConfig.DisabledNotificationConfig.class).build()).withSetterParameterDefinition("notificationListeners", fromChildCollectionConfiguration(ListenerSubscriptionPair.class).build()).build());
ComponentBuildingDefinition.Builder baseNotificationDefinition = baseDefinition.withSetterParameterDefinition("interfaceName", fromSimpleParameter("interface").build()).withSetterParameterDefinition("eventName", fromSimpleParameter("event").build()).withSetterParameterDefinition("interfaceClass", fromSimpleParameter("interface-class").build()).withSetterParameterDefinition("eventClass", fromSimpleParameter("event-class").build());
componentBuildingDefinitions.add(baseNotificationDefinition.withTypeDefinition(fromType(NotificationConfig.EnabledNotificationConfig.class)).withIdentifier("notification").build());
componentBuildingDefinitions.add(baseNotificationDefinition.withTypeDefinition(fromType(NotificationConfig.DisabledNotificationConfig.class)).withIdentifier("disable-notification").build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("notification-listener").withTypeDefinition(fromType(ListenerSubscriptionPair.class)).withConstructorParameterDefinition(fromSimpleReferenceParameter("ref").build()).withConstructorParameterDefinition(fromSimpleParameter("subscription", getNotificationSubscriptionConverter()).withDefaultValue(ANY_SELECTOR_STRING).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("username-password-filter").withTypeDefinition(fromType(UsernamePasswordAuthenticationFilter.class)).withSetterParameterDefinition("username", fromSimpleParameter("username").build()).withSetterParameterDefinition("password", fromSimpleParameter("password").build()).withIgnoredConfigurationParameter(NAME).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("custom-security-filter").withTypeDefinition(fromType(Processor.class)).withObjectFactoryType(CustomSecurityFilterObjectFactory.class).withConstructorParameterDefinition(fromSimpleReferenceParameter("ref").build()).withIgnoredConfigurationParameter(NAME).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("encryption-security-filter").withTypeDefinition(fromType(MuleEncryptionEndpointSecurityFilter.class)).withConstructorParameterDefinition(fromSimpleReferenceParameter("strategy-ref").build()).withIgnoredConfigurationParameter(NAME).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("security-manager").withTypeDefinition(fromType(SecurityManager.class)).withObjectFactoryType(MuleSecurityManagerConfigurator.class).withSetterParameterDefinition("muleContext", fromReferenceObject(MuleContext.class).build()).withSetterParameterDefinition("name", fromSimpleParameter("name").build()).withSetterParameterDefinition("providers", fromChildCollectionConfiguration(SecurityProvider.class).build()).withSetterParameterDefinition("encryptionStrategies", fromChildCollectionConfiguration(EncryptionStrategy.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("custom-security-provider").withTypeDefinition(fromType(CustomSecurityProviderDelegate.class)).withConstructorParameterDefinition(fromSimpleReferenceParameter("provider-ref").build()).withConstructorParameterDefinition(fromSimpleParameter("name").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("custom-encryption-strategy").withTypeDefinition(fromType(CustomEncryptionStrategyDelegate.class)).withConstructorParameterDefinition(fromSimpleReferenceParameter("strategy-ref").build()).withConstructorParameterDefinition(fromSimpleParameter("name").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("secret-key-encryption-strategy").withTypeDefinition(fromType(SecretKeyEncryptionStrategy.class)).withSetterParameterDefinition("name", fromSimpleParameter("name").build()).withSetterParameterDefinition("key", fromSimpleParameter("key").build()).withSetterParameterDefinition("keyFactory", fromSimpleReferenceParameter("keyFactory-ref").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("password-encryption-strategy").withTypeDefinition(fromType(PasswordBasedEncryptionStrategy.class)).withSetterParameterDefinition("name", fromSimpleParameter("name").build()).withSetterParameterDefinition("iterationCount", fromSimpleParameter("iterationCount").build()).withSetterParameterDefinition("password", fromSimpleParameter("password").build()).withSetterParameterDefinition("salt", fromSimpleParameter("salt").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(REDELIVERY_POLICY_ELEMENT_IDENTIFIER).withTypeDefinition(fromType(IdempotentRedeliveryPolicy.class)).withSetterParameterDefinition("maxRedeliveryCount", fromSimpleParameter("maxRedeliveryCount").build()).withSetterParameterDefinition("useSecureHash", fromSimpleParameter("useSecureHash").build()).withSetterParameterDefinition("messageDigestAlgorithm", fromSimpleParameter("messageDigestAlgorithm").build()).withSetterParameterDefinition("idExpression", fromSimpleParameter("idExpression").build()).withSetterParameterDefinition("objectStore", fromSimpleReferenceParameter("objectStore").build()).withSetterParameterDefinition("privateObjectStore", fromChildConfiguration(ValueResolver.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("pooling-profile").withTypeDefinition(fromType(PoolingProfile.class)).withSetterParameterDefinition("maxActive", fromSimpleParameter("maxActive").build()).withSetterParameterDefinition("maxIdle", fromSimpleParameter("maxIdle").build()).withSetterParameterDefinition("exhaustedAction", fromSimpleParameter("exhaustedAction", PoolingProfile.POOL_EXHAUSTED_ACTIONS::get).build()).withSetterParameterDefinition("maxWait", fromSimpleParameter("maxWait").build()).withSetterParameterDefinition("evictionCheckIntervalMillis", fromSimpleParameter("evictionCheckIntervalMillis").build()).withSetterParameterDefinition("minEvictionMillis", fromSimpleParameter("minEvictionMillis").build()).withSetterParameterDefinition("disabled", fromSimpleParameter("disabled").build()).withSetterParameterDefinition("initialisationPolicy", fromSimpleParameter("initialisationPolicy", PoolingProfile.POOL_INITIALISATION_POLICIES::get).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("expression-component").withTypeDefinition(fromType(ExpressionLanguageComponent.class)).withSetterParameterDefinition("expression", fromTextContent().build()).withSetterParameterDefinition("expressionFile", fromSimpleParameter("file").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("invoke").withTypeDefinition(fromType(InvokerMessageProcessor.class)).withSetterParameterDefinition("name", fromSimpleParameter("name").build()).withSetterParameterDefinition("methodName", fromSimpleParameter("method").build()).withSetterParameterDefinition("argumentExpressionsString", fromSimpleParameter("methodArguments").build()).withSetterParameterDefinition("object", fromSimpleReferenceParameter("object-ref").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("expression-language").withTypeDefinition(fromType(MVELExpressionLanguage.class)).withObjectFactoryType(MVELExpressionLanguageObjectFactory.class).withSetterParameterDefinition("autoResolveVariables", fromSimpleParameter("autoResolveVariables").build()).withSetterParameterDefinition("globalFunctions", fromChildConfiguration(MVELGlobalFunctionsConfig.class).build()).withSetterParameterDefinition("imports", fromChildCollectionConfiguration(ImportEntry.class).build()).withSetterParameterDefinition("aliases", fromChildCollectionConfiguration(AliasEntry.class).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("import").withTypeDefinition(fromType(ImportEntry.class)).withSetterParameterDefinition("key", fromSimpleParameter("name").build()).withSetterParameterDefinition("value", fromSimpleParameter("class", stringToClassConverter()).build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("alias").withTypeDefinition(fromType(AliasEntry.class)).withSetterParameterDefinition("key", fromSimpleParameter("name").build()).withSetterParameterDefinition("value", fromSimpleParameter("expression").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier("global-functions").withTypeDefinition(fromType(MVELGlobalFunctionsConfig.class)).withSetterParameterDefinition("file", fromSimpleParameter("file").build()).withSetterParameterDefinition("inlineScript", fromTextContent().build()).build());
componentBuildingDefinitions.addAll(getTransformersBuildingDefinitions());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(POOLING_PROFILE_ELEMENT_IDENTIFIER).withTypeDefinition(fromType(PoolingProfile.class)).withConstructorParameterDefinition(fromSimpleParameter("maxActive").withDefaultValue(DEFAULT_MAX_POOL_ACTIVE).build()).withConstructorParameterDefinition(fromSimpleParameter("maxIdle").withDefaultValue(DEFAULT_MAX_POOL_IDLE).build()).withConstructorParameterDefinition(fromSimpleParameter("maxWait", value -> Long.valueOf((String) value)).withDefaultValue(valueOf(DEFAULT_MAX_POOL_WAIT)).build()).withConstructorParameterDefinition(fromSimpleParameter("exhaustedAction", POOL_EXHAUSTED_ACTIONS::get).withDefaultValue(valueOf(DEFAULT_POOL_EXHAUSTED_ACTION)).build()).withConstructorParameterDefinition(fromSimpleParameter("initialisationPolicy", POOL_INITIALISATION_POLICIES::get).withDefaultValue(valueOf(DEFAULT_POOL_INITIALISATION_POLICY)).build()).withSetterParameterDefinition("disabled", fromSimpleParameter("disabled").build()).build());
componentBuildingDefinitions.add(baseDefinition.withIdentifier(RAISE_ERROR).withTypeDefinition(fromType(RaiseErrorProcessor.class)).withSetterParameterDefinition("type", fromSimpleParameter("type").build()).withSetterParameterDefinition("description", fromSimpleParameter("description").build()).build());
componentBuildingDefinitions.addAll(getStreamingDefinitions());
componentBuildingDefinitions.addAll(getIdempotentValidatorsDefinitions());
componentBuildingDefinitions.addAll(getReconnectionDefinitions());
componentBuildingDefinitions.addAll(getTransactionDefinitions());
return componentBuildingDefinitions;
}
use of org.mule.runtime.core.api.processor.Processor in project mule by mulesoft.
the class ReactiveInterceptorAdapterTestCase method interceptorThrowsExceptionAroundAfterSkipInCallbackChained.
@Test
public void interceptorThrowsExceptionAroundAfterSkipInCallbackChained() throws Exception {
RuntimeException expectedException = new RuntimeException("Some Error");
ProcessorInterceptor interceptor = prepareInterceptor(new ProcessorInterceptor() {
@Override
public CompletableFuture<InterceptionEvent> around(ComponentLocation location, Map<String, ProcessorParameterValue> parameters, InterceptionEvent event, InterceptionAction action) {
return action.skip().thenApplyAsync(e -> {
throw expectedException;
});
}
});
startFlowWithInterceptors(interceptor);
expected.expect(MessagingException.class);
expected.expect(withEventThat(hasErrorType(UNKNOWN.getNamespace(), UNKNOWN.getName())));
expected.expectCause(sameInstance(expectedException));
try {
process(flow, eventBuilder(muleContext).message(Message.of("")).build());
} finally {
if (useMockInterceptor) {
InOrder inOrder = inOrder(processor, interceptor);
inOrder.verify(interceptor).before(any(), any(), any());
inOrder.verify(interceptor).around(any(), any(), any(), any());
inOrder.verify(processor, never()).process(any());
inOrder.verify(interceptor).after(any(), any(), eq(of(expectedException)));
verifyParametersResolvedAndDisposed(times(1));
}
}
}
use of org.mule.runtime.core.api.processor.Processor in project mule by mulesoft.
the class ReactiveInterceptorAdapterTestCase method secondInterceptorMutatesEventAroundAfterProceedChained.
@Test
public void secondInterceptorMutatesEventAroundAfterProceedChained() throws Exception {
ProcessorInterceptor interceptor1 = prepareInterceptor(new TestProcessorInterceptor("outer") {
});
ProcessorInterceptor interceptor2 = prepareInterceptor(new TestProcessorInterceptor("inner") {
@Override
public CompletableFuture<InterceptionEvent> around(ComponentLocation location, Map<String, ProcessorParameterValue> parameters, InterceptionEvent event, InterceptionAction action) {
return action.proceed().thenApplyAsync(e -> {
e.message(Message.of(TEST_PAYLOAD));
return e;
});
}
});
startFlowWithInterceptors(interceptor1, interceptor2);
CoreEvent result = process(flow, eventBuilder(muleContext).message(Message.of("")).build());
assertThat(result.getMessage().getPayload().getValue(), is(TEST_PAYLOAD));
assertThat(result.getError().isPresent(), is(false));
if (useMockInterceptor) {
InOrder inOrder = inOrder(processor, interceptor1, interceptor2);
inOrder.verify(interceptor1).before(any(), mapArgWithEntry("param", ""), any());
inOrder.verify(interceptor2).before(any(), mapArgWithEntry("param", ""), any());
inOrder.verify(interceptor1).around(any(), mapArgWithEntry("param", ""), any(), any());
inOrder.verify(interceptor2).around(any(), mapArgWithEntry("param", ""), any(), any());
inOrder.verify(processor).process(argThat(hasPayloadValue("")));
inOrder.verify(interceptor2).after(any(), argThat(interceptionHasPayloadValue(TEST_PAYLOAD)), eq(empty()));
inOrder.verify(interceptor1).after(any(), argThat(interceptionHasPayloadValue(TEST_PAYLOAD)), eq(empty()));
assertThat(((InternalEvent) result).getInternalParameters().entrySet(), hasSize(0));
verifyParametersResolvedAndDisposed(times(1));
}
}
use of org.mule.runtime.core.api.processor.Processor in project mule by mulesoft.
the class ReactiveInterceptorAdapterTestCase method firstInterceptorMutatesEventAroundAfterProceedChained.
@Test
public void firstInterceptorMutatesEventAroundAfterProceedChained() throws Exception {
ProcessorInterceptor interceptor1 = prepareInterceptor(new TestProcessorInterceptor("outer") {
@Override
public CompletableFuture<InterceptionEvent> around(ComponentLocation location, Map<String, ProcessorParameterValue> parameters, InterceptionEvent event, InterceptionAction action) {
return action.proceed().thenApplyAsync(e -> {
e.message(Message.of(TEST_PAYLOAD));
return e;
});
}
});
ProcessorInterceptor interceptor2 = prepareInterceptor(new TestProcessorInterceptor("inner") {
});
startFlowWithInterceptors(interceptor1, interceptor2);
CoreEvent result = process(flow, eventBuilder(muleContext).message(Message.of("")).build());
assertThat(result.getMessage().getPayload().getValue(), is(TEST_PAYLOAD));
assertThat(result.getError().isPresent(), is(false));
if (useMockInterceptor) {
InOrder inOrder = inOrder(processor, interceptor1, interceptor2);
inOrder.verify(interceptor1).before(any(), mapArgWithEntry("param", ""), any());
inOrder.verify(interceptor2).before(any(), mapArgWithEntry("param", ""), any());
inOrder.verify(interceptor1).around(any(), mapArgWithEntry("param", ""), any(), any());
inOrder.verify(interceptor2).around(any(), mapArgWithEntry("param", ""), any(), any());
inOrder.verify(processor).process(argThat(hasPayloadValue("")));
inOrder.verify(interceptor2).after(any(), any(), eq(empty()));
inOrder.verify(interceptor1).after(any(), argThat(interceptionHasPayloadValue(TEST_PAYLOAD)), eq(empty()));
assertThat(((InternalEvent) result).getInternalParameters().entrySet(), hasSize(0));
verifyParametersResolvedAndDisposed(times(1));
}
}
use of org.mule.runtime.core.api.processor.Processor in project mule by mulesoft.
the class ForeachTestCase method batchSizeWithCollectionAttributes.
@Test
public void batchSizeWithCollectionAttributes() throws Exception {
Foreach foreachMp = createForeach();
List<Processor> processors = getSimpleMessageProcessors(new TestMessageProcessor("zas"));
foreachMp.setMessageProcessors(processors);
foreachMp.setBatchSize(2);
foreachMp.setCollectionExpression("vars.collection");
initialiseIfNeeded(foreachMp, muleContext);
foreachMp.process(eventBuilder(muleContext).addVariable("collection", asList(1, 2, 3)).message(of(null)).build());
assertThat(processedEvents, hasSize(2));
assertThat(((PrivilegedEvent) processedEvents.get(0)).getMessageAsString(muleContext), is("[1, 2]:foo:zas"));
assertThat(((PrivilegedEvent) processedEvents.get(1)).getMessageAsString(muleContext), is("[3]:foo:zas"));
}
Aggregations