Search in sources :

Example 1 with CustomService

use of org.mule.runtime.core.internal.config.CustomService in project mule by mulesoft.

the class SpringMuleContextServiceConfigurator method createLocalObjectStoreBeanDefinitions.

private void createLocalObjectStoreBeanDefinitions() {
    AtomicBoolean anyBaseStoreWasRedefined = new AtomicBoolean(false);
    OBJECT_STORE_NAME_TO_LOCAL_OBJECT_STORE_NAME.entrySet().forEach(objectStoreLocal -> customServiceRegistry.getOverriddenService(objectStoreLocal.getKey()).ifPresent(customService -> {
        anyBaseStoreWasRedefined.set(true);
        beanDefinitionRegistry.registerBeanDefinition(objectStoreLocal.getKey(), getCustomServiceBeanDefinition(customService));
    }));
    if (anyBaseStoreWasRedefined.get()) {
        beanDefinitionRegistry.registerBeanDefinition(LOCAL_OBJECT_STORE_MANAGER, getBeanDefinitionBuilder(MuleObjectStoreManager.class).addPropertyValue("basePersistentStoreKey", OBJECT_LOCAL_STORE_PERSISTENT).addPropertyValue("baseTransientStoreKey", OBJECT_LOCAL_STORE_IN_MEMORY).getBeanDefinition());
    } else {
        beanDefinitionRegistry.registerAlias(OBJECT_STORE_MANAGER, LOCAL_OBJECT_STORE_MANAGER);
    }
}
Also used : ServiceConfigurator(org.mule.runtime.api.config.custom.ServiceConfigurator) LOCAL_OBJECT_STORE_MANAGER(org.mule.runtime.core.api.config.MuleProperties.LOCAL_OBJECT_STORE_MANAGER) InjectParamsFromContextServiceProxy.createInjectProviderParamsServiceProxy(org.mule.runtime.config.internal.InjectParamsFromContextServiceProxy.createInjectProviderParamsServiceProxy) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) CustomNotificationListener(org.mule.runtime.api.notification.CustomNotificationListener) MuleContextNotification(org.mule.runtime.core.api.context.notification.MuleContextNotification) ErrorTypeRepository(org.mule.runtime.api.exception.ErrorTypeRepository) ConstantFactoryBean(org.mule.runtime.config.internal.factories.ConstantFactoryBean) MessagingExceptionLocationProvider(org.mule.runtime.core.internal.exception.MessagingExceptionLocationProvider) SpiServiceRegistry(org.mule.runtime.core.api.registry.SpiServiceRegistry) OBJECT_MULE_STREAM_CLOSER_SERVICE(org.mule.runtime.core.api.config.MuleProperties.OBJECT_MULE_STREAM_CLOSER_SERVICE) Map(java.util.Map) DEFAULT_OBJECT_SERIALIZER_NAME(org.mule.runtime.api.serialization.ObjectSerializer.DEFAULT_OBJECT_SERIALIZER_NAME) TransactionalQueueManager(org.mule.runtime.core.internal.util.queue.TransactionalQueueManager) OBJECT_NOTIFICATION_DISPATCHER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_NOTIFICATION_DISPATCHER) OBJECT_POLICY_MANAGER_STATE_HANDLER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_POLICY_MANAGER_STATE_HANDLER) OBJECT_CLUSTER_SERVICE(org.mule.runtime.core.api.config.MuleProperties.OBJECT_CLUSTER_SERVICE) OBJECT_EXPRESSION_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_EXPRESSION_MANAGER) DefaultMuleConfiguration(org.mule.runtime.core.api.config.DefaultMuleConfiguration) DefaultComponentInitialStateManager(org.mule.runtime.config.internal.dsl.model.config.DefaultComponentInitialStateManager) CustomNotification(org.mule.runtime.api.notification.CustomNotification) ExtensionNotification(org.mule.runtime.api.notification.ExtensionNotification) NoRetryPolicyTemplate(org.mule.runtime.core.api.retry.policy.NoRetryPolicyTemplate) CustomService(org.mule.runtime.core.internal.config.CustomService) SingleServerLockProvider(org.mule.runtime.core.internal.lock.SingleServerLockProvider) METADATA_SERVICE_KEY(org.mule.runtime.api.metadata.MetadataService.METADATA_SERVICE_KEY) ExtensionManagerFactoryBean(org.mule.runtime.config.internal.factories.ExtensionManagerFactoryBean) DefaultProcessingTimeWatcher(org.mule.runtime.core.internal.management.stats.DefaultProcessingTimeWatcher) NotificationListener(org.mule.runtime.api.notification.NotificationListener) DefaultClusterService(org.mule.runtime.core.internal.cluster.DefaultClusterService) ManagementNotification(org.mule.runtime.api.notification.ManagementNotification) OBJECT_SCHEDULER_POOLS_CONFIG(org.mule.runtime.core.api.config.MuleProperties.OBJECT_SCHEDULER_POOLS_CONFIG) BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder) OBJECT_LOCAL_QUEUE_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_LOCAL_QUEUE_MANAGER) OBJECT_NOTIFICATION_HANDLER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_NOTIFICATION_HANDLER) OBJECT_CONFIGURATION_PROPERTIES(org.mule.runtime.core.api.config.MuleProperties.OBJECT_CONFIGURATION_PROPERTIES) DefaultMuleSecurityManager(org.mule.runtime.core.internal.security.DefaultMuleSecurityManager) OBJECT_EXPRESSION_LANGUAGE(org.mule.runtime.core.api.config.MuleProperties.OBJECT_EXPRESSION_LANGUAGE) LocalTimeSupplier(org.mule.runtime.core.internal.time.LocalTimeSupplier) BeanDefinitionBuilder.genericBeanDefinition(org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition) Service(org.mule.runtime.api.service.Service) SecurityNotification(org.mule.runtime.api.notification.SecurityNotification) MessageProcessingFlowTraceManager(org.mule.runtime.core.internal.context.notification.MessageProcessingFlowTraceManager) ConfigurationComponentLocator(org.mule.runtime.api.component.location.ConfigurationComponentLocator) OBJECT_NOTIFICATION_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_NOTIFICATION_MANAGER) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) Registry(org.mule.runtime.api.artifact.Registry) DynamicDataTypeConversionResolver(org.mule.runtime.core.internal.transformer.DynamicDataTypeConversionResolver) DelegateConnectionManagerAdapter(org.mule.runtime.core.internal.connection.DelegateConnectionManagerAdapter) OBJECT_EXCEPTION_LOCATION_PROVIDER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_EXCEPTION_LOCATION_PROVIDER) OBJECT_STREAMING_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_STREAMING_MANAGER) OBJECT_STATISTICS(org.mule.runtime.core.api.config.MuleProperties.OBJECT_STATISTICS) SchedulerContainerPoolsConfig(org.mule.runtime.api.scheduler.SchedulerContainerPoolsConfig) OBJECT_STORE_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_STORE_MANAGER) ExceptionNotification(org.mule.runtime.api.notification.ExceptionNotification) ExtensionNotificationListener(org.mule.runtime.api.notification.ExtensionNotificationListener) MuleValueProviderService(org.mule.runtime.core.internal.value.MuleValueProviderService) ManagementNotificationListener(org.mule.runtime.api.notification.ManagementNotificationListener) DefaultNotificationListenerRegistry(org.mule.runtime.core.internal.context.notification.DefaultNotificationListenerRegistry) ExceptionNotificationListener(org.mule.runtime.api.notification.ExceptionNotificationListener) TransactionNotificationListener(org.mule.runtime.api.notification.TransactionNotificationListener) TransactionManagerFactoryBean(org.mule.runtime.config.internal.factories.TransactionManagerFactoryBean) MuleObjectStoreManager(org.mule.runtime.core.internal.util.store.MuleObjectStoreManager) OBJECT_CONVERTER_RESOLVER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_CONVERTER_RESOLVER) BASE_IN_MEMORY_OBJECT_STORE_KEY(org.mule.runtime.api.store.ObjectStoreManager.BASE_IN_MEMORY_OBJECT_STORE_KEY) OBJECT_TRANSACTION_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_TRANSACTION_MANAGER) OBJECT_LOCK_PROVIDER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_LOCK_PROVIDER) OBJECT_MESSAGE_PROCESSING_FLOW_TRACE_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_MESSAGE_PROCESSING_FLOW_TRACE_MANAGER) OBJECT_QUEUE_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_QUEUE_MANAGER) BeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry) MVELExpressionLanguage(org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguage) OBJECT_REGISTRY(org.mule.runtime.core.api.config.MuleProperties.OBJECT_REGISTRY) ConnectionNotification(org.mule.runtime.api.notification.ConnectionNotification) SecurityNotificationListener(org.mule.runtime.api.notification.SecurityNotificationListener) CustomServiceRegistry(org.mule.runtime.core.internal.config.CustomServiceRegistry) DefaultPolicyManager(org.mule.runtime.core.internal.policy.DefaultPolicyManager) EventContextService(org.mule.runtime.core.api.event.EventContextService) POLICY(org.mule.runtime.core.api.config.bootstrap.ArtifactType.POLICY) OBJECT_LOCK_FACTORY(org.mule.runtime.core.api.config.MuleProperties.OBJECT_LOCK_FACTORY) ImmutableSet(com.google.common.collect.ImmutableSet) DefaultConnectivityTestingService(org.mule.runtime.core.internal.connectivity.DefaultConnectivityTestingService) ImmutableMap(com.google.common.collect.ImmutableMap) OBJECT_POLICY_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_POLICY_MANAGER) DefaultProcessorInterceptorManager(org.mule.runtime.core.internal.processor.interceptor.DefaultProcessorInterceptorManager) DefaultStreamCloserService(org.mule.runtime.core.internal.util.DefaultStreamCloserService) LAZY_COMPONENT_INITIALIZER_SERVICE_KEY(org.mule.runtime.config.api.LazyComponentInitializer.LAZY_COMPONENT_INITIALIZER_SERVICE_KEY) TransactionFactoryLocator(org.mule.runtime.core.internal.transaction.TransactionFactoryLocator) OBJECT_SECURITY_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_SECURITY_MANAGER) APP(org.mule.runtime.core.api.config.bootstrap.ArtifactType.APP) EnabledNotificationConfig(org.mule.runtime.config.internal.NotificationConfig.EnabledNotificationConfig) Optional(java.util.Optional) OBJECT_MULE_CONFIGURATION(org.mule.runtime.core.api.config.MuleProperties.OBJECT_MULE_CONFIGURATION) CONNECTIVITY_TESTING_SERVICE_KEY(org.mule.runtime.api.connectivity.ConnectivityTestingService.CONNECTIVITY_TESTING_SERVICE_KEY) BASE_PERSISTENT_OBJECT_STORE_KEY(org.mule.runtime.api.store.ObjectStoreManager.BASE_PERSISTENT_OBJECT_STORE_KEY) OBJECT_COMPONENT_INITIAL_STATE_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_COMPONENT_INITIAL_STATE_MANAGER) OBJECT_SCHEDULER_BASE_CONFIG(org.mule.runtime.core.api.config.MuleProperties.OBJECT_SCHEDULER_BASE_CONFIG) MuleMessageProcessingManager(org.mule.runtime.core.internal.execution.MuleMessageProcessingManager) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) MuleContextNotificationListener(org.mule.runtime.core.api.context.notification.MuleContextNotificationListener) ConfigurationProperties(org.mule.runtime.api.component.ConfigurationProperties) DefaultObjectStoreFactoryBean(org.mule.runtime.core.internal.util.store.DefaultObjectStoreFactoryBean) OBJECT_OBJECT_NAME_PROCESSOR(org.mule.runtime.core.api.config.MuleProperties.OBJECT_OBJECT_NAME_PROCESSOR) OBJECT_TRANSACTION_FACTORY_LOCATOR(org.mule.runtime.core.api.config.MuleProperties.OBJECT_TRANSACTION_FACTORY_LOCATOR) OBJECT_PROCESSING_TIME_WATCHER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_PROCESSING_TIME_WATCHER) TransactionNotification(org.mule.runtime.api.notification.TransactionNotification) Inject(javax.inject.Inject) Notification(org.mule.runtime.api.notification.Notification) DefaultPolicyStateHandler(org.mule.runtime.core.internal.policy.DefaultPolicyStateHandler) MuleContext(org.mule.runtime.core.api.MuleContext) ImmutableList(com.google.common.collect.ImmutableList) PROCESSOR_INTERCEPTOR_MANAGER_REGISTRY_KEY(org.mule.runtime.core.internal.interception.ProcessorInterceptorManager.PROCESSOR_INTERCEPTOR_MANAGER_REGISTRY_KEY) MuleLockFactory(org.mule.runtime.core.internal.lock.MuleLockFactory) OBJECT_CONNECTION_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_CONNECTION_MANAGER) OBJECT_DEFAULT_MESSAGE_PROCESSING_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_DEFAULT_MESSAGE_PROCESSING_MANAGER) OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE(org.mule.runtime.core.api.config.MuleProperties.OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE) LOCAL_OBJECT_LOCK_FACTORY(org.mule.runtime.core.api.config.MuleProperties.LOCAL_OBJECT_LOCK_FACTORY) VALUE_PROVIDER_SERVICE_KEY(org.mule.runtime.api.value.ValueProviderService.VALUE_PROVIDER_SERVICE_KEY) OBJECT_LOCAL_STORE_PERSISTENT(org.mule.runtime.core.api.config.MuleProperties.OBJECT_LOCAL_STORE_PERSISTENT) MuleObjectNameProcessor(org.mule.runtime.config.internal.processor.MuleObjectNameProcessor) OBJECT_TIME_SUPPLIER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_TIME_SUPPLIER) DefaultNotificationDispatcher(org.mule.runtime.core.internal.context.notification.DefaultNotificationDispatcher) ConnectionNotificationListener(org.mule.runtime.api.notification.ConnectionNotificationListener) ExtendedTransformationService(org.mule.runtime.core.privileged.transformer.ExtendedTransformationService) OBJECT_LOCAL_STORE_IN_MEMORY(org.mule.runtime.core.api.config.MuleProperties.OBJECT_LOCAL_STORE_IN_MEMORY) DefaultEventContextService(org.mule.runtime.core.internal.event.DefaultEventContextService) NotificationListenerRegistry(org.mule.runtime.api.notification.NotificationListenerRegistry) ArtifactType(org.mule.runtime.core.api.config.bootstrap.ArtifactType) OBJECT_EXTENSION_MANAGER(org.mule.runtime.core.api.config.MuleProperties.OBJECT_EXTENSION_MANAGER) OBJECT_TRANSFORMATION_SERVICE(org.mule.runtime.core.api.config.MuleProperties.OBJECT_TRANSFORMATION_SERVICE) MuleMetadataService(org.mule.runtime.core.internal.metadata.MuleMetadataService) DefaultStreamingManager(org.mule.runtime.core.api.streaming.DefaultStreamingManager) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Example 2 with CustomService

