Coverage Report - org.mule.transport.xmpp.filters.AbstractXmppFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractXmppFilter
0%
0/5
0%
0/2
1.333
 
 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.transport.xmpp.filters;
 8  
 
 9  
 import org.mule.api.MuleMessage;
 10  
 import org.mule.api.routing.filter.Filter;
 11  
 
 12  
 import org.jivesoftware.smack.filter.PacketFilter;
 13  
 import org.jivesoftware.smack.packet.Packet;
 14  
 
 15  
 /**
 16  
  * <code>AbstractXmppFilter</code> is a filter adapter so that Smack Filters can be
 17  
  * configured as Mule filters.
 18  
  */
 19  0
 public abstract class AbstractXmppFilter implements Filter, PacketFilter
 20  
 {
 21  
     protected volatile PacketFilter delegate;
 22  
 
 23  
     public boolean accept(Packet packet)
 24  
     {
 25  0
         if (delegate == null)
 26  
         {
 27  0
             delegate = createFilter();
 28  
         }
 29  
 
 30  0
         return delegate.accept(packet);
 31  
     }
 32  
 
 33  
     public boolean accept(MuleMessage message)
 34  
     {
 35  
         // If we have received a MuleMessage the filter has already been applied
 36  0
         return true;
 37  
     }
 38  
 
 39  
     protected abstract PacketFilter createFilter();
 40  
 }