use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class RMOutInterceptor method addAckRequest.
/**
* Add AcknowledgementRequested to message if needed. The AckRequest mode set either in the message
* properties or in the source policy is used to determine whether AcknowledgementRequested is always
* added, never added, or added only when we're waiting for the acknowledgement to a previously-sent
* message.
*
* @param msg
* @param rmpsIn
* @param seq
* @param sequence
*/
protected void addAckRequest(Message msg, RMProperties rmpsIn, SourceSequence seq, SequenceType sequence) {
AckRequestModeType mode = (AckRequestModeType) msg.get(RMMessageConstants.ACK_REQUEST_MODE);
if (mode == null) {
mode = AckRequestModeType.PENDING;
SourcePolicyType policy = getManager().getSourcePolicy();
if (policy.isSetAckRequestMode()) {
mode = policy.getAckRequestMode();
}
}
if (AckRequestModeType.ALWAYS == mode || (mode == AckRequestModeType.PENDING && seq.needAcknowledge(rmpsIn.getMessageNumber()))) {
Collection<AckRequestedType> reqs = rmpsIn.getAcksRequested();
if (reqs == null) {
reqs = new ArrayList<>();
}
Identifier identifier = new Identifier();
identifier.setValue(sequence.getIdentifier().getValue());
AckRequestedType ackRequest = new AckRequestedType();
ackRequest.setIdentifier(identifier);
reqs.add(ackRequest);
rmpsIn.setAcksRequested(reqs);
}
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class Servant method clearUnattachedIdentifier.
Identifier clearUnattachedIdentifier() {
Identifier ret = unattachedIdentifier;
unattachedIdentifier = null;
return ret;
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 wsrm:Identifier with 200408 WS-Addressing namespace to internal form.
*
* @param exposed (may be <code>null</code>)
* @return converted (<code>null</code> if exposed is <code>null</code>)
*/
public static Identifier convert(org.apache.cxf.ws.rm.v200502.Identifier exposed) {
if (exposed == null) {
return null;
}
Identifier internal = new Identifier();
internal.setValue(exposed.getValue());
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
return internal;
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 wsrm:Identifier with 200508 WS-Addressing namespace to internal form.
*
* @param exposed (may be <code>null</code>)
* @return converted (<code>null</code> if exposed is <code>null</code>)
*/
public static Identifier convert(org.apache.cxf.ws.rm.v200502wsa15.Identifier exposed) {
if (exposed == null) {
return null;
}
Identifier internal = new Identifier();
internal.setValue(exposed.getValue());
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
return internal;
}
use of org.apache.cxf.ws.rm.v200502.Identifier in project cxf by apache.
the class RMTxStoreTestBase method testCreateSequenceStoreOutboundMessage.
@Test
public void testCreateSequenceStoreOutboundMessage() throws SQLException, IOException {
Identifier sid1 = null;
try {
SourceSequence seq = control.createMock(SourceSequence.class);
sid1 = new Identifier();
sid1.setValue("sequence1");
EasyMock.expect(seq.getIdentifier()).andReturn(sid1);
EasyMock.expect(seq.getExpires()).andReturn(null);
EasyMock.expect(seq.getOfferingSequenceIdentifier()).andReturn(null);
EasyMock.expect(seq.getEndpointIdentifier()).andReturn(CLIENT_ENDPOINT_ID);
EasyMock.expect(seq.getProtocol()).andReturn(ProtocolVariation.RM10WSA200408);
control.replay();
store.createSourceSequence(seq);
control.reset();
Collection<SourceSequence> seqs = store.getSourceSequences(CLIENT_ENDPOINT_ID);
assertEquals(1, seqs.size());
SourceSequence rseq = seqs.iterator().next();
assertFalse(rseq.isLastMessage());
Collection<RMMessage> out = store.getMessages(sid1, true);
assertEquals(0, out.size());
// set the last message flag
EasyMock.expect(seq.getIdentifier()).andReturn(sid1).anyTimes();
EasyMock.expect(seq.isLastMessage()).andReturn(true);
setupOutboundMessage(seq, 1L, null);
out = store.getMessages(sid1, true);
assertEquals(1, out.size());
checkRecoveredMessages(out);
// verify the updated sequence
seqs = store.getSourceSequences(CLIENT_ENDPOINT_ID);
assertEquals(1, seqs.size());
rseq = seqs.iterator().next();
assertTrue(rseq.isLastMessage());
// set the last message flag
EasyMock.expect(seq.getIdentifier()).andReturn(sid1).anyTimes();
EasyMock.expect(seq.getCurrentMessageNr()).andReturn(2L);
EasyMock.expect(seq.isLastMessage()).andReturn(true);
control.replay();
store.persistOutgoing(seq, null);
control.reset();
seqs = store.getSourceSequences(CLIENT_ENDPOINT_ID);
assertEquals(1, seqs.size());
rseq = seqs.iterator().next();
assertEquals(2, rseq.getCurrentMessageNr());
} finally {
if (null != sid1) {
store.removeSourceSequence(sid1);
}
Collection<Long> msgNrs = new ArrayList<>();
msgNrs.add(ONE);
store.removeMessages(sid1, msgNrs, true);
}
}
Aggregations