use of org.mule.runtime.core.internal.config.CustomService in project mule by mulesoft.

the class DefaultCustomizationServiceTestCase method registersCustomServiceClass.

@Test
public void registersCustomServiceClass() throws Exception {
    final Class<String> serviceClass = String.class;
    customizationService.registerCustomServiceClass(SERVICE_ID, serviceClass);
    assertThat(customizationService.getCustomServices().size(), equalTo(1));
    final CustomService customService = customizationService.getCustomServices().get(SERVICE_ID);
    assertServiceClass(customService, serviceClass);
}
Also used : CustomService(org.mule.runtime.core.internal.config.CustomService) Test(org.junit.Test)

Example 3 with CustomService

use of org.mule.runtime.core.internal.config.CustomService in project mule by mulesoft.

the class DefaultCustomizationServiceTestCase method registersCustomService.

@Test
public void registersCustomService() throws Exception {
    final Object service = new Object();
    customizationService.registerCustomServiceImpl(SERVICE_ID, service);
    assertThat(customizationService.getCustomServices().size(), equalTo(1));
    final CustomService customService = customizationService.getCustomServices().get(SERVICE_ID);
    assertServiceInstance(customService, service);
}
Also used : CustomService(org.mule.runtime.core.internal.config.CustomService) Test(org.junit.Test)

