1 10 11 package org.mule.impl.model.direct; 12 13 import org.mule.impl.MuleDescriptor; 14 import org.mule.impl.MuleMessage; 15 import org.mule.impl.model.AbstractComponent; 16 import org.mule.impl.model.DefaultMuleProxy; 17 import org.mule.impl.model.MuleProxy; 18 import org.mule.umo.UMOEvent; 19 import org.mule.umo.UMOException; 20 import org.mule.umo.UMOMessage; 21 import org.mule.umo.lifecycle.InitialisationException; 22 import org.mule.umo.model.UMOModel; 23 24 import java.util.List ; 25 26 33 public class DirectComponent extends AbstractComponent 34 { 35 38 private static final long serialVersionUID = -8590955440156945732L; 39 40 protected List interceptorList = null; 41 protected MuleProxy proxy; 42 43 public DirectComponent(MuleDescriptor descriptor, UMOModel model) 44 { 45 super(descriptor, model); 46 } 47 48 protected void doInitialise() throws InitialisationException 49 { 50 51 try 52 { 53 Object component = lookupComponent(); 54 proxy = new DefaultMuleProxy(component, descriptor, null); 55 proxy.setStatistics(getStatistics()); 56 } 57 catch (UMOException e) 58 { 59 throw new InitialisationException(e, this); 60 } 61 } 62 63 protected UMOMessage doSend(UMOEvent event) throws UMOException 64 { 65 66 Object obj = proxy.onCall(event); 67 if (obj instanceof UMOMessage) 68 { 69 return (UMOMessage)obj; 70 } 71 else 72 { 73 return new MuleMessage(obj, event.getMessage()); 74 } 75 } 76 77 protected void doDispatch(UMOEvent event) throws UMOException 78 { 79 proxy.onCall(event); 80 } 81 82 protected void doStop() throws UMOException 83 { 84 proxy.stop(); 85 } 86 87 protected void doStart() throws UMOException 88 { 89 proxy.start(); 90 } 91 92 protected void doPause() 93 { 94 proxy.suspend(); 95 } 96 97 protected void doResume() 98 { 99 proxy.resume(); 100 } 101 102 protected void doDispose() 103 { 104 proxy.dispose(); 105 } 106 } 107 | Popular Tags |