View Javadoc

1   /*
2    * $Id: MuleContextFactory.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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 MuleContextFactory is used to create instances of {@link MuleContext}. The instances of 
23   * {@link MuleContext} returned by this factory are initialised but not started.
24   */
25  public interface MuleContextFactory
26  {
27  
28      /**
29       * Returns an existing instance of {@link MuleContext} is one exists, otherwise a
30       * new {@link MuleContext} instance is created with defaults.
31       * 
32       * @throws InitialisationException
33       * @throws ConfigurationException
34       * @see DefaultsConfigurationBuilder
35       */
36      MuleContext createMuleContext() throws InitialisationException, ConfigurationException;
37  
38      /**
39       * Creates a new MuleContext using the {@link MuleContextBuilder} provided.
40       * 
41       * @throws InitialisationException
42       * @throws ConfigurationException
43       */
44      MuleContext createMuleContext(MuleContextBuilder muleContextBuilder)
45          throws InitialisationException, ConfigurationException;
46  
47      /**
48       * Creates a new MuleContext using the given configurationBuilder
49       * 
50       * @param configurationBuilder
51       * @throws InitialisationException
52       * @throws ConfigurationException
53       */
54      MuleContext createMuleContext(ConfigurationBuilder configurationBuilder)
55          throws InitialisationException, ConfigurationException;
56  
57      /**
58       * Creates a new MuleContext using the {@link MuleContextBuilder} provided and
59       * configures it with the list of configuration builder and c onfigures it with
60       * configurationBuilder
61       * 
62       * @param configurationBuilder
63       * @throws InitialisationException
64       * @throws ConfigurationException
65       */
66      MuleContext createMuleContext(ConfigurationBuilder configurationBuilder,
67                                    MuleContextBuilder muleContextBuilder)
68          throws InitialisationException, ConfigurationException;
69  
70      /**
71       * Creates a new MuleContext using the {@link MuleContextBuilder} provided and
72       * configures it with the list of configuration builders. Configuration builders
73       * will be invoked in the same or as provided in the List.
74       * 
75       * @throws InitialisationException
76       * @throws ConfigurationException
77       */
78      MuleContext createMuleContext(List<ConfigurationBuilder> configurationBuilders, MuleContextBuilder muleContextBuilder)
79          throws InitialisationException, ConfigurationException;
80  
81  }