use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMCaptureOutInterceptor method setTerminateSequence.
private void setTerminateSequence(Message msg, Identifier identifier, ProtocolVariation protocol) throws RMException {
TerminateSequenceType ts = new TerminateSequenceType();
ts.setIdentifier(identifier);
MessageContentsList contents = new MessageContentsList(new Object[] { protocol.getCodec().convertToSend(ts) });
msg.setContent(List.class, contents);
// create a new exchange for this output-only exchange
Exchange newex = new ExchangeImpl();
Exchange oldex = msg.getExchange();
newex.put(Bus.class, oldex.getBus());
newex.put(Endpoint.class, oldex.getEndpoint());
newex.put(Service.class, oldex.getEndpoint().getService());
newex.put(Binding.class, oldex.getEndpoint().getBinding());
newex.setConduit(oldex.getConduit(msg));
newex.setDestination(oldex.getDestination());
// Setup the BindingOperationInfo
RMEndpoint rmep = getManager().getReliableEndpoint(msg);
OperationInfo oi = rmep.getEndpoint(protocol).getEndpointInfo().getService().getInterface().getOperation(protocol.getConstants().getTerminateSequenceAnonymousOperationName());
BindingInfo bi = rmep.getBindingInfo(protocol);
BindingOperationInfo boi = bi.getOperation(oi);
newex.put(BindingInfo.class, bi);
newex.put(BindingOperationInfo.class, boi);
msg.setExchange(newex);
newex.setOutMessage(msg);
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RetransmissionQueueImpl method purgeCandidates.
private void purgeCandidates(SourceSequence seq, boolean any) {
Collection<Long> purged = new ArrayList<>();
Collection<ResendCandidate> resends = new ArrayList<>();
Identifier sid = seq.getIdentifier();
synchronized (this) {
LOG.fine("Start purging resend candidates.");
List<ResendCandidate> sequenceCandidates = getSequenceCandidates(seq);
if (null != sequenceCandidates) {
for (int i = sequenceCandidates.size() - 1; i >= 0; i--) {
ResendCandidate candidate = sequenceCandidates.get(i);
long m = candidate.getNumber();
if (any || seq.isAcknowledged(m)) {
sequenceCandidates.remove(i);
candidate.resolved();
unacknowledgedCount--;
purged.add(m);
resends.add(candidate);
}
}
if (sequenceCandidates.isEmpty()) {
candidates.remove(sid.getValue());
}
}
LOG.fine("Completed purging resend candidates.");
}
if (!purged.isEmpty()) {
RMStore store = manager.getStore();
if (null != store) {
store.removeMessages(sid, purged, true);
}
RMEndpoint rmEndpoint = seq.getSource().getReliableEndpoint();
for (ResendCandidate resend : resends) {
rmEndpoint.handleAcknowledgment(sid.getValue(), resend.getNumber(), resend.getMessage());
}
}
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class DestinationSequenceTest method testConstructors.
@Test
public void testConstructors() {
Identifier otherId = factory.createIdentifier();
otherId.setValue("otherSeq");
DestinationSequence seq = new DestinationSequence(id, ref, destination, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertEquals(0L, seq.getLastMessageNumber());
assertSame(ref, seq.getAcksTo());
assertNotNull(seq.getAcknowledgment());
assertNotNull(seq.getMonitor());
SequenceAcknowledgement ack = new SequenceAcknowledgement();
seq = new DestinationSequence(id, ref, 10L, ack, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertEquals(10L, seq.getLastMessageNumber());
assertSame(ref, seq.getAcksTo());
assertSame(ack, seq.getAcknowledgment());
assertNotNull(seq.getMonitor());
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class ManagedRMManagerTest method createTestDestinationSequence.
private DestinationSequence createTestDestinationSequence(Destination destination, String sid, EndpointReferenceType to, ProtocolVariation protocol, long[] acked) {
Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
identifier.setValue(sid);
DestinationSequence ds = new DestinationSequence(identifier, to, null, protocol);
ds.setDestination(destination);
List<SequenceAcknowledgement.AcknowledgementRange> ranges = ds.getAcknowledgment().getAcknowledgementRange();
for (int i = 0; i < acked.length; i += 2) {
ranges.add(createAcknowledgementRange(acked[i], acked[i + 1]));
}
return ds;
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMTxStoreTestBase method testGetSourceSequence.
@Test
public void testGetSourceSequence() throws SQLException, IOException {
Identifier sid1 = null;
Identifier sid2 = null;
SourceSequence seq = store.getSourceSequence(new Identifier());
assertNull(seq);
try {
sid1 = setupSourceSequence("sequence1");
seq = store.getSourceSequence(sid1);
assertNotNull(seq);
verifySourceSequence("sequence1", seq);
sid2 = setupSourceSequence("sequence2");
seq = store.getSourceSequence(sid2);
assertNotNull(seq);
verifySourceSequence("sequence2", seq);
} finally {
if (null != sid1) {
store.removeSourceSequence(sid1);
}
if (null != sid2) {
store.removeSourceSequence(sid2);
}
}
}
Aggregations