org.altlinux.jabbix
Class WhitelistPredicate

java.lang.Object
  extended by org.altlinux.jabbix.WhitelistPredicate
All Implemented Interfaces:
ConnectionPredicate

public class WhitelistPredicate
extends Object
implements ConnectionPredicate

Implements a connection predicate using a regular expression to test the host name.

Author:
Paul Wolneykien
See Also:
JabbixSecurityManager

Constructor Summary
WhitelistPredicate(String addressPattern)
          Creates a new predicate instance from the specified pattern.
 
Method Summary
 boolean isAllowed(String host, int port)
          Tests if the given host name matches the configured pattern.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WhitelistPredicate

public WhitelistPredicate(String addressPattern)
Creates a new predicate instance from the specified pattern.

Parameters:
addressPattern - a regular expression to the the host names with
Method Detail

isAllowed

public boolean isAllowed(String host,
                         int port)
Tests if the given host name matches the configured pattern.

Specified by:
isAllowed in interface ConnectionPredicate
Parameters:
host - the host to connect to/from
port - the port to connect to/from
Returns:
true if the connection is allowed, false otherwise