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

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


     */
    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


     * @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) {
            List<ResendCandidate> sequenceCandidates = getSequenceCandidates(key);
            if (null == sequenceCandidates) {
                sequenceCandidates = new ArrayList<ResendCandidate>();
                candidates.put(key, sequenceCandidates);
            }
            candidate = new ResendCandidate(message);
            if (isSequenceSuspended(key)) {
                candidate.suspend();
            }
            sequenceCandidates.add(candidate);
            unacknowledgedCount++;
        }
        LOG.fine("Cached unacknowledged message.");
        try {
            RMEndpoint rme = manager.getReliableEndpoint(message);
            rme.handleAccept(key, st.getMessageNumber(), message);
        } catch (RMException e) {
            LOG.log(Level.WARNING, "Could not find reliable endpoint for message");
        }
        return candidate;
    }
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());
                }
                if (message instanceof SoapMessage) {
                    doResend((SoapMessage)message);
                } else {
                    doResend(new SoapMessage(message));
View Full Code Here

            } else {
                retransmitChain.doIntercept(message);
            }
            if (LOG.isLoggable(Level.INFO)) {
                RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
                SequenceType seq = rmps.getSequence();
                LOG.log(Level.INFO, "Retransmitted message " + seq.getMessageNumber() + " in sequence "
                    + seq.getIdentifier().getValue());
                rmps = new RMProperties();
            }
           
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, "RESEND_FAILED_MSG", ex);
View Full Code Here

        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) {
            boolean done = false;
            int i = 0;
            for (; i < acknowledgement.getAcknowledgementRange().size(); i++) {
                AcknowledgementRange r = acknowledgement.getAcknowledgementRange().get(i);
                if (r.getLower().compareTo(messageNumber) <= 0
                    && r.getUpper().compareTo(messageNumber) >= 0) {
                    done = true;
                    break;
                }
                long diff = r.getLower() - messageNumber;
                if (diff == 1) {
                    r.setLower(messageNumber);
                    done = true;
                } else if (diff > 0) {
                    break;
                } else if (messageNumber - r.getUpper().longValue() == 1) {
                    r.setUpper(messageNumber);
                    done = true;
                    break;
                }
            }

            if (!done) {
               
                // need new acknowledgement range
                AcknowledgementRange range = new AcknowledgementRange();
                range.setLower(messageNumber);
                range.setUpper(messageNumber);
                acknowledgement.getAcknowledgementRange().add(i, range);
                if (acknowledgement.getAcknowledgementRange().size() > 1) {
                   
                    // acknowledge out-of-order at first opportunity
                    scheduleImmediateAcknowledgement();
                   
                }
            }
            mergeRanges();
        }

        RMStore store = destination.getManager().getStore();
        if (null != store) {
            RMMessage msg = null;
            if (!MessageUtils.isTrue(message.getContextualProperty(Message.ROBUST_ONEWAY))) {
                msg = new RMMessage();
                RewindableInputStream in = (RewindableInputStream)message.get(RMMessageConstants.SAVED_CONTENT);
                in.rewind();
                msg.setContent(in);
                msg.setMessageNumber(st.getMessageNumber());
            }
            store.persistIncoming(this, msg);
        }
       
        RMEndpoint reliableEndpoint = destination.getReliableEndpoint();
