View Javadoc

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