Search in sources :

Example 21 with SequenceAcknowledgement

use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.

the class EncoderDecoder10Impl method decodeSequenceAcknowledgement.

public SequenceAcknowledgement decodeSequenceAcknowledgement(Element elem) throws JAXBException {
    Unmarshaller unmarshaller = getContext().createUnmarshaller();
    org.apache.cxf.ws.rm.v200502.SequenceAcknowledgement ack = (org.apache.cxf.ws.rm.v200502.SequenceAcknowledgement) unmarshaller.unmarshal(elem);
    return VersionTransformer.convert(ack);
}
Also used : SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 22 with SequenceAcknowledgement

use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.

the class EncoderDecoder10Impl method buildHeaderFaultObject.

@Override
protected Object buildHeaderFaultObject(SequenceFault sf) {
    org.apache.cxf.ws.rm.v200502.SequenceFaultType flt = new org.apache.cxf.ws.rm.v200502.SequenceFaultType();
    flt.setFaultCode(sf.getFaultCode());
    Object detail = sf.getDetail();
    if (detail instanceof Element) {
        flt.getAny().add(detail);
    } else if (detail instanceof Identifier) {
        flt.getAny().add(VersionTransformer.convert200502((Identifier) detail));
    } else if (detail instanceof SequenceAcknowledgement) {
        flt.getAny().add(VersionTransformer.convert200502((SequenceAcknowledgement) detail));
    }
    Element data = sf.getExtraDetail();
    if (data != null) {
        flt.getAny().add(data);
    }
    return flt;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 23 with SequenceAcknowledgement

use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement 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()));
        }
    }
}
Also used : QName(javax.xml.namespace.QName) SoapHeader(org.apache.cxf.binding.soap.SoapHeader) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType) CreateSequenceType(org.apache.cxf.ws.rm.v200702.CreateSequenceType) TerminateSequenceType(org.apache.cxf.ws.rm.v200702.TerminateSequenceType) CloseSequenceType(org.apache.cxf.ws.rm.v200702.CloseSequenceType) SequenceType(org.apache.cxf.ws.rm.v200702.SequenceType) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 24 with SequenceAcknowledgement

use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement 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);
            }
        }
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 25 with SequenceAcknowledgement

use of org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement in project cxf by apache.

the class VersionTransformer method convert.

/**
 * Convert 200502 wsrm:SequenceAcknowledgement with 200408 WS-Addressing namespace to internal form.
 *
 * @param exposed (non-<code>null</code>)
 * @return converted
 */
public static SequenceAcknowledgement convert(org.apache.cxf.ws.rm.v200502.SequenceAcknowledgement exposed) {
    SequenceAcknowledgement internal = new SequenceAcknowledgement();
    internal.setIdentifier(convert(exposed.getIdentifier()));
    List<SequenceAcknowledgement.AcknowledgementRange> internalRanges = internal.getAcknowledgementRange();
    for (org.apache.cxf.ws.rm.v200502.SequenceAcknowledgement.AcknowledgementRange range : exposed.getAcknowledgementRange()) {
        SequenceAcknowledgement.AcknowledgementRange internalRange = new SequenceAcknowledgement.AcknowledgementRange();
        internalRange.setLower(range.getLower());
        internalRange.setUpper(range.getUpper());
        internalRanges.add(internalRange);
        putAll(range.getOtherAttributes(), internalRange.getOtherAttributes());
    }
    addAll(exposed.getAny(), internal.getAny());
    putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
    return internal;
}
Also used : SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Aggregations

SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)33 Test (org.junit.Test)11 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)10 ArrayList (java.util.ArrayList)6 AckRequestedType (org.apache.cxf.ws.rm.v200702.AckRequestedType)6 AcknowledgementRange (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange)5 SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)5 Element (org.w3c.dom.Element)5 ProtocolVariation (org.apache.cxf.ws.rm.ProtocolVariation)4 CloseSequenceType (org.apache.cxf.ws.rm.v200702.CloseSequenceType)4 CreateSequenceType (org.apache.cxf.ws.rm.v200702.CreateSequenceType)4 TerminateSequenceType (org.apache.cxf.ws.rm.v200702.TerminateSequenceType)4 InputStream (java.io.InputStream)3 Connection (java.sql.Connection)3 JAXBElement (javax.xml.bind.JAXBElement)3 QName (javax.xml.namespace.QName)3 SoapHeader (org.apache.cxf.binding.soap.SoapHeader)3 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)3 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)3 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)3