Coverage Report - org.mule.impl.model.seda.SedaModel
 
Classes in this File Line Coverage Branch Coverage Complexity
SedaModel
54%
13/24
N/A
1
 
 1  
 /*
 2  
  * $Id: SedaModel.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.impl.model.seda;
 12  
 
 13  
 import org.mule.MuleManager;
 14  
 import org.mule.config.PoolingProfile;
 15  
 import org.mule.config.QueueProfile;
 16  
 import org.mule.impl.MuleDescriptor;
 17  
 import org.mule.impl.model.AbstractModel;
 18  
 import org.mule.umo.UMOComponent;
 19  
 import org.mule.umo.UMODescriptor;
 20  
 
 21  
 /**
 22  
  * A Mule component service model that uses Seda principles to achieve high
 23  
  * throughput by queueing events for components and processing them concurrently.
 24  
  */
 25  
 public class SedaModel extends AbstractModel
 26  
 {
 27  
 
 28  
     /**
 29  
      * The time out used for taking from the Seda Queue.
 30  
      */
 31  808
     private int queueTimeout = MuleManager.getConfiguration().getSynchronousEventTimeout();
 32  
 
 33  
     /**
 34  
      * Whether components in this model should be pooled or not.
 35  
      */
 36  808
     private boolean enablePooling = true;
 37  
 
 38  
     /**
 39  
      * Whether to create a new component for every request.
 40  
      */
 41  808
     protected boolean componentPerRequest = false;
 42  
 
 43  
 
 44  
     /**
 45  
      * the pooling configuration used when initialising the component described by
 46  
      * this descriptor.
 47  
      */
 48  
     protected PoolingProfile poolingProfile;
 49  
 
 50  
     /**
 51  
      * The queuing profile for events received for this component
 52  
      */
 53  
     protected QueueProfile queueProfile;
 54  
 
 55  
 
 56  
     public SedaModel()
 57  
     {
 58  808
         super();
 59  808
         poolingProfile = new PoolingProfile();
 60  808
         queueProfile = new QueueProfile();
 61  808
     }
 62  
 
 63  
     /**
 64  
      * Returns the model type name. This is a friendly identifier that is used to
 65  
      * look up the SPI class for the model
 66  
      * 
 67  
      * @return the model type
 68  
      */
 69  
     public String getType()
 70  
     {
 71  0
         return "seda";
 72  
     }
 73  
 
 74  
     protected UMOComponent createComponent(UMODescriptor descriptor)
 75  
     {
 76  36
         return new SedaComponent((MuleDescriptor) descriptor, this);
 77  
     }
 78  
 
 79  
     public int getQueueTimeout()
 80  
     {
 81  342
         return queueTimeout;
 82  
     }
 83  
 
 84  
     public void setQueueTimeout(int queueTimeout)
 85  
     {
 86  0
         this.queueTimeout = queueTimeout;
 87  0
     }
 88  
 
 89  
     public boolean isEnablePooling()
 90  
     {
 91  342
         return enablePooling;
 92  
     }
 93  
 
 94  
     public void setEnablePooling(boolean enablePooling)
 95  
     {
 96  0
         this.enablePooling = enablePooling;
 97  0
     }
 98  
 
 99  
     public boolean isComponentPerRequest()
 100  
     {
 101  342
         return componentPerRequest;
 102  
     }
 103  
 
 104  
     public void setComponentPerRequest(boolean componentPerRequest)
 105  
     {
 106  0
         this.componentPerRequest = componentPerRequest;
 107  0
     }
 108  
 
 109  
 
 110  
     public PoolingProfile getPoolingProfile()
 111  
     {
 112  342
         return poolingProfile;
 113  
     }
 114  
 
 115  
     public void setPoolingProfile(PoolingProfile poolingProfile)
 116  
     {
 117  0
         this.poolingProfile = poolingProfile;
 118  0
     }
 119  
 
 120  
     public QueueProfile getQueueProfile()
 121  
     {
 122  342
         return queueProfile;
 123  
     }
 124  
 
 125  
     public void setQueueProfile(QueueProfile queueProfile)
 126  
     {
 127  0
         this.queueProfile = queueProfile;
 128  0
     }
 129  
 }