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