1 17 package org.apache.servicemix.jbi.messaging; 18 19 import javax.jbi.messaging.RobustInOnly; 20 21 import java.io.IOException ; 22 import java.io.ObjectInput ; 23 24 29 public class RobustInOnlyImpl extends MessageExchangeImpl implements RobustInOnly { 30 31 private static final long serialVersionUID = -1606399168587959356L; 32 33 private static int[][] STATES_CONSUMER = { 34 { CAN_CONSUMER + CAN_OWNER + CAN_SET_IN_MSG + CAN_SEND + CAN_STATUS_ACTIVE, 1, -1, -1, -1}, 35 { CAN_CONSUMER, -1, 2, 3, 3 }, 36 { CAN_CONSUMER + CAN_OWNER + CAN_SEND + CAN_STATUS_DONE + CAN_STATUS_ERROR, -1, -1, 4, 4 }, 37 { CAN_CONSUMER + CAN_OWNER, -1, -1, -1, -1 }, 38 { CAN_CONSUMER, -1, -1, -1, -1 }, 39 }; 40 41 private static int[][] STATES_PROVIDER = { 42 { CAN_PROVIDER, 1, -1, -1, -1 }, 43 { CAN_PROVIDER + CAN_OWNER + CAN_SEND + CAN_SET_FAULT_MSG + CAN_STATUS_ACTIVE + CAN_STATUS_ERROR + CAN_STATUS_DONE, -1, 2, 4, 4 }, 44 { CAN_PROVIDER, -1, -1, 3, 3 }, 45 { CAN_PROVIDER + CAN_OWNER, -1, -1, -1, -1 }, 46 { CAN_PROVIDER, -1, -1, -1, -1 }, 47 }; 48 49 public RobustInOnlyImpl() { 50 } 51 52 public RobustInOnlyImpl(String exchangeId) { 53 super(exchangeId, MessageExchangeSupport.ROBUST_IN_ONLY, STATES_CONSUMER); 54 this.mirror = new RobustInOnlyImpl(this); 55 } 56 57 public RobustInOnlyImpl(ExchangePacket packet) { 58 super(packet, STATES_CONSUMER); 59 this.mirror = new RobustInOnlyImpl(this); 60 } 61 62 protected RobustInOnlyImpl(RobustInOnlyImpl mep) { 63 super(mep.packet, STATES_PROVIDER); 64 this.mirror = mep; 65 } 66 67 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 68 this.packet = new ExchangePacket(); 69 this.packet.readExternal(in); 70 if (this.packet.in != null) { 71 this.packet.in.exchange = this; 72 } 73 if (this.packet.out != null) { 74 this.packet.out.exchange = this; 75 } 76 if (this.packet.fault != null) { 77 this.packet.fault.exchange = this; 78 } 79 this.state = in.read(); 80 this.mirror = new RobustInOnlyImpl(); 81 this.mirror.mirror = this; 82 this.mirror.packet = this.packet; 83 this.mirror.state = in.read(); 84 boolean provider = in.readBoolean(); 85 if (provider) { 86 this.states = STATES_PROVIDER; 87 this.mirror.states = STATES_CONSUMER; 88 } else { 89 this.states = STATES_CONSUMER; 90 this.mirror.states = STATES_PROVIDER; 91 } 92 } 93 94 } | Popular Tags |