Coverage Report - org.apache.camel.model.RedeliveryPolicyType
 
Classes in this File Line Coverage Branch Coverage Complexity
RedeliveryPolicyType
29% 
100% 
0
 
 1  
 /**
 2  
  *
 3  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 4  
  * contributor license agreements.  See the NOTICE file distributed with
 5  
  * this work for additional information regarding copyright ownership.
 6  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 7  
  * (the "License"); you may not use this file except in compliance with
 8  
  * the License.  You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.camel.model;
 19  
 
 20  
 import org.apache.camel.processor.RedeliveryPolicy;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlAccessType;
 23  
 import javax.xml.bind.annotation.XmlAccessorType;
 24  
 import javax.xml.bind.annotation.XmlRootElement;
 25  
 
 26  
 /**
 27  
  * @version $Revision: 1.1 $
 28  
  */
 29  
 @XmlRootElement(name = "redeliveryPolicy")
 30  
 @XmlAccessorType(XmlAccessType.FIELD)
 31  6
 public class RedeliveryPolicyType {
 32  
     private Integer maximumRedeliveries;
 33  
     private Long initialRedeliveryDelay;
 34  
     private Double backOffMultiplier;
 35  
     private Boolean useExponentialBackOff;
 36  
     private Double collisionAvoidanceFactor;
 37  
     private Boolean useCollisionAvoidance;
 38  
 
 39  
 
 40  
     public RedeliveryPolicy createRedeliveryPolicy(RedeliveryPolicy parentPolicy) {
 41  6
         RedeliveryPolicy answer =  parentPolicy.copy();
 42  
 
 43  
         // copy across the properties - if they are set
 44  6
         if (maximumRedeliveries != null) {
 45  6
             answer.setMaximumRedeliveries(maximumRedeliveries);
 46  
         }
 47  6
         if (initialRedeliveryDelay != null) {
 48  0
             answer.setInitialRedeliveryDelay(initialRedeliveryDelay);
 49  
         }
 50  6
         if (backOffMultiplier != null) {
 51  0
             answer.setBackOffMultiplier(backOffMultiplier);
 52  
         }
 53  6
         if (useExponentialBackOff != null) {
 54  0
             answer.setUseExponentialBackOff(useExponentialBackOff);
 55  
         }
 56  6
         if (collisionAvoidanceFactor != null) {
 57  0
             answer.setCollisionAvoidanceFactor(collisionAvoidanceFactor);
 58  
         }
 59  6
         if (useCollisionAvoidance != null) {
 60  0
             answer.setUseCollisionAvoidance(useCollisionAvoidance);
 61  
         }
 62  6
         return answer;
 63  
     }
 64  
 
 65  
     public String toString() {
 66  0
         return "RedeliveryPolicy[maxRedeliveries: " + maximumRedeliveries + "]";
 67  
     }
 68  
 
 69  
     // Fluent API
 70  
     //-------------------------------------------------------------------------
 71  
     public RedeliveryPolicyType backOffMultiplier(double backOffMultiplier) {
 72  0
         setBackOffMultiplier(backOffMultiplier);
 73  0
         return this;
 74  
     }
 75  
 
 76  
     public RedeliveryPolicyType collisionAvoidancePercent(double collisionAvoidancePercent) {
 77  0
         setCollisionAvoidanceFactor(collisionAvoidancePercent * 0.01d);
 78  0
         return this;
 79  
     }
 80  
 
 81  
     public RedeliveryPolicyType collisionAvoidanceFactor(double collisionAvoidanceFactor) {
 82  0
         setCollisionAvoidanceFactor(collisionAvoidanceFactor);
 83  0
         return this;
 84  
     }
 85  
 
 86  
     public RedeliveryPolicyType initialRedeliveryDelay(long initialRedeliveryDelay) {
 87  0
         setInitialRedeliveryDelay(initialRedeliveryDelay);
 88  0
         return this;
 89  
     }
 90  
 
 91  
     public RedeliveryPolicyType maximumRedeliveries(int maximumRedeliveries) {
 92  6
         setMaximumRedeliveries(maximumRedeliveries);
 93  6
         return this;
 94  
     }
 95  
 
 96  
     public RedeliveryPolicyType useCollisionAvoidance() {
 97  0
         setUseCollisionAvoidance(true);
 98  0
         return this;
 99  
     }
 100  
 
 101  
     public RedeliveryPolicyType useExponentialBackOff() {
 102  0
         setUseExponentialBackOff(true);
 103  0
         return this;
 104  
     }
 105  
 
 106  
 
 107  
 
 108  
 
 109  
     // Properties
 110  
     //-------------------------------------------------------------------------
 111  
 
 112  
     public Double getBackOffMultiplier() {
 113  0
         return backOffMultiplier;
 114  
     }
 115  
 
 116  
     public void setBackOffMultiplier(Double backOffMultiplier) {
 117  0
         this.backOffMultiplier = backOffMultiplier;
 118  0
     }
 119  
 
 120  
     public Double getCollisionAvoidanceFactor() {
 121  0
         return collisionAvoidanceFactor;
 122  
     }
 123  
 
 124  
     public void setCollisionAvoidanceFactor(Double collisionAvoidanceFactor) {
 125  0
         this.collisionAvoidanceFactor = collisionAvoidanceFactor;
 126  0
     }
 127  
 
 128  
     public Long getInitialRedeliveryDelay() {
 129  0
         return initialRedeliveryDelay;
 130  
     }
 131  
 
 132  
     public void setInitialRedeliveryDelay(Long initialRedeliveryDelay) {
 133  0
         this.initialRedeliveryDelay = initialRedeliveryDelay;
 134  0
     }
 135  
 
 136  
     public Integer getMaximumRedeliveries() {
 137  0
         return maximumRedeliveries;
 138  
     }
 139  
 
 140  
     public void setMaximumRedeliveries(Integer maximumRedeliveries) {
 141  6
         this.maximumRedeliveries = maximumRedeliveries;
 142  6
     }
 143  
 
 144  
     public Boolean getUseCollisionAvoidance() {
 145  0
         return useCollisionAvoidance;
 146  
     }
 147  
 
 148  
     public void setUseCollisionAvoidance(Boolean useCollisionAvoidance) {
 149  0
         this.useCollisionAvoidance = useCollisionAvoidance;
 150  0
     }
 151  
 
 152  
     public Boolean getUseExponentialBackOff() {
 153  0
         return useExponentialBackOff;
 154  
     }
 155  
 
 156  
     public void setUseExponentialBackOff(Boolean useExponentialBackOff) {
 157  0
         this.useExponentialBackOff = useExponentialBackOff;
 158  0
     }
 159  
 }