org.opennms.bb.dp.poller.scheduler.utils
Class PollerPackage

java.lang.Object
  |
  +--org.opennms.bb.dp.poller.scheduler.utils.PollerPackage

public class PollerPackage
extends Object

This class is a representation of a BlueBird package as parsed from the package.xml file.

Version:
$Revision: 1.3 $
Author:
Jason Johns, OpenNMS

Field Summary
private  String m_filterExpr
          The filter expression rule for the package
private  BBFilter m_filterParser
          The parser to parse and execute a filter expression
private  String m_name
          The name of the package
private  RangeInfo m_rangeInfo
          Range information for the package
private  HashMap m_services
          List of services associated with the package
 
Constructor Summary
PollerPackage(String aName)
          Constructor to assign a name to the package and initialize the various members.
 
Method Summary
 void addService(ServiceInfo aService)
          This method adds a service to the package
 String getFilterExpr()
          This method returns the filter expression member
 List getFilterList()
          This method runs the filterExpr against the database to get back a list of ip addresses that match the rule.
 String getName()
          This method returns the package name
 RangeInfo getRangeInfo()
          This method returns the range information for this package
 ServiceInfo getService(String aServiceName)
          This method returns the ServiceInfo for a given service name
 List getServiceNames()
           
 boolean ipInFilter(String ipAddr)
          This method checks to see if a particular ip address is within the list returned by a filter expression.
 boolean ipInRange(String ipAddr)
          This method determines if an ip address is within the range specifications of the package.
 void setFilterExpr(String anExpr)
          This method sets the filterExpr member.
 String toString()
          This method returns a string representation of the package
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

m_name

private String m_name
The name of the package

m_filterExpr

private String m_filterExpr
The filter expression rule for the package

m_rangeInfo

private RangeInfo m_rangeInfo
Range information for the package

m_services

private HashMap m_services
List of services associated with the package

m_filterParser

private BBFilter m_filterParser
The parser to parse and execute a filter expression
Constructor Detail

PollerPackage

public PollerPackage(String aName)
Constructor to assign a name to the package and initialize the various members.
Parameters:
String - aName, the name of the package
Method Detail

ipInRange

public boolean ipInRange(String ipAddr)
This method determines if an ip address is within the range specifications of the package. This includes the specific addresses, the exclude ranges and the inlcude ranges. An ip is in the range if it is specifically mentioned, or if it is not in the exclude range and within the include range.
Parameters:
String - ipAddr, the address to check the range for
Returns:
boolean, indicating if the ip is in the package range

getFilterList

public List getFilterList()
This method runs the filterExpr against the database to get back a list of ip addresses that match the rule.
Returns:
List, a list of matching ip addresses

ipInFilter

public boolean ipInFilter(String ipAddr)
This method checks to see if a particular ip address is within the list returned by a filter expression.
Parameters:
String - ipAddr, the address to check
Returns:
boolean, indicating if the ip address is a member of the filter expression set

addService

public void addService(ServiceInfo aService)
This method adds a service to the package
Parameters:
ServiceInfo - aService, a class encapulating the service information

getService

public ServiceInfo getService(String aServiceName)
This method returns the ServiceInfo for a given service name
Parameters:
String - aServiceName, the name of the service to look up
Returns:
ServiceInfo, the service information

getServiceNames

public List getServiceNames()

getRangeInfo

public RangeInfo getRangeInfo()
This method returns the range information for this package
Returns:
RangeInfo, the range information

setFilterExpr

public void setFilterExpr(String anExpr)
This method sets the filterExpr member. A semi-colon is placed at the end of the rule to conform to the BNF for the rule expression language.
Parameters:
String - anExpr, the expression to set

getFilterExpr

public String getFilterExpr()
This method returns the filter expression member
Returns:
String, the filter expression

getName

public String getName()
This method returns the package name
Returns:
String, the package name

toString

public String toString()
This method returns a string representation of the package
Overrides:
toString in class Object
Returns:
String, a string representation of the package