Coverage Report - org.mule.context.notification.Sender
 
Classes in this File Line Coverage Branch Coverage Complexity
Sender
0%
0/10
0%
0/6
2
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.context.notification;
 8  
 
 9  
 import org.mule.api.context.notification.ServerNotification;
 10  
 import org.mule.routing.filters.WildcardFilter;
 11  
 
 12  
 /**
 13  
  * This does the work necessary to deliver events to a particular listener.  It is generated for a
 14  
  * particular {@link Configuration} and stored in a
 15  
  * {@link org.mule.context.notification.Policy}.
 16  
  */
 17  
 class Sender
 18  
 {
 19  
 
 20  
     private ListenerSubscriptionPair pair;
 21  
     private WildcardFilter subscriptionFilter;
 22  
 
 23  
     Sender(ListenerSubscriptionPair pair)
 24  0
     {
 25  0
         this.pair = pair;
 26  0
         subscriptionFilter = new WildcardFilter(pair.getSubscription());
 27  0
         subscriptionFilter.setCaseSensitive(false);
 28  0
     }
 29  
 
 30  
     public void dispatch(ServerNotification notification)
 31  
     {
 32  0
         if (pair.isNullSubscription() ||
 33  
                 (null != notification.getResourceIdentifier() &&
 34  
                         subscriptionFilter.accept(notification.getResourceIdentifier())))
 35  
         {
 36  
             try
 37  
             {
 38  0
                 pair.getListener().onNotification(notification);
 39  
             }
 40  0
             catch (Exception e)
 41  
             {
 42  
                 // Exceptions from listeners do not affect the notification processing
 43  0
             }
 44  
         }
 45  0
     }
 46  
 
 47  
 }
 48