1 package org.jbpm.bpel.def; 2 3 import org.w3c.dom.Element ; 4 5 import org.jbpm.graph.exe.ExecutionContext; 6 import org.jbpm.graph.exe.Token; 7 8 import org.jbpm.bpel.service.def.Receiver; 9 import org.jbpm.bpel.service.def.InboundMessageActivity; 10 11 17 public class Receive extends Activity implements InboundMessageActivity { 18 19 private static final long serialVersionUID = 1L; 20 21 private boolean createInstance; 22 private Receiver receiver; 23 24 public Receive() { 25 } 26 27 public Receive(String name) { 28 super(name); 29 } 30 31 public void execute(ExecutionContext context) { 32 receiver.receive( context.getToken() ); 33 } 34 35 public void messageReceived(Receiver receiver, Element element, Token token) { 36 if (this != token.getNode()) { 37 throw new AssertionError ("token must be located at receive: " + 38 "token=" + token + ", node=" + token.getNode()); 39 } 40 receiver.readMessage(element, token); 41 receiver.close(token); 42 leave(new ExecutionContext(token)); 43 } 44 45 public Receiver getReceiver() { 46 return receiver; 47 } 48 49 public void setReceiver(Receiver receiver) { 51 this.receiver = receiver; 52 } 53 54 public boolean isCreateInstance() { 55 return createInstance; 56 } 57 58 public void setCreateInstance(boolean createInstance) { 59 this.createInstance = createInstance; 60 } 61 62 63 public void accept(BpelVisitor visitor) { 64 visitor.visit(this); 65 } 66 } | Popular Tags |