Coverage Report - org.mule.context.notification.Sender
 
Classes in this File Line Coverage Branch Coverage Complexity
Sender
100%
8/8
100%
6/6
1.5
 
 1  
 /*
 2  
  * $Id: Sender.java 10787 2008-02-12 18:51:50Z dfeist $
 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.context.notification;
 12  
 
 13  
 import org.mule.api.context.notification.ServerNotification;
 14  
 import org.mule.routing.filters.WildcardFilter;
 15  
 
 16  
 /**
 17  
  * This does the work necessary to deliver events to a particular listener.  It is generated for a
 18  
  * particular {@link Configuration} and stored in a
 19  
  * {@link org.mule.context.notification.Policy}.
 20  
  */
 21  
 class Sender
 22  
 {
 23  
 
 24  
     private ListenerSubscriptionPair pair;
 25  
     private WildcardFilter subscriptionFilter;
 26  
 
 27  
     Sender(ListenerSubscriptionPair pair)
 28  66
     {
 29  66
         this.pair = pair;
 30  66
         subscriptionFilter = new WildcardFilter(pair.getSubscription());
 31  66
         subscriptionFilter.setCaseSensitive(false);
 32  66
     }
 33  
 
 34  
     public void dispatch(ServerNotification notification)
 35  
     {
 36  144
         if (pair.isNullSubscription() ||
 37  
                 (null != notification.getResourceIdentifier() &&
 38  
                         subscriptionFilter.accept(notification.getResourceIdentifier())))
 39  
         {
 40  124
             pair.getListener().onNotification(notification);
 41  
         }
 42  144
     }
 43  
 
 44  
 }
 45