1
2
3
4
5
6
7
8
9
10
11 package org.mule.impl.container;
12
13 import org.mule.umo.manager.ObjectNotFoundException;
14 import org.mule.util.ClassUtils;
15
16 import java.io.Reader;
17
18
19
20
21
22
23
24 public class MuleContainerContext extends AbstractContainerContext
25 {
26 public static final String MULE_CONTAINER_NAME = "mule";
27
28 public MuleContainerContext()
29 {
30 super(MULE_CONTAINER_NAME);
31 }
32
33
34
35
36
37
38 public Object getComponent(Object key) throws ObjectNotFoundException
39 {
40 if (key == null)
41 {
42 throw new ObjectNotFoundException("Component not found for null key");
43 }
44 try
45 {
46 Class clazz;
47 if (key instanceof Class)
48 {
49 clazz = (Class) key;
50 }
51 else
52 {
53 clazz = ClassUtils.loadClass(key.toString(), getClass());
54 }
55 return clazz.newInstance();
56 }
57 catch (Exception e)
58 {
59 throw new ObjectNotFoundException(key.toString() + " (" + e.getMessage() + ")", e);
60 }
61 }
62
63 public void configure(Reader configuration)
64 {
65 throw new UnsupportedOperationException("configure(Reader)");
66 }
67
68 }