1 package org.jbpm.bpel.messager; 2 3 import java.util.ArrayList ; 4 import java.util.Iterator ; 5 import java.util.List ; 6 7 import org.jbpm.bpel.def.*; 8 import org.jbpm.bpel.service.def.Receiver; 9 import org.jbpm.bpel.service.exe.StartListener; 10 11 15 class StartListenersActivator extends BpelVisitorSupport { 16 17 private final MessagerSession msgSession; 18 private List startListeners = new ArrayList (); 19 20 public StartListenersActivator(MessagerSession msgSession) { 21 this.msgSession = msgSession; 22 } 23 24 public List getStartListeners() { 25 return startListeners; 26 } 27 28 public void visit(Receive receive) { 29 if (receive.isCreateInstance()) { 30 createListener(receive.getReceiver()); 31 } 32 } 33 34 public void visit(Pick pick) { 35 if (pick.isCreateInstance()) { 36 Iterator onMessageIt = pick.getOnMessages().iterator(); 37 while (onMessageIt.hasNext()) { 38 createListener((Receiver) onMessageIt.next()); 39 } 40 } 41 } 42 43 public void visit(Sequence sequence) { 44 ((Activity) sequence.getNodes().get(0)).accept(this); 46 } 47 48 private void createListener(Receiver receiver) { 49 StartListener listener = new StartListener(receiver); 51 listener.receiveRequest(msgSession); 52 startListeners.add(listener); 53 } 54 } 55 | Popular Tags |