Coverage Report - org.mule.config.QueueProfile
 
Classes in this File Line Coverage Branch Coverage Complexity
QueueProfile
0%
0/22
N/A
1
 
 1  
 /*
 2  
  * $Id: QueueProfile.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.config;
 12  
 
 13  
 import org.mule.api.lifecycle.InitialisationException;
 14  
 import org.mule.util.queue.QueueConfiguration;
 15  
 import org.mule.util.queue.QueueManager;
 16  
 
 17  
 /**
 18  
  * <code>QueueProfile</code> determines how an internal queue for a service will
 19  
  * behave
 20  
  */
 21  
 
 22  
 public class QueueProfile
 23  
 {
 24  0
     private int maxOutstandingMessages = 0;
 25  0
     private boolean persistent = false;
 26  
 
 27  
     public QueueProfile()
 28  
     {
 29  0
         super();
 30  0
     }
 31  
 
 32  
     public QueueProfile(int maxOutstandingMessages, boolean persistent)
 33  0
     {
 34  0
         this.maxOutstandingMessages = maxOutstandingMessages;
 35  0
         this.persistent = persistent;
 36  0
     }
 37  
 
 38  
     public QueueProfile(QueueProfile queueProfile)
 39  0
     {
 40  0
         this.maxOutstandingMessages = queueProfile.getMaxOutstandingMessages();
 41  0
         this.persistent = queueProfile.isPersistent();
 42  0
     }
 43  
 
 44  
     /**
 45  
      * This specifies the number of messages that can be queued before it starts
 46  
      * blocking.
 47  
      * 
 48  
      * @return the max number of messages that will be queued
 49  
      */
 50  
     public int getMaxOutstandingMessages()
 51  
     {
 52  0
         return maxOutstandingMessages;
 53  
     }
 54  
 
 55  
     /**
 56  
      * This specifies the number of messages that can be queued before it starts
 57  
      * blocking.
 58  
      * 
 59  
      * @param maxOutstandingMessages the max number of messages that will be queued
 60  
      */
 61  
     public void setMaxOutstandingMessages(int maxOutstandingMessages)
 62  
     {
 63  0
         this.maxOutstandingMessages = maxOutstandingMessages;
 64  0
     }
 65  
 
 66  
     public boolean isPersistent()
 67  
     {
 68  0
         return persistent;
 69  
     }
 70  
 
 71  
     public void setPersistent(boolean persistent)
 72  
     {
 73  0
         this.persistent = persistent;
 74  0
     }
 75  
 
 76  
     public void configureQueue(String component, QueueManager queueManager) throws InitialisationException
 77  
     {
 78  0
         QueueConfiguration qc = new QueueConfiguration(maxOutstandingMessages, persistent);
 79  0
         queueManager.setQueueConfiguration(component, qc);
 80  0
     }
 81  
 
 82  
     public String toString()
 83  
     {
 84  0
         return "QueueProfile{maxOutstandingMessage=" + maxOutstandingMessages + ", persistent="
 85  
                + persistent + "}";
 86  
     }
 87  
 }