Package org.apache.cxf.ws.rm

Examples of org.apache.cxf.ws.rm.RMConfiguration


                    if (rmUri != null && rmUri.equals(ns)) {
                        if (codec == null) {
                            String wsauri = null;
                            AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
                            if (maps == null) {
                                RMConfiguration config = getManager(message).getEffectiveConfiguration(message);
                                wsauri = config.getAddressingNamespace();
                            } else {
                                wsauri = maps.getNamespaceURI();
                            }
                            ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, wsauri);
                            if (protocol == null) {
View Full Code Here


         * @param ctx message context for the unacked message
         */
        protected ResendCandidate(Message m) {
            message = m;
            retries = 0;
            RMConfiguration cfg = manager.getEffectiveConfiguration(message);
            long baseRetransmissionInterval =
                cfg.getBaseRetransmissionInterval().longValue();
            backoff = cfg.isExponentialBackoff()  ? RetransmissionQueue.DEFAULT_EXPONENTIAL_BACKOFF : 1;
            next = new Date(System.currentTimeMillis() + baseRetransmissionInterval);
            nextInterval = baseRetransmissionInterval * backoff;
            RetryPolicyType rmrp = null != manager.getSourcePolicy()
                ? manager.getSourcePolicy().getRetryPolicy() : null;
            maxRetries = null != rmrp ? rmrp.getMaxRetries() : -1;
View Full Code Here

       
        return message;
    }
   
    private void setupMessagePolicies(Message message) {
        RMConfiguration cfg = new RMConfiguration();
        EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(cfg);
        cfg.setBaseRetransmissionInterval(new Long(5000));
        cfg.setExponentialBackoff(true);
    }
View Full Code Here

         */
        protected ResendCandidate(Message m) {
            message = m;
            retries = 0;
            out = m.getContent(OutputStream.class);
            RMConfiguration cfg = manager.getEffectiveConfiguration(message);
            long baseRetransmissionInterval =
                cfg.getBaseRetransmissionInterval().longValue();
            backoff = cfg.isExponentialBackoff()  ? RetransmissionQueue.DEFAULT_EXPONENTIAL_BACKOFF : 1;
            next = new Date(System.currentTimeMillis() + baseRetransmissionInterval);
            nextInterval = baseRetransmissionInterval * backoff;
            RetryPolicyType rmrp = null != manager.getSourcePolicy()
                ? manager.getSourcePolicy().getRetryPolicy() : null;
            maxRetries = null != rmrp ? rmrp.getMaxRetries() : -1;
View Full Code Here

                    if (rmUri != null && rmUri.equals(ns)) {
                        if (codec == null) {
                            String wsauri = null;
                            AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
                            if (maps == null) {
                                RMConfiguration config = getManager(message).getEffectiveConfiguration(message);
                                wsauri = config.getAddressingNamespace();
                            } else {
                                wsauri = maps.getNamespaceURI();
                            }
                            ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, wsauri);
                            if (protocol == null) {
View Full Code Here

     * @param rma the default value (non-<code>null</code>)
     * @param message the message
     * @return the compatible RMAssertion
     */
    public static RMConfiguration getRMConfiguration(RMConfiguration defaultValue, Message message) {
        RMConfiguration compatible = defaultValue;
        Collection<AssertionInfo> ais = collectRMAssertions(message.get(AssertionInfoMap.class));
        for (AssertionInfo ai : ais) {
            if (ai.getAssertion() instanceof JaxbAssertion<?>) {
                RMAssertion rma = (RMAssertion)((JaxbAssertion<?>)ai.getAssertion()).getData();
                compatible = intersect(rma, compatible);
View Full Code Here

    public static RMConfiguration intersect(RMAssertion rma, RMConfiguration cfg) {
        if (isCompatible(rma, cfg)) {
            return cfg;
        }
       
        RMConfiguration compatible = new RMConfiguration(cfg);
       
        // if supplied, policy value overrides default inactivity timeout
        Long aval = cfg.getInactivityTimeout();
        Long bval = null;
        if (null != rma.getInactivityTimeout()) {
            bval = rma.getInactivityTimeout().getMilliseconds();           
        }
        if (null != aval || null != bval) {
            Long use;
            if (bval != null) {
                use = bval;
            } else {
                use = aval;
            }
            compatible.setInactivityTimeout(use);
        }
       
        // if supplied, policy value overrides base retransmission interval
        aval = cfg.getBaseRetransmissionInterval();
        bval = null;
        if (null != rma.getBaseRetransmissionInterval()) {
            bval = rma.getBaseRetransmissionInterval().getMilliseconds();           
        }
        if (null != aval || null != bval) {
            Long use;
            if (bval != null) {
                use = bval;
            } else {
                use = aval;
            }
            compatible.setBaseRetransmissionInterval(use);
        }
       
        // if supplied, policy value overrides acknowledgement interval
        aval = cfg.getAcknowledgementInterval();
        bval = null;
        if (null != rma.getAcknowledgementInterval()) {
            bval = rma.getAcknowledgementInterval().getMilliseconds();
        }
        if (null != aval || null != bval) {
            Long use;
            if (bval != null) {
                use = bval;
            } else {
                use = aval;
            }
            compatible.setAcknowledgementInterval(use);
        }
   
        // backoff parameter
        if (cfg.isExponentialBackoff() || null != rma.getExponentialBackoff()) {
            compatible.setExponentialBackoff(true);
        }
        return compatible;
    }
View Full Code Here

     */
    public static RMConfiguration intersect(PrimitiveAssertion rma, RMConfiguration cfg) {
        if (isCompatible(rma, cfg)) {
            return cfg;
        }
        RMConfiguration compatible = new RMConfiguration(cfg);
        String lname = rma.getName().getLocalPart();
        if (RM11Constants.RMASSERTION_NAME.equals(lname)) {
            compatible.setRMNamespace(RM11Constants.NAMESPACE_URI);
        } else if (RM12AssertionBuilder.SEQUENCESTR_NAME.equals(lname)) {
            compatible.setSequenceSTRRequired(true);
        } else if (RM12AssertionBuilder.SEQUENCETRANSEC_NAME.equals(lname)) {
            compatible.setSequenceTransportSecurityRequired(true);
        } else if (RM12AssertionBuilder.EXACTLYONCE_NAME.equals(lname)) {
            compatible.setDeliveryAssurance(DeliveryAssurance.EXACTLY_ONCE);
        } else if (RM12AssertionBuilder.ATLEASTONCE_NAME.equals(lname)) {
            compatible.setDeliveryAssurance(DeliveryAssurance.AT_LEAST_ONCE);
        } else if (RM12AssertionBuilder.ATMOSTONCE_NAME.equals(lname)) {
            compatible.setDeliveryAssurance(DeliveryAssurance.AT_MOST_ONCE);
        } else if (RM12AssertionBuilder.INORDER_NAME.equals(lname)) {
            compatible.setInOrder(true);
        }
        return compatible;
    }
View Full Code Here

       
        return message;
    }
   
    private void setupMessagePolicies(Message message) {
        RMConfiguration cfg = new RMConfiguration();
        EasyMock.expect(manager.getEffectiveConfiguration(message)).andReturn(cfg);
        cfg.setBaseRetransmissionInterval(new Long(5000));
        cfg.setExponentialBackoff(true);
    }
View Full Code Here

    }
   
    @Test
    public void testIntersect() {
        RMAssertion rma = new RMAssertion();
        RMConfiguration cfg0 = new RMConfiguration();
        assertTrue(RMPolicyUtilities.equals(cfg0, RMPolicyUtilities.intersect(rma, cfg0)));
       
        InactivityTimeout aiat = new RMAssertion.InactivityTimeout();
        aiat.setMilliseconds(new Long(7200000));
        rma.setInactivityTimeout(aiat);
        cfg0.setInactivityTimeout(new Long(3600000));
       
        RMConfiguration cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
        assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
        assertNull(cfg1.getBaseRetransmissionInterval());
        assertNull(cfg1.getAcknowledgementInterval());
        assertFalse(cfg1.isExponentialBackoff());
       
        BaseRetransmissionInterval abri = new RMAssertion.BaseRetransmissionInterval();
        abri.setMilliseconds(new Long(20000));
        rma.setBaseRetransmissionInterval(abri);
        cfg0.setBaseRetransmissionInterval(new Long(10000));
       
        cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
        assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
        assertEquals(20000L, cfg1.getBaseRetransmissionInterval().longValue());
        assertNull(cfg1.getAcknowledgementInterval());
        assertFalse(cfg1.isExponentialBackoff());
      
        AcknowledgementInterval aai = new RMAssertion.AcknowledgementInterval();
        aai.setMilliseconds(new Long(2000));
        rma.setAcknowledgementInterval(aai);
       
        cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
        assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
        assertEquals(20000L, cfg1.getBaseRetransmissionInterval().longValue());
        assertEquals(2000L, cfg1.getAcknowledgementInterval().longValue());
        assertFalse(cfg1.isExponentialBackoff());
       
        cfg0.setExponentialBackoff(true);
        cfg1 = RMPolicyUtilities.intersect(rma, cfg0);
        assertEquals(7200000L, cfg1.getInactivityTimeout().longValue());
        assertEquals(20000L, cfg1.getBaseRetransmissionInterval().longValue());
        assertEquals(2000L, cfg1.getAcknowledgementInterval().longValue());
        assertTrue(cfg1.isExponentialBackoff());   
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.rm.RMConfiguration

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.