Package org.apache.cxf.ws.rm.v200702

Examples of org.apache.cxf.ws.rm.v200702.SequenceType


        return destination.getName();
    }
   
    public void acknowledge(Message message) throws SequenceFault {
        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
        SequenceType st = rmps.getSequence();
        long messageNumber = st.getMessageNumber().longValue();
        LOG.fine("Acknowledging message: " + messageNumber);
        if (0 != lastMessageNumber && messageNumber > lastMessageNumber) {
            RMConstants consts = getProtocol().getConstants();
            SequenceFaultFactory sff = new SequenceFaultFactory(consts);
            throw sff.createSequenceTerminatedFault(st.getIdentifier(), false);
        }       
       
        monitor.acknowledgeMessage();
       
        synchronized (this) {
View Full Code Here


     * @throws SequenceFault if the sequence specified in
     *             <code>sequenceType</code> does not exist
     */
    public void acknowledge(Message message) throws SequenceFault, RMException {
        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
        SequenceType sequenceType = rmps.getSequence();
        if (null == sequenceType) {
            return;
        }
       
        DestinationSequence seq = getSequence(sequenceType.getIdentifier());

        if (null != seq) {
            if (seq.applyDeliveryAssurance(sequenceType.getMessageNumber(), message)) {
                seq.acknowledge(message);
   
                if (null != rmps.getCloseSequence()) {
                    seq.setLastMessageNumber(sequenceType.getMessageNumber());
                    ackImmediately(seq, message);
                }
            } else {
                try {
                    message.getInterceptorChain().abort();
                    Conduit conduit = message.getExchange().getDestination()
                        .getBackChannel(message, null, null);
                    if (conduit != null) {
                        //for a one-way, the back channel could be
                        //null if it knows it cannot send anything.
                        Message partial = createMessage(message.getExchange());
                        partial.remove(Message.CONTENT_TYPE);
                        partial.setExchange(message.getExchange());
                        conduit.prepare(partial);
                        conduit.close(partial);
                    }
                } catch (IOException e) {
                    LOG.log(Level.SEVERE, e.getMessage());
                    throw new RMException(e);
                }
            }
        } else {
            RMConstants consts = getReliableEndpoint().getProtocol().getConstants();
            SequenceFaultFactory sff = new SequenceFaultFactory(consts);
            throw sff.createUnknownSequenceFault(sequenceType.getIdentifier());
        }

        RMStore store = getReliableEndpoint().getManager().getStore();
        if (null != store) {
            CachedOutputStream saved =
                (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT);
            RMMessage msg = new RMMessage();
            msg.setMessageNumber(sequenceType.getMessageNumber());
            msg.setContent(saved);
            store.persistIncoming(seq, msg);
        }

    }
View Full Code Here

            getReliableEndpoint().getProxy().acknowledge(seq);                   
        }
    }
   
    void processingComplete(Message message) {
        SequenceType sequenceType = RMContextUtils.retrieveRMProperties(message, false).getSequence();
        if (null == sequenceType) {
            return;
        }
       
        DestinationSequence seq = getSequence(sequenceType.getIdentifier());

        if (null != seq) {
            long mn = sequenceType.getMessageNumber().longValue();
            seq.processingComplete(mn);
            seq.purgeAcknowledged(mn);
        }
    }
View Full Code Here

            if (null != sequenceCandidates) {
                for (int i = sequenceCandidates.size() - 1; i >= 0; i--) {
                    ResendCandidate candidate = sequenceCandidates.get(i);
                    RMProperties properties = RMContextUtils.retrieveRMProperties(candidate.getMessage(),
                                                                                  true);
                    SequenceType st = properties.getSequence();
                    long m = st.getMessageNumber().longValue();
                    if (seq.isAcknowledged(m)) {
                        sequenceCandidates.remove(i);
                        candidate.resolved();
                        purged.add(m);
                    }
View Full Code Here

        if (null != sequenceCandidates) {
            for (int i = 0; i < sequenceCandidates.size(); i++) {
                ResendCandidate candidate = sequenceCandidates.get(i);
                RMProperties properties = RMContextUtils.retrieveRMProperties(candidate.getMessage(),
                                                                              true);
                SequenceType st = properties.getSequence();
                unacknowledged.add(st.getMessageNumber());
            }
        }
        return unacknowledged;
    }
View Full Code Here

        if (null != sequenceCandidates) {
            for (int i = 0; i < sequenceCandidates.size(); i++) {
                ResendCandidate candidate = sequenceCandidates.get(i);
                RMProperties properties = RMContextUtils.retrieveRMProperties(candidate.getMessage(),
                                                                              true);
                SequenceType st = properties.getSequence();
                if (num == st.getMessageNumber()) {
                    return candidate;
                }
            }
        }
        return null;
View Full Code Here

        if (null != sequenceCandidates) {
            for (int i = 0; i < sequenceCandidates.size(); i++) {
                ResendCandidate candidate = sequenceCandidates.get(i);
                RMProperties properties = RMContextUtils.retrieveRMProperties(candidate.getMessage(),
                                                                              true);
                SequenceType st = properties.getSequence();
                cp.put(st.getMessageNumber(), candidate);
            }
        }
        return cp;
    }
View Full Code Here

     * @param ctx the message context.
     * @return ResendCandidate
     */   
    protected ResendCandidate cacheUnacknowledged(Message message) {
        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
        SequenceType st = rmps.getSequence();
        Identifier sid = st.getIdentifier();
        String key = sid.getValue();
       
        ResendCandidate candidate = null;
       
        synchronized (this) {
View Full Code Here

     */
    protected final Resender getDefaultResender() {
        return new Resender() {
            public void resend(Message message, boolean requestAcknowledge) {
                RMProperties properties = RMContextUtils.retrieveRMProperties(message, true);
                SequenceType st = properties.getSequence();
                if (st != null) {
                    LOG.log(Level.INFO, "RESEND_MSG", st.getMessageNumber());
                }
                try {
                    // TODO: remove previously added acknowledgments and update
                    // message id (to avoid duplicates)

View Full Code Here

     * @throws SequenceFault if the sequence specified in
     *             <code>sequenceType</code> does not exist
     */
    public void acknowledge(Message message) throws SequenceFault, RMException {
        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
        SequenceType sequenceType = rmps.getSequence();
        if (null == sequenceType) {
            return;
        }
       
        DestinationSequence seq = getSequence(sequenceType.getIdentifier());

        if (null != seq) {
            if (seq.applyDeliveryAssurance(sequenceType.getMessageNumber(), message)) {
                if (MessageUtils.isTrue(message.get(RMMessageConstants.DELIVERING_ROBUST_ONEWAY))) {
                    return;
                }
   
                seq.acknowledge(message);

                if (null != rmps.getCloseSequence()) {
                    seq.setLastMessageNumber(sequenceType.getMessageNumber());
                    ackImmediately(seq, message);
                }
            } else {
                try {
                    message.getInterceptorChain().abort();
                    Conduit conduit = message.getExchange().getDestination()
                        .getBackChannel(message, null, null);
                    if (conduit != null) {
                        //for a one-way, the back channel could be
                        //null if it knows it cannot send anything.
                        Message partial = createMessage(message.getExchange());
                        partial.remove(Message.CONTENT_TYPE);
                        partial.setExchange(message.getExchange());
                        conduit.prepare(partial);
                        conduit.close(partial);
                    }
                } catch (IOException e) {
                    LOG.log(Level.SEVERE, e.getMessage());
                    throw new RMException(e);
                }
            }
        } else {
            ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
            RMConstants consts = protocol.getConstants();
            SequenceFaultFactory sff = new SequenceFaultFactory(consts);
            throw sff.createUnknownSequenceFault(sequenceType.getIdentifier());
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.rm.v200702.SequenceType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.