org.apache.james.api.dnsservice.util
Class NetMatcher

java.lang.Object
  extended by org.apache.james.api.dnsservice.util.NetMatcher

public class NetMatcher
extends java.lang.Object

Class which can be used to check if an ipAddress match a network


Constructor Summary
NetMatcher(java.util.Collection nets, DNSService dnsServer)
          Create a new instance of Netmatcher
NetMatcher(java.lang.String[] nets, DNSService dnsServer)
          Create a new instance of Netmatcher
 
Method Summary
 void initInetNetworks(java.util.Collection nets)
          Init the class with the given networks
 void initInetNetworks(java.lang.String[] nets)
          Init the class with the given networks
protected  void log(java.lang.String s)
          Can be overwritten for loggin
 boolean matchInetNetwork(java.net.InetAddress ip)
           
 boolean matchInetNetwork(java.lang.String hostIP)
          Return true if passed host match a network which was used to init the Netmatcher
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetMatcher

public NetMatcher(java.lang.String[] nets,
                  DNSService dnsServer)
Create a new instance of Netmatcher

Parameters:
nets - a String[] which holds all networks
dnsServer - the DNSService which will be used in this class

NetMatcher

public NetMatcher(java.util.Collection nets,
                  DNSService dnsServer)
Create a new instance of Netmatcher

Parameters:
nets - a Collection which holds all networks
dnsServer - the DNSService which will be used in this class
Method Detail

initInetNetworks

public void initInetNetworks(java.util.Collection nets)
Init the class with the given networks

Parameters:
nets - a Collection which holds all networks

initInetNetworks

public void initInetNetworks(java.lang.String[] nets)
Init the class with the given networks

Parameters:
nets - a String[] which holds all networks

matchInetNetwork

public boolean matchInetNetwork(java.lang.String hostIP)
Return true if passed host match a network which was used to init the Netmatcher

Parameters:
hostIP - the ipAddress or hostname to check
Returns:
true if match the network

matchInetNetwork

public boolean matchInetNetwork(java.net.InetAddress ip)
See Also:
matchInetNetwork(String)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
InetNetwork#toString()

log

protected void log(java.lang.String s)
Can be overwritten for loggin

Parameters:
s - the String to log


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.