1 10 11 package org.mule.components.simple; 12 13 import org.mule.impl.UMODescriptorAware; 14 import org.mule.routing.inbound.ForwardingConsumer; 15 import org.mule.umo.UMODescriptor; 16 import org.mule.umo.UMOEventContext; 17 import org.mule.umo.lifecycle.Callable; 18 import org.mule.umo.routing.UMOInboundRouter; 19 20 import java.util.Iterator ; 21 22 29 public class BridgeComponent implements UMODescriptorAware, Callable 30 { 31 32 public void setDescriptor(UMODescriptor descriptor) 33 { 34 37 boolean registered = false; 39 for (Iterator iterator = descriptor.getInboundRouter().getRouters().iterator(); iterator.hasNext();) 40 { 41 UMOInboundRouter router = (UMOInboundRouter)iterator.next(); 42 if (router instanceof ForwardingConsumer) 43 { 44 registered = true; 45 } 46 47 } 48 if (!registered) 49 { 50 descriptor.getInboundRouter().addRouter(new ForwardingConsumer()); 51 } 52 descriptor.getInboundRouter().setMatchAll(true); 54 } 55 56 public Object onCall(UMOEventContext context) throws Exception 57 { 58 throw new UnsupportedOperationException ( 59 "A bridge should not ever receive an event, instead the event should be directly dispatched from the inbound endpoint to the outbound router. Component is: " 60 + context.getComponentDescriptor().getName()); 61 } 62 } 63 | Popular Tags |