Search in sources :

Example 21 with InitialisationException

use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.

the class UntilSuccessful method initialise.

@Override
public void initialise() throws InitialisationException {
    if (processors == null) {
        throw new InitialisationException(createStaticMessage("One message processor must be configured within 'until-successful'."), this);
    }
    this.nestedChain = newChain(getProcessingStrategy(locator, getRootContainerLocation()), processors);
    super.initialise();
    timer = muleContext.getSchedulerService().cpuLightScheduler();
    policyTemplate = new SimpleRetryPolicyTemplate(millisBetweenRetries, maxRetries);
    shouldRetry = event -> event.getError().isPresent();
    Object rootContainer = getFromAnnotatedObject(componentLocator, this).orElse(null);
    if (rootContainer instanceof FlowConstruct) {
        processingStrategy = ((FlowConstruct) rootContainer).getProcessingStrategy();
    } else {
        processingStrategy = DIRECT_PROCESSING_STRATEGY_INSTANCE;
    }
}
Also used : SimpleRetryPolicyTemplate(org.mule.runtime.core.api.retry.policy.SimpleRetryPolicyTemplate) FlowConstruct(org.mule.runtime.core.api.construct.FlowConstruct) ComponentUtils.getFromAnnotatedObject(org.mule.runtime.core.internal.component.ComponentUtils.getFromAnnotatedObject) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException)

Example 22 with InitialisationException

use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.

the class AbstractRegistry method initialise.

@Override
public final void initialise() throws InitialisationException {
    if (id == null) {
        logger.warn("No unique id has been set on this registry");
        id = UUID.getUUID();
    }
    try {
        doInitialise();
    } catch (InitialisationException e) {
        throw e;
    } catch (Exception e) {
        throw new InitialisationException(e, this);
    }
    try {
        fireLifecycle(Initialisable.PHASE_NAME);
    } catch (InitialisationException e) {
        throw e;
    } catch (LifecycleException e) {
        if (e.getComponent() instanceof Initialisable) {
            throw new InitialisationException(e, (Initialisable) e.getComponent());
        }
        throw new InitialisationException(e, this);
    }
}
Also used : LifecycleException(org.mule.runtime.api.lifecycle.LifecycleException) Initialisable(org.mule.runtime.api.lifecycle.Initialisable) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) LifecycleException(org.mule.runtime.api.lifecycle.LifecycleException) RegistrationException(org.mule.runtime.core.privileged.registry.RegistrationException) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) MuleException(org.mule.runtime.api.exception.MuleException)

Example 23 with InitialisationException

use of org.mule.runtime.api.lifecycle.InitialisationException 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 24 with InitialisationException

use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.

the class AbstractJCEEncryptionStrategy method initialise.

@Override
public void initialise() throws InitialisationException {
    if (algorithm == null) {
        throw new InitialisationException(objectIsNull("Algorithm"), this);
    } else {
        logger.debug("Using encryption algorithm: " + algorithm);
    }
    keySpec = createKeySpec();
    try {
        secretKey = getSecretKey();
        createAndInitCiphers();
    } catch (Exception e) {
        throw new InitialisationException(failedToCreate("encryption ciphers"), e, this);
    }
}
Also used : InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) CryptoFailureException(org.mule.runtime.core.api.security.CryptoFailureException) IOException(java.io.IOException) GeneralSecurityException(java.security.GeneralSecurityException)

Example 25 with InitialisationException

use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.

the class AbstractExpressionTransformer method initialise.

/**
 * Template method were deriving classes can do any initialisation after the properties have been set on this transformer
 *
 * @throws InitialisationException
 */
@Override
public void initialise() throws InitialisationException {
    if (arguments == null || arguments.size() == 0) {
        throw new InitialisationException(objectIsNull("arguments[]"), this);
    }
    for (ExpressionArgument argument : arguments) {
        argument.setMuleContext(muleContext);
        argument.setExpressionEvaluationClassLoader(currentThread().getContextClassLoader());
        try {
            argument.validate();
        } catch (Exception e) {
            throw new InitialisationException(e, this);
        }
    }
}
Also used : InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException)

Aggregations

InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)36 MuleException (org.mule.runtime.api.exception.MuleException)14 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)12 HashMap (java.util.HashMap)5 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 Map (java.util.Map)3 Properties (java.util.Properties)3 DefaultMuleException (org.mule.runtime.api.exception.DefaultMuleException)3 ConfigurationException (org.mule.runtime.core.api.config.ConfigurationException)3 RegistrationException (org.mule.runtime.core.privileged.registry.RegistrationException)3 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2 Optional (java.util.Optional)2 Optional.empty (java.util.Optional.empty)2 ErrorTypeRepository (org.mule.runtime.api.exception.ErrorTypeRepository)2 ArtifactDeclaration (org.mule.runtime.app.declaration.api.ArtifactDeclaration)2 FlowConstruct (org.mule.runtime.core.api.construct.FlowConstruct)2 ComponentUtils.getFromAnnotatedObject (org.mule.runtime.core.internal.component.ComponentUtils.getFromAnnotatedObject)2 MuleRegistry (org.mule.runtime.core.internal.registry.MuleRegistry)2