1 10 11 package org.mule.impl.container; 12 13 import org.mule.MuleManager; 14 import org.mule.config.i18n.Message; 15 import org.mule.config.i18n.Messages; 16 import org.mule.umo.UMODescriptor; 17 import org.mule.umo.manager.ContainerException; 18 import org.mule.umo.manager.ObjectNotFoundException; 19 20 import java.io.Reader ; 21 22 28 public class DescriptorContainerContext extends AbstractContainerContext 29 { 30 public static final String DESCRIPTOR_CONTAINER_NAME = "descriptor"; 31 32 public DescriptorContainerContext() 33 { 34 super(DESCRIPTOR_CONTAINER_NAME); 35 } 36 37 public void configure(Reader configuration) throws ContainerException 38 { 39 throw new UnsupportedOperationException ("configure"); 40 } 41 42 public void setName(String name) 43 { 44 } 46 47 57 public Object getComponent(Object key) throws ObjectNotFoundException 58 { 59 60 if (key instanceof DescriptorContainerKeyPair) 61 { 62 DescriptorContainerKeyPair dckp = (DescriptorContainerKeyPair)key; 63 64 UMODescriptor d = MuleManager.getInstance().getModel().getDescriptor(dckp.getDescriptorName()); 65 if (d == null) 66 { 67 throw new ObjectNotFoundException(key.toString(), new ContainerException(new Message( 68 Messages.FAILED_LOAD_X, "descriptor: " + dckp.getDescriptorName()))); 69 } 70 Object component = d.getProperties().get(dckp.getKey()); 71 if (component == null) 72 { 73 throw new ObjectNotFoundException(dckp.getKey().toString()); 74 } 75 return component; 76 } 77 else 78 { 79 throw new ObjectNotFoundException(key.toString()); 80 } 81 } 82 83 } 84 | Popular Tags |