01: package org.objectweb.celtix.bus.ws.rm;
02:
03: import java.util.ArrayList;
04: import java.util.Collection;
05:
06: import org.objectweb.celtix.ws.rm.AckRequestedType;
07: import org.objectweb.celtix.ws.rm.RMProperties;
08: import org.objectweb.celtix.ws.rm.SequenceAcknowledgement;
09: import org.objectweb.celtix.ws.rm.SequenceType;
10:
11: public class RMPropertiesImpl implements RMProperties {
12: private SequenceType sequence;
13: private Collection<SequenceAcknowledgement> acks;
14: private Collection<AckRequestedType> acksRequested;
15:
16: public Collection<SequenceAcknowledgement> getAcks() {
17: return acks;
18: }
19:
20: public Collection<AckRequestedType> getAcksRequested() {
21: return acksRequested;
22: }
23:
24: public SequenceType getSequence() {
25: return sequence;
26: }
27:
28: public void setAcks(Collection<SequenceAcknowledgement> a) {
29: acks = a;
30: }
31:
32: public void setAcksRequested(Collection<AckRequestedType> ar) {
33: acksRequested = ar;
34: }
35:
36: public void setSequence(SequenceType s) {
37: sequence = s;
38: }
39:
40: protected void setSequence(SourceSequence seq) {
41: SequenceType s = RMUtils.getWSRMFactory().createSequenceType();
42: s.setIdentifier(seq.getIdentifier());
43: s.setMessageNumber(seq.getCurrentMessageNr());
44: if (seq.isLastMessage()) {
45: s.setLastMessage(new SequenceType.LastMessage());
46: }
47: setSequence(s);
48: }
49:
50: protected void addAck(DestinationSequence seq) {
51: if (null == acks) {
52: acks = new ArrayList<SequenceAcknowledgement>();
53: }
54: SequenceAcknowledgement ack = seq.getAcknowledgment();
55: acks.add(ack);
56: seq.acknowledgmentSent();
57: }
58:
59: }
|