use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class ManagedRMEndpoint method getDestinationSeq.
private DestinationSequence getDestinationSeq(String sid) {
Destination destination = endpoint.getDestination();
Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
identifier.setValue(sid);
return destination.getSequence(identifier);
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class Servant method closeSequence.
public Object closeSequence(Message message) {
LOG.fine("Closing sequence");
CloseSequenceType close = (CloseSequenceType) getParameter(message);
// check if the terminated sequence was created in response to a a createSequence
// request
Destination destination = reliableEndpoint.getDestination();
Identifier sid = close.getIdentifier();
DestinationSequence closedSeq = destination.getSequence(sid);
if (null == closedSeq) {
// TODO
LOG.severe("No such sequence.");
return null;
}
closedSeq.scheduleImmediateAcknowledgement();
closedSeq.setLastMessageNumber(close.getLastMsgNumber());
CloseSequenceResponseType closeResponse = new CloseSequenceResponseType();
closeResponse.setIdentifier(close.getIdentifier());
AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
Message outMessage = message.getExchange().getOutMessage();
if (null == outMessage) {
// outMessage may be null e.g. if ReplyTo is not set for TS
outMessage = ContextUtils.createMessage(message.getExchange());
message.getExchange().setOutMessage(outMessage);
}
if (null != outMessage) {
RMContextUtils.storeMAPs(maps, outMessage, false, false);
}
return closeResponse;
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class Servant method terminateSequence.
public Object terminateSequence(Message message) {
LOG.fine("Terminating sequence");
final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
EncoderDecoder codec = protocol.getCodec();
TerminateSequenceType terminate = codec.convertReceivedTerminateSequence(getParameter(message));
// check if the terminated sequence was created in response to a a createSequence
// request
Destination destination = reliableEndpoint.getDestination();
Identifier sid = terminate.getIdentifier();
DestinationSequence terminatedSeq = destination.getSequence(sid);
if (null != terminatedSeq) {
destination.terminateSequence(terminatedSeq);
}
// the following may be necessary if the last message for this sequence was a oneway
// request and hence there was no response to which a last message could have been added
// REVISIT: A last message for the correlated sequence should have been sent by the time
// the last message for the underlying sequence was received.
Source source = reliableEndpoint.getSource();
for (SourceSequence outboundSeq : source.getAllSequences()) {
if (outboundSeq.offeredBy(sid) && !outboundSeq.isLastMessage()) {
if (outboundSeq.getCurrentMessageNr() == 0) {
source.removeSequence(outboundSeq);
}
break;
}
}
TerminateSequenceResponseType terminateResponse = null;
if (RM11Constants.NAMESPACE_URI.equals(protocol.getWSRMNamespace())) {
AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
Message outMessage = message.getExchange().getOutMessage();
if (null == outMessage) {
// outMessage may be null e.g. if ReplyTo is not set for TS
outMessage = ContextUtils.createMessage(message.getExchange());
message.getExchange().setOutMessage(outMessage);
}
if (null != outMessage) {
RMContextUtils.storeMAPs(maps, outMessage, false, false);
}
terminateResponse = new TerminateSequenceResponseType();
terminateResponse.setIdentifier(sid);
}
return terminateResponse;
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class Servant method createSequenceResponse.
public void createSequenceResponse(CreateSequenceResponseType createResponse, ProtocolVariation protocol) {
LOG.fine("Creating sequence response");
SourceSequence seq = new SourceSequence(createResponse.getIdentifier(), protocol);
seq.setExpires(createResponse.getExpires());
Source source = reliableEndpoint.getSource();
source.addSequence(seq);
// the incoming sequence ID is either used as the requestor sequence
// (signalled by null) or associated with a corresponding sequence
// identifier
source.setCurrent(clearUnattachedIdentifier(), seq);
// if a sequence was offered and accepted, then we can add this to
// to the local destination sequence list, otherwise we have to wait for
// and incoming CreateSequence request
Identifier offeredId = reliableEndpoint.getProxy().getOfferedIdentifier();
if (null != offeredId) {
AcceptType accept = createResponse.getAccept();
if (accept != null) {
Destination dest = reliableEndpoint.getDestination();
String address = accept.getAcksTo().getAddress().getValue();
if (!RMUtils.getAddressingConstants().getNoneURI().equals(address)) {
DestinationSequence ds = new DestinationSequence(offeredId, accept.getAcksTo(), dest, protocol);
dest.addSequence(ds);
}
}
}
}
use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.
the class RMInInterceptor method processAcknowledgments.
void processAcknowledgments(RMEndpoint rme, RMProperties rmps, ProtocolVariation protocol) throws SequenceFault, RMException {
Collection<SequenceAcknowledgement> acks = rmps.getAcks();
Source source = rme.getSource();
if (null != acks) {
for (SequenceAcknowledgement ack : acks) {
Identifier id = ack.getIdentifier();
SourceSequence ss = source.getSequence(id);
if (null != ss) {
ss.setAcknowledged(ack);
} else {
RMConstants consts = protocol.getConstants();
SequenceFaultFactory sff = new SequenceFaultFactory(consts);
throw sff.createUnknownSequenceFault(id);
}
}
}
}
Aggregations