1 /* 2 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com 3 * The software in this package is published under the terms of the CPAL v1.0 4 * license, a copy of which has been included with this distribution in the 5 * LICENSE.txt file. 6 */ 7 package org.mule.api.context; 8 9 import org.mule.api.MuleContext; 10 import org.mule.api.config.ConfigurationBuilder; 11 import org.mule.api.config.ConfigurationException; 12 import org.mule.api.lifecycle.InitialisationException; 13 import org.mule.config.builders.DefaultsConfigurationBuilder; 14 15 import java.util.List; 16 17 /** 18 * A MuleContextFactory is used to create instances of {@link MuleContext}. The instances of 19 * {@link MuleContext} returned by this factory are initialised but not started. 20 */ 21 public interface MuleContextFactory 22 { 23 24 /** 25 * Returns an existing instance of {@link MuleContext} is one exists, otherwise a 26 * new {@link MuleContext} instance is created with defaults. 27 * 28 * @throws InitialisationException 29 * @throws ConfigurationException 30 * @see DefaultsConfigurationBuilder 31 */ 32 MuleContext createMuleContext() throws InitialisationException, ConfigurationException; 33 34 /** 35 * Creates a new MuleContext using the {@link MuleContextBuilder} provided. 36 * 37 * @throws InitialisationException 38 * @throws ConfigurationException 39 */ 40 MuleContext createMuleContext(MuleContextBuilder muleContextBuilder) 41 throws InitialisationException, ConfigurationException; 42 43 /** 44 * Creates a new MuleContext using the given configurationBuilder 45 * 46 * @param configurationBuilder 47 * @throws InitialisationException 48 * @throws ConfigurationException 49 */ 50 MuleContext createMuleContext(ConfigurationBuilder configurationBuilder) 51 throws InitialisationException, ConfigurationException; 52 53 /** 54 * Creates a new MuleContext using the {@link MuleContextBuilder} provided and 55 * configures it with the list of configuration builder and c onfigures it with 56 * configurationBuilder 57 * 58 * @param configurationBuilder 59 * @throws InitialisationException 60 * @throws ConfigurationException 61 */ 62 MuleContext createMuleContext(ConfigurationBuilder configurationBuilder, 63 MuleContextBuilder muleContextBuilder) 64 throws InitialisationException, ConfigurationException; 65 66 /** 67 * Creates a new MuleContext using the {@link MuleContextBuilder} provided and 68 * configures it with the list of configuration builders. Configuration builders 69 * will be invoked in the same or as provided in the List. 70 * 71 * @throws InitialisationException 72 * @throws ConfigurationException 73 */ 74 MuleContext createMuleContext(List<ConfigurationBuilder> configurationBuilders, MuleContextBuilder muleContextBuilder) 75 throws InitialisationException, ConfigurationException; 76 77 }