View Javadoc

1   /*
2    * $Id: UMOContainerContext.java 7963 2007-08-21 08:53:15Z dirk.olmes $
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.umo.manager;
12  
13  import org.mule.umo.lifecycle.Disposable;
14  import org.mule.umo.lifecycle.Initialisable;
15  
16  import java.io.Reader;
17  
18  /**
19   * <code>UMOContainerContext</code> defines the contract between Mule and an
20   * underlying container such as Spring or Pico.
21   */
22  public interface UMOContainerContext extends Initialisable, Disposable
23  {
24      /**
25       * The identifying name of the container. Note that implementations should
26       * provide a default name that users can choose to override The name can be used
27       * to reference a container when more than one is registered
28       * 
29       * @param name the identifying name of the container
30       */
31      void setName(String name);
32  
33      /**
34       * Gets the identifying name of the container
35       * 
36       * @return the identifying name of the container
37       */
38      String getName();
39  
40      /**
41       * Queries a component from the underlying container
42       * 
43       * @param key the key fo find the component with. Its up to the individual
44       *            implementation to check the type of this key and look up objects
45       *            accordingly
46       * @return The component found in the container
47       * @throws ObjectNotFoundException if the component is not found
48       */
49      Object getComponent(Object key) throws ObjectNotFoundException;
50  
51      /**
52       * This method will be called if there is a configuration fragement for the
53       * container to use to configure itself. In Mule Xml the fragment is Xml that is
54       * embedded in the &lt;configuration&gt; element of the &lt;container-context$gt;
55       * element.
56       * 
57       * @param configuration
58       * @param doctype the doctype declaration to use for the configuration fragment.
59       *            can be null if no validation is to be performed or the fragment is
60       *            not Xml
61       * @param encoding the encoding to use in the Xml declaration. Default is UTF-8
62       * @throws ContainerException
63       */
64      void configure(Reader configuration, String doctype, String encoding) throws ContainerException;
65  }