use of org.apache.cxf.ws.rm.v200702.AcceptType in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 AcceptType with 200508 WS-Addressing namespace to internal form.
*
* @param exposed (may be <code>null</code>)
* @return converted (<code>null</code> if internal is <code>null</code>)
*/
public static AcceptType convert(org.apache.cxf.ws.rm.v200502wsa15.AcceptType exposed) {
if (exposed == null) {
return null;
}
AcceptType internal = new AcceptType();
internal.setAcksTo(exposed.getAcksTo());
return internal;
}
use of org.apache.cxf.ws.rm.v200702.AcceptType in project cxf by apache.
the class Servant method createSequence.
Object createSequence(Message message) {
LOG.fine("Creating sequence");
final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
Message outMessage = message.getExchange().getOutMessage();
if (null != outMessage) {
RMContextUtils.storeMAPs(maps, outMessage, false, false);
}
EncoderDecoder codec = protocol.getCodec();
CreateSequenceType create = codec.convertReceivedCreateSequence(getParameter(message));
Destination destination = reliableEndpoint.getDestination();
CreateSequenceResponseType createResponse = new CreateSequenceResponseType();
createResponse.setIdentifier(destination.generateSequenceIdentifier());
DestinationPolicyType dp = reliableEndpoint.getManager().getDestinationPolicy();
if (dp.getMaxSequences() > 0 && destination.getProcessingSequenceCount() >= dp.getMaxSequences()) {
throw new RuntimeException("Sequence creation refused");
}
Duration supportedDuration = dp.getSequenceExpiration();
if (null == supportedDuration) {
supportedDuration = DatatypeFactory.PT0S;
}
Expires ex = create.getExpires();
if (null != ex) {
Duration effectiveDuration = ex.getValue();
// PT0S represents 0 second and the shortest duration but in ws-rm, considered the longest
if (DatatypeFactory.PT0S.equals(effectiveDuration) || (!DatatypeFactory.PT0S.equals(supportedDuration) && supportedDuration.isShorterThan(effectiveDuration))) {
effectiveDuration = supportedDuration;
}
ex = new Expires();
ex.setValue(effectiveDuration);
createResponse.setExpires(ex);
}
OfferType offer = create.getOffer();
if (null != offer) {
AcceptType accept = new AcceptType();
if (dp.isAcceptOffers()) {
Source source = reliableEndpoint.getSource();
LOG.fine("Accepting inbound sequence offer");
// AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
accept.setAcksTo(RMUtils.createReference(maps.getTo().getValue()));
SourceSequence seq = new SourceSequence(offer.getIdentifier(), null, createResponse.getIdentifier(), protocol);
seq.setExpires(offer.getExpires());
seq.setTarget(create.getAcksTo());
source.addSequence(seq);
source.setCurrent(createResponse.getIdentifier(), seq);
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Making offered sequence the current sequence for responses to " + createResponse.getIdentifier().getValue());
}
} else {
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Refusing inbound sequence offer");
}
accept.setAcksTo(RMUtils.createNoneReference());
}
createResponse.setAccept(accept);
}
DestinationSequence seq = new DestinationSequence(createResponse.getIdentifier(), create.getAcksTo(), destination, protocol);
seq.setCorrelationID(maps.getMessageID().getValue());
destination.addSequence(seq);
LOG.fine("returning " + createResponse);
return codec.convertToSend(createResponse);
}
use of org.apache.cxf.ws.rm.v200702.AcceptType 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.AcceptType in project cxf by apache.
the class VersionTransformer method convert.
/**
* Convert 200502 AcceptType with 200408 WS-Addressing namespace to internal form.
*
* @param exposed (may be <code>null</code>)
* @return converted (<code>null</code> if internal is <code>null</code>)
*/
public static AcceptType convert(org.apache.cxf.ws.rm.v200502.AcceptType exposed) {
if (exposed == null) {
return null;
}
AcceptType internal = new AcceptType();
internal.setAcksTo(org.apache.cxf.ws.addressing.VersionTransformer.convert(exposed.getAcksTo()));
return internal;
}
Aggregations