Search in sources :

Example 6 with RegistrationException

use of org.mule.runtime.core.privileged.registry.RegistrationException in project mule by mulesoft.

the class SimpleRegistry method doRegisterObject.

/**
 * {@inheritDoc}
 */
@Override
protected void doRegisterObject(String key, Object object, Object metadata) throws RegistrationException {
    Object previous = doGet(key);
    if (previous != null) {
        if (logger.isDebugEnabled()) {
            logger.debug(String.format("An entry already exists for key %s. It will be replaced", key));
        }
        unregisterObject(key);
    }
    doPut(key, object);
    try {
        getLifecycleManager().applyCompletedPhases(object);
    } catch (MuleException e) {
        throw new RegistrationException(e);
    }
}
Also used : RegistrationException(org.mule.runtime.core.privileged.registry.RegistrationException) MuleException(org.mule.runtime.api.exception.MuleException)

Example 7 with RegistrationException

use of org.mule.runtime.core.privileged.registry.RegistrationException in project mule by mulesoft.

the class AbstractAsyncRequestReplyRequester method initialise.

@Override
public void initialise() throws InitialisationException {
    name = format(NAME_TEMPLATE, storePrefix, muleContext.getConfiguration().getId(), getLocation().getRootContainerName());
    MuleRegistry registry = ((MuleContextWithRegistries) muleContext).getRegistry();
    store = ((ObjectStoreManager) registry.get(OBJECT_STORE_MANAGER)).createObjectStore(name, ObjectStoreSettings.builder().persistent(false).maxEntries(MAX_PROCESSED_GROUPS).entryTtl(UNCLAIMED_TIME_TO_LIVE).expirationInterval(UNCLAIMED_INTERVAL).build());
    try {
        notificationFirer = registry.lookupObject(NotificationDispatcher.class);
    } catch (RegistrationException e) {
        throw new InitialisationException(e, this);
    }
}
Also used : RegistrationException(org.mule.runtime.core.privileged.registry.RegistrationException) MuleContextWithRegistries(org.mule.runtime.core.internal.context.MuleContextWithRegistries) NotificationDispatcher(org.mule.runtime.api.notification.NotificationDispatcher) MuleRegistry(org.mule.runtime.core.internal.registry.MuleRegistry) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException)

Example 8 with RegistrationException

use of org.mule.runtime.core.privileged.registry.RegistrationException in project mule by mulesoft.

the class ExtensionRegistry method registerConfigurationProvider.

/**
 * Registers the given {@code configurationProvider} in the underlying {@link #registry}.
 * <p>
 * The {@code configurationProvider} is registered under a key matching its {@link ConfigurationProvider#getName()}.
 *
 * @param configurationProvider a {@link ConfigurationProvider} to be registered
 * @param muleContext the owner of the registry to register the configurationProvider in.
 * @throws IllegalArgumentException if {@code configurationProvider} is {@code null}
 * @throws MuleRuntimeException if the {@code configurationProvider} could not be registered
 */
void registerConfigurationProvider(ConfigurationProvider configurationProvider, MuleContext muleContext) {
    checkArgument(configurationProvider != null, "Cannot register a null configurationProvider");
    try {
        registerObject(muleContext, configurationProvider.getName(), configurationProvider);
    } catch (RegistrationException e) {
        throw new MuleRuntimeException(createStaticMessage(format("Found exception while registering configuration provider '%s'", configurationProvider.getName())), e);
    }
    providersByExtension.invalidate(configurationProvider.getExtensionModel());
}
Also used : RegistrationException(org.mule.runtime.core.privileged.registry.RegistrationException) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException)

Aggregations

RegistrationException (org.mule.runtime.core.privileged.registry.RegistrationException)8 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)4 NotificationDispatcher (org.mule.runtime.api.notification.NotificationDispatcher)3 MuleContextWithRegistries (org.mule.runtime.core.internal.context.MuleContextWithRegistries)3 MuleRegistry (org.mule.runtime.core.internal.registry.MuleRegistry)3 SchedulerService (org.mule.runtime.api.scheduler.SchedulerService)2 StreamingManager (org.mule.runtime.core.api.streaming.StreamingManager)2 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 ComponentIdentifier (org.mule.runtime.api.component.ComponentIdentifier)1 ConfigurationProperties (org.mule.runtime.api.component.ConfigurationProperties)1 ConfigurationComponentLocator (org.mule.runtime.api.component.location.ConfigurationComponentLocator)1 Location (org.mule.runtime.api.component.location.Location)1 ComponentInitialStateManager (org.mule.runtime.api.deployment.management.ComponentInitialStateManager)1 ErrorTypeRepository (org.mule.runtime.api.exception.ErrorTypeRepository)1 MuleException (org.mule.runtime.api.exception.MuleException)1 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 DataTypeParamsBuilder (org.mule.runtime.api.metadata.DataTypeParamsBuilder)1 NotificationListenerRegistry (org.mule.runtime.api.notification.NotificationListenerRegistry)1 ObjectStoreManager (org.mule.runtime.api.store.ObjectStoreManager)1