View Javadoc
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.example.geomail.routing;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.api.routing.filter.Filter;
11  import org.mule.example.geomail.dao.SenderDao;
12  
13  /**
14   * TODO
15   */
16  public class InCacheFilter implements Filter
17  {
18      private SenderDao senderDao = null;
19  
20      public boolean accept(MuleMessage message)
21      {
22          boolean result = false;
23  
24          String ip = (String)message.getPayload();
25  
26          // If 'ip' is found in DAO, accept it:
27          if (getSenderDao().getSender(ip) != null)
28          {
29              result = true;
30          }
31  
32          return result;
33      }
34  
35      public SenderDao getSenderDao()
36      {
37          return senderDao;
38      }
39  
40      public void setSenderDao(SenderDao senderDao)
41      {
42          this.senderDao = senderDao;
43      }
44  }