Search in sources :

Example 6 with InitialisationException

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

the class SecurityFilterMessageProcessor method initialise.

@Override
public void initialise() throws InitialisationException {
    try {
        muleContext.getInjector().inject(filter);
        initialiseIfNeeded(filter, muleContext);
    } catch (MuleException e) {
        throw new InitialisationException(e, this);
    }
}
Also used : InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleException(org.mule.runtime.api.exception.MuleException)

Example 7 with InitialisationException

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

the class WaitComponent method initialise.

@Override
public void initialise() throws InitialisationException {
    try {
        componentInitializedLatch.release();
        waitLatch.await();
    } catch (InterruptedException e) {
        throw new InitialisationException(e, this);
    }
}
Also used : InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException)

Example 8 with InitialisationException

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

the class AbstractRegistryBootstrap method initialise.

/**
 * TODO Optimize me! MULE-9343
 *
 * {@inheritDoc}
 */
@Override
public void initialise() throws InitialisationException {
    List<BootstrapService> bootstrapServices;
    try {
        bootstrapServices = muleContext.getRegistryBootstrapServiceDiscoverer().discover();
    } catch (Exception e) {
        throw new InitialisationException(e, this);
    }
    // Merge and process properties
    int objectCounter = 1;
    List<TransformerBootstrapProperty> transformers = new LinkedList<>();
    List<ObjectBootstrapProperty> namedObjects = new LinkedList<>();
    List<ObjectBootstrapProperty> unnamedObjects = new LinkedList<>();
    List<TransactionFactoryBootstrapProperty> singleTransactionFactories = new LinkedList<>();
    for (BootstrapService bootstrapService : bootstrapServices) {
        Properties bootstrapProperties = bootstrapService.getProperties();
        for (Map.Entry entry : bootstrapProperties.entrySet()) {
            final String propertyKey = (String) entry.getKey();
            final String propertyValue = (String) entry.getValue();
            if (propertyKey.contains(OBJECT_KEY)) {
                String newKey = propertyKey.substring(0, propertyKey.lastIndexOf(".")) + objectCounter++;
                unnamedObjects.add(createObjectBootstrapProperty(bootstrapService, newKey, propertyValue));
            } else if (propertyKey.contains(TRANSFORMER_KEY)) {
                transformers.add(createTransformerBootstrapProperty(bootstrapService, propertyValue));
            } else if (propertyKey.contains(SINGLE_TX)) {
                if (!propertyKey.contains(TRANSACTION_RESOURCE_SUFFIX)) {
                    singleTransactionFactories.add(createTransactionFactoryBootstrapProperty(bootstrapService, bootstrapProperties, propertyKey, propertyValue));
                }
            } else {
                namedObjects.add(createObjectBootstrapProperty(bootstrapService, propertyKey, propertyValue));
            }
        }
    }
    try {
        registerUnnamedObjects(unnamedObjects);
        registerTransformers();
        registerTransformers(transformers);
        registerObjects(namedObjects);
        registerTransactionFactories(singleTransactionFactories, muleContext);
    } catch (Exception e1) {
        throw new InitialisationException(e1, this);
    }
}
Also used : InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) ArtifactType.createFromString(org.mule.runtime.core.api.config.bootstrap.ArtifactType.createFromString) Properties(java.util.Properties) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleException(org.mule.runtime.api.exception.MuleException) InvocationTargetException(java.lang.reflect.InvocationTargetException) LinkedList(java.util.LinkedList) HashMap(java.util.HashMap) Map(java.util.Map) BootstrapService(org.mule.runtime.core.api.config.bootstrap.BootstrapService)

Example 9 with InitialisationException

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

the class TypeBasedTransformerResolver method initialise.

@Override
public void initialise() throws InitialisationException {
    try {
        objectToString = new ObjectToString();
        objectToByteArray = new ObjectToByteArray();
        // these are just fallbacks that are not to go
        // into the mule registry
        initialiseIfNeeded(objectToString, muleContext);
        initialiseIfNeeded(objectToByteArray, muleContext);
    } catch (MuleException e) {
        throw new InitialisationException(e, this);
    }
}
Also used : ObjectToByteArray(org.mule.runtime.core.internal.transformer.simple.ObjectToByteArray) ObjectToString(org.mule.runtime.core.internal.transformer.simple.ObjectToString) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleException(org.mule.runtime.api.exception.MuleException)

Example 10 with InitialisationException

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

the class AbstractAggregator method initEventGroupsObjectStore.

protected void initEventGroupsObjectStore() throws InitialisationException {
    try {
        if (eventGroupsObjectStore == null) {
            // TODO: Delete ProvidedObjectStoreWrapper if not needed when moving this to compatibility
            eventGroupsObjectStore = new ProvidedPartitionableObjectStoreWrapper(null, internalEventsGroupsObjectStoreSupplier());
        }
        eventGroupsObjectStore.open(storePrefix + ".expiredAndDispatchedGroups");
        eventGroupsObjectStore.open(storePrefix + ".eventGroups");
    } catch (MuleRuntimeException | ObjectStoreException e) {
        throw new InitialisationException(e, this);
    }
}
Also used : ObjectStoreException(org.mule.runtime.api.store.ObjectStoreException) ProvidedPartitionableObjectStoreWrapper(org.mule.runtime.core.internal.util.store.ProvidedPartitionableObjectStoreWrapper) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) 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