use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.
the class EncoderDecoder11Impl method buildHeaders.
@Override
protected void buildHeaders(SequenceType seq, Collection<SequenceAcknowledgement> acks, Collection<AckRequestedType> reqs, boolean last, List<Header> headers) throws JAXBException {
if (null != seq) {
LOG.log(Level.FINE, "encoding sequence into RM header");
JAXBElement<SequenceType> element = RMUtils.getWSRMFactory().createSequence(seq);
headers.add(new SoapHeader(element.getName(), element, getDataBinding(), true));
}
if (null != acks) {
LOG.log(Level.FINE, "encoding sequence acknowledgement(s) into RM header");
for (SequenceAcknowledgement ack : acks) {
headers.add(new SoapHeader(new QName(getConstants().getWSRMNamespace(), RMConstants.SEQUENCE_ACK_NAME), ack, getDataBinding()));
}
}
if (null != reqs) {
LOG.log(Level.FINE, "encoding acknowledgement request(s) into RM header");
for (AckRequestedType req : reqs) {
headers.add(new SoapHeader(new QName(getConstants().getWSRMNamespace(), RMConstants.ACK_REQUESTED_NAME), RMUtils.getWSRMFactory().createAckRequested(req), getDataBinding()));
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.
the class RMManager method recoverSourceSequence.
private void recoverSourceSequence(Endpoint endpoint, Conduit conduit, Source s, SourceSequence ss) {
Collection<RMMessage> ms = store.getMessages(ss.getIdentifier(), true);
if (null == ms || 0 == ms.size()) {
store.removeSourceSequence(ss.getIdentifier());
return;
}
LOG.log(Level.FINE, "Number of messages in sequence: {0}", ms.size());
// only recover the sequence if there are pending messages
s.addSequence(ss, false);
// choosing an arbitrary valid source sequence as the current source sequence
if (s.getAssociatedSequence(null) == null && !ss.isExpired() && !ss.isLastMessage()) {
s.setCurrent(ss);
}
// make sure this is associated with the offering id
s.setCurrent(ss.getOfferingSequenceIdentifier(), ss);
for (RMMessage m : ms) {
Message message = new MessageImpl();
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
exchange.setOutMessage(message);
if (null != conduit) {
exchange.setConduit(conduit);
message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
}
exchange.put(Endpoint.class, endpoint);
exchange.put(Service.class, endpoint.getService());
exchange.put(Binding.class, endpoint.getBinding());
exchange.put(Bus.class, bus);
SequenceType st = new SequenceType();
st.setIdentifier(ss.getIdentifier());
st.setMessageNumber(m.getMessageNumber());
RMProperties rmps = new RMProperties();
rmps.setSequence(st);
rmps.setCreatedTime(m.getCreatedTime());
rmps.exposeAs(ss.getProtocol().getWSRMNamespace());
if (ss.isLastMessage() && ss.getCurrentMessageNr() == m.getMessageNumber()) {
CloseSequenceType close = new CloseSequenceType();
close.setIdentifier(ss.getIdentifier());
rmps.setCloseSequence(close);
}
RMContextUtils.storeRMProperties(message, rmps, true);
if (null == conduit) {
String to = m.getTo();
AddressingProperties maps = new AddressingProperties();
maps.setTo(RMUtils.createReference(to));
RMContextUtils.storeMAPs(maps, message, true, false);
}
try {
// RMMessage is stored in a serialized way, therefore
// RMMessage content must be splitted into soap root message
// and attachments
PersistenceUtils.decodeRMContent(m, message);
RMContextUtils.setProtocolVariation(message, ss.getProtocol());
retransmissionQueue.addUnacknowledged(message);
} catch (IOException e) {
LOG.log(Level.SEVERE, "Error reading persisted message data", e);
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.
the class RMOutInterceptor method handle.
protected void handle(Message msg) throws SequenceFault, RMException {
AddressingProperties maps = ContextUtils.retrieveMAPs(msg, false, true, false);
if (null == maps) {
LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG");
return;
}
if (Boolean.TRUE.equals(msg.get(RMMessageConstants.RM_RETRANSMISSION))) {
return;
}
if (isRuntimeFault(msg)) {
return;
}
RMConfiguration config = getManager().getEffectiveConfiguration(msg);
String wsaNamespace = config.getAddressingNamespace();
String rmNamespace = config.getRMNamespace();
ProtocolVariation protocol = ProtocolVariation.findVariant(rmNamespace, wsaNamespace);
RMContextUtils.setProtocolVariation(msg, protocol);
Destination destination = getManager().getDestination(msg);
String action = null;
if (null != maps.getAction()) {
action = maps.getAction().getValue();
}
// make sure we use the appropriate namespace
maps.exposeAs(wsaNamespace);
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Action: " + action);
}
boolean isApplicationMessage = !RMContextUtils.isRMProtocolMessage(action);
boolean isPartialResponse = MessageUtils.isPartialResponse(msg);
RMConstants constants = protocol.getConstants();
RMProperties rmpsOut = RMContextUtils.retrieveRMProperties(msg, true);
if (isApplicationMessage && !isPartialResponse) {
addRetransmissionInterceptor(msg);
}
Identifier inSeqId = null;
if (isApplicationMessage) {
RMProperties rmpsIn = RMContextUtils.retrieveRMProperties(msg, false);
if (null != rmpsIn && null != rmpsIn.getSequence()) {
inSeqId = rmpsIn.getSequence().getIdentifier();
SourceSequence seq = rmpsIn.getSourceSequence();
SequenceType sequence = rmpsIn.getSequence();
if (seq == null || sequence == null) {
LOG.warning("sequence not set for outbound message, skipped acknowledgement request");
} else {
addAckRequest(msg, rmpsIn, seq, sequence);
}
}
}
// add Acknowledgements (to application messages or explicitly created Acknowledgement messages only)
boolean isAck = constants.getSequenceAckAction().equals(action);
boolean isClose = constants.getCloseSequenceAction().equals(action);
boolean isTerminate = constants.getTerminateSequenceAction().equals(action);
if (isApplicationMessage || isAck || isClose || isTerminate) {
AttributedURIType to = maps.getTo();
assert null != to;
addAcknowledgements(destination, rmpsOut, inSeqId, to);
if (isPartialResponse && rmpsOut.getAcks() != null && rmpsOut.getAcks().size() > 0) {
setAction(maps, constants.getSequenceAckAction());
msg.remove(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE);
isAck = true;
}
}
if (isAck || (isTerminate && RM10Constants.NAMESPACE_URI.equals(rmNamespace))) {
maps.setReplyTo(RMUtils.createNoneReference());
}
assertReliability(msg);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.
the class RMProperties method setSequence.
public void setSequence(SourceSequence seq) {
sourceSequence = seq;
messageNumber = seq.getCurrentMessageNr();
SequenceType s = new SequenceType();
s.setIdentifier(seq.getIdentifier());
s.setMessageNumber(messageNumber);
setSequence(s);
lastMessage = seq.isLastMessage();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SequenceType in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 wsrm:SequenceType with 200408 WS-Addressing namespace to internal form.
*
* @param exposed (non-<code>null</code>)
* @return converted
*/
public static SequenceType convert(org.apache.cxf.ws.rm.v200502.SequenceType exposed) {
SequenceType internal = new SequenceType();
internal.setIdentifier(convert(exposed.getIdentifier()));
internal.setMessageNumber(exposed.getMessageNumber());
addAll(exposed.getAny(), internal.getAny());
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
return internal;
}
Aggregations