Example 4 with CustomService

use of org.mule.runtime.core.internal.config.CustomService in project mule by mulesoft.

the class DefaultCustomizationServiceTestCase method overridesDefaultServiceClass.

@Test
public void overridesDefaultServiceClass() throws Exception {
    final Class<String> serviceClass = String.class;
    customizationService.overrideDefaultServiceClass(SERVICE_ID, serviceClass);
    final CustomService customService = customizationService.getOverriddenService(SERVICE_ID).get();
    assertServiceClass(customService, serviceClass);
}
Also used : CustomService(org.mule.runtime.core.internal.config.CustomService) Test(org.junit.Test)

Example 5 with CustomService

use of org.mule.runtime.core.internal.config.CustomService in project mule by mulesoft.

the class DefaultCustomizationServiceTestCase method overridesDefaultService.

@Test
public void overridesDefaultService() throws Exception {
    final Object service = new Object();
    customizationService.overrideDefaultServiceImpl(SERVICE_ID, service);
    final CustomService customService = customizationService.getOverriddenService(SERVICE_ID).get();
    assertServiceInstance(customService, service);
}
Also used : CustomService(org.mule.runtime.core.internal.config.CustomService) Test(org.junit.Test)

Aggregations

CustomService (org.mule.runtime.core.internal.config.CustomService)7 Test (org.junit.Test)4 Service (org.mule.runtime.api.service.Service)2 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)2 BeanDefinitionBuilder.genericBeanDefinition (org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Map (java.util.Map)1 Optional (java.util.Optional)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Inject (javax.inject.Inject)1 Registry (org.mule.runtime.api.artifact.Registry)1 ConfigurationProperties (org.mule.runtime.api.component.ConfigurationProperties)1 ConfigurationComponentLocator (org.mule.runtime.api.component.location.ConfigurationComponentLocator)1 ServiceConfigurator (org.mule.runtime.api.config.custom.ServiceConfigurator)1 CONNECTIVITY_TESTING_SERVICE_KEY (org.mule.runtime.api.connectivity.ConnectivityTestingService.CONNECTIVITY_TESTING_SERVICE_KEY)1 ErrorTypeRepository (org.mule.runtime.api.exception.ErrorTypeRepository)1 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 METADATA_SERVICE_KEY (org.mule.runtime.api.metadata.MetadataService.METADATA_SERVICE_KEY)1