View Full Code Here

        final CoordinationContext currentContext)
        throws InvalidCreateParametersException, SoapFault
    {
        final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(activationCoordinatorURI, messageID) ;
       
        final Expires expiresValue;
        if (expires == null) {
            expiresValue = null;
        } else {
            expiresValue = new Expires();
            expiresValue.setValue(expires.longValue());
        }

        try
        {
            CreateCoordinationContextResponseType response;
View Full Code Here

        CoordinationContext testCoordinationContext = new CoordinationContext();
        CoordinationContext.Identifier identifier = new CoordinationContext.Identifier();
        identifier.setValue(Integer.toString(nextIdentifier()));
        testCoordinationContext.setIdentifier(identifier);
        if (expires != null && expires.longValue() > 0) {
            Expires expiresInstance = new Expires();
            expiresInstance.setValue(expires);
            testCoordinationContext.setExpires(expiresInstance);
        }
        testCoordinationContext.setCoordinationType(_coordinationType) ;
        testCoordinationContext.setRegistrationService(registrationService) ;
View Full Code Here

                identifier.setValue("urn:"+arjunaContext.getTransactionIdentifier());
                coordinationContext.setIdentifier(identifier) ;
                final int transactionExpires = arjunaContext.getTransactionExpires();
                if (transactionExpires > 0)
                {
                    Expires expiresInstance = new Expires();
                    expiresInstance.setValue(transactionExpires);
                    coordinationContext.setExpires(expiresInstance);
                }
                W3CEndpointReference registrationCoordinator = getRegistrationCoordinator(registrationCoordinatorURI, arjunaContext);
                coordinationContext.setRegistrationService(registrationCoordinator) ;

        /*
         * Now add the registrar for this specific coordinator to the
         * mapper.
         */

        _coordManager.enlistSynchronization(new CleanupSynchronization(_coordManager.identifier().toString(), _theRegistrar));

        /*
         * TODO Uughh! This does a suspend for us! Left over from original
         * WS-AS stuff.
         *
         * TODO
         * REFACTOR, REFACTOR, REFACTOR.
         */

        _theRegistrar.associate();

        return coordinationContext;
                } else {
                    // we need to create a subordinate transaction and register it as both a durable and volatile
                    // participant with the registration service defined in the current context

                    SubordinateCoordinator subTx = (SubordinateCoordinator) createSubordinate();
                    // hmm, need to create wrappers here as the subTx is in WSCF which only knows
                    // about WSAS and WS-C and the participant is in WS-T
                    String vtppid = subTx.getVolatile2PhaseId();
                    String dtppid = subTx.getDurable2PhaseId();
                    Volatile2PCParticipant vtpp = new SubordinateVolatile2PCStub(subTx);
                    Durable2PCParticipant dtpp = new SubordinateDurable2PCStub(subTx);
                    final String messageId = MessageId.getMessageId() ;
                    W3CEndpointReference participant;
                    W3CEndpointReference coordinator;
                    participant= getParticipant(vtppid, isSecure);
                    coordinator = RegistrationCoordinator.register(currentContext, messageId, participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC) ;
                    ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(vtpp, vtppid, coordinator), vtppid) ;
                    participant= getParticipant(dtppid, isSecure);
                    coordinator = RegistrationCoordinator.register(currentContext, messageId, participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC) ;
                    ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(dtpp, dtppid, coordinator), dtppid) ;

                    // ok now create the context
                    final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
                    final String registrationCoordinatorURI = serviceRegistry.getServiceURI(CoordinationConstants.REGISTRATION_SERVICE_NAME, isSecure) ;

                    final CoordinationContext coordinationContext = new CoordinationContext() ;
                    coordinationContext.setCoordinationType(coordinationTypeURI);
                    CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier();
                    String txId = subTx.get_uid().stringForm();
                    identifier.setValue("urn:" + txId);
                    coordinationContext.setIdentifier(identifier) ;
                    Expires expiresInstance = currentContext.getExpires();
                    final long transactionExpires = (expiresInstance != null ? expiresInstance.getValue() : 0);
                    if (transactionExpires > 0)
                    {
                        expiresInstance = new Expires();
                        expiresInstance.setValue(transactionExpires);
                        coordinationContext.setExpires(expiresInstance);
                    }
                    W3CEndpointReference registrationCoordinator = getRegistrationCoordinator(registrationCoordinatorURI, txId);
                    coordinationContext.setRegistrationService(registrationCoordinator) ;

View Full Code Here

        String txId = subTx.get_uid().stringForm();
        identifier.setValue("urn:" + txId);
        coordinationContext.setIdentifier(identifier) ;
        if (expires != null && expires.longValue() > 0)
        {
            Expires expiresInstance = new Expires();
            expiresInstance.setValue(expires);
            coordinationContext.setExpires(expiresInstance);
        }
        W3CEndpointReference registrationCoordinator = getRegistrationCoordinator(registrationCoordinatorURI, txId);
        coordinationContext.setRegistrationService(registrationCoordinator) ;
View Full Code Here

            identifier.setValue("urn:"+arjunaContext.getTransactionIdentifier());
            coordinationContext.setIdentifier(identifier) ;
            final int transactionExpires = arjunaContext.getTransactionExpires() ;
            if (transactionExpires > 0)
            {
                Expires expiresInstance = new Expires();
                expiresInstance.setValue(transactionExpires);
                coordinationContext.setExpires(expiresInstance);
            }
            final W3CEndpointReference registrationCoordinator = getRegistrationCoordinator(registrationCoordinatorURI, arjunaContext);
            coordinationContext.setRegistrationService(registrationCoordinator) ;
View Full Code Here

TOP

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

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.