OpenNMS API 1.2.3

org.opennms.web.vulnerability
Class VulnerabilityFactory

java.lang.Object
  extended byorg.opennms.web.vulnerability.VulnerabilityFactory

public class VulnerabilityFactory
extends java.lang.Object

Encapsulates all querying functionality for vulnerabilities.

Author:
Lawrence Karnowski , OpenNMS

Nested Class Summary
static class VulnerabilityFactory.ResolutionType
          Convenience class to determine what sort of events to include in a query.
static class VulnerabilityFactory.SortStyle
          Convenience class to determine sort style of a query.
 
Field Summary
protected static org.apache.log4j.Category log
           
 
Constructor Summary
private VulnerabilityFactory()
          Private constructor so this class cannot be instantiated.
 
Method Summary
protected static java.lang.String getOrderByClause(VulnerabilityFactory.SortStyle sortStyle)
          Convenience method for getting the SQL ORDER BY clause related to a given sort style.
protected static java.lang.String getResolutionTypeClause(VulnerabilityFactory.ResolutionType resType)
          Convenience method for getting the SQL WHERE clause related to a given resolution type.
static Vulnerability[] getVulnerabilities()
          Return all open vulnerabilities sorted by time.
static Vulnerability[] getVulnerabilities(VulnerabilityFactory.ResolutionType resType)
          Return all open or resolved vulnerabilities sorted by identifier.
static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle)
          Return all open vulnerabilities sorted by the given sort style.
static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle, VulnerabilityFactory.ResolutionType resType)
          Return all vulnerabilities (optionally only open vulnerabilities) sorted by the given sort style.
static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle, VulnerabilityFactory.ResolutionType resType, Filter[] filters)
          Return all vulnerabilities (optionally only open vulnerabilities) sorted by the given sort style.
static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle, VulnerabilityFactory.ResolutionType resType, Filter[] filters, int limit, int offset)
          Return all vulnerabilities (optionally only open vulnerabilities) sorted by the given sort style.
static Vulnerability[] getVulnerabilitiesForNode(int nodeId, VulnerabilityFactory.SortStyle sortStyle, VulnerabilityFactory.ResolutionType resType, int throttle, int offset)
          Return some maximum number of vulnerabilities or less sorted by the given sort style for the given node.
static Vulnerability getVulnerability(int vulId)
          Return a specific vulnerability.
static int getVulnerabilityCount()
          Count all open vulnerabilities.
static int getVulnerabilityCount(VulnerabilityFactory.ResolutionType resType, Filter[] filters)
          Count the number of vulnerabilities for a given resolution type and given filters..
static int getVulnerabilityCountForInterface(int nodeId, java.lang.String ipAddress, VulnerabilityFactory.ResolutionType resType)
          Return the number of vulnerabilities for this IP address and the given resolution type.
static int getVulnerabilityCountForNode(int nodeId, VulnerabilityFactory.ResolutionType resType)
          Return the number of vulnerabilities for this node and the given resolution type.
static Vulnerability[] getVulnerablilitiesForInterface(int nodeId, java.lang.String ipAddress, VulnerabilityFactory.SortStyle sortStyle, VulnerabilityFactory.ResolutionType resType, int throttle, int offset)
          Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given IP address.
protected static Vulnerability[] rs2Vulnerabilities(java.sql.ResultSet rs)
          Convenience method for translating a java.sql.ResultSet containing vulnerability information into an array of Vulnerability objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Category log
Constructor Detail

VulnerabilityFactory

private VulnerabilityFactory()
Private constructor so this class cannot be instantiated.

Method Detail

getVulnerabilityCount

public static int getVulnerabilityCount()
                                 throws java.sql.SQLException
Count all open vulnerabilities.

Throws:
java.sql.SQLException

getVulnerabilityCount

public static int getVulnerabilityCount(VulnerabilityFactory.ResolutionType resType,
                                        Filter[] filters)
                                 throws java.sql.SQLException
Count the number of vulnerabilities for a given resolution type and given filters..

Throws:
java.sql.SQLException

getVulnerability

public static Vulnerability getVulnerability(int vulId)
                                      throws java.sql.SQLException
Return a specific vulnerability.

Throws:
java.sql.SQLException

getVulnerabilitiesForNode

public static Vulnerability[] getVulnerabilitiesForNode(int nodeId,
                                                        VulnerabilityFactory.SortStyle sortStyle,
                                                        VulnerabilityFactory.ResolutionType resType,
                                                        int throttle,
                                                        int offset)
                                                 throws java.sql.SQLException
Return some maximum number of vulnerabilities or less sorted by the given sort style for the given node.

Parameters:
throttle - a value less than one means no throttling
Throws:
java.sql.SQLException

getVulnerabilityCountForNode

public static int getVulnerabilityCountForNode(int nodeId,
                                               VulnerabilityFactory.ResolutionType resType)
                                        throws java.sql.SQLException
Return the number of vulnerabilities for this node and the given resolution type.

Throws:
java.sql.SQLException

getVulnerablilitiesForInterface

public static Vulnerability[] getVulnerablilitiesForInterface(int nodeId,
                                                              java.lang.String ipAddress,
                                                              VulnerabilityFactory.SortStyle sortStyle,
                                                              VulnerabilityFactory.ResolutionType resType,
                                                              int throttle,
                                                              int offset)
                                                       throws java.sql.SQLException
Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given IP address.

Parameters:
throttle - a value less than one means no throttling
offset - which row to start on in the result list
Throws:
java.sql.SQLException

getVulnerabilityCountForInterface

public static int getVulnerabilityCountForInterface(int nodeId,
                                                    java.lang.String ipAddress,
                                                    VulnerabilityFactory.ResolutionType resType)
                                             throws java.sql.SQLException
Return the number of vulnerabilities for this IP address and the given resolution type.

Throws:
java.sql.SQLException

getVulnerabilities

public static Vulnerability[] getVulnerabilities()
                                          throws java.sql.SQLException
Return all open vulnerabilities sorted by time.

Throws:
java.sql.SQLException

getVulnerabilities

public static Vulnerability[] getVulnerabilities(VulnerabilityFactory.ResolutionType resType)
                                          throws java.sql.SQLException
Return all open or resolved vulnerabilities sorted by identifier.

Throws:
java.sql.SQLException

getVulnerabilities

public static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle)
                                          throws java.sql.SQLException
Return all open vulnerabilities sorted by the given sort style.

Throws:
java.sql.SQLException

getVulnerabilities

public static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle,
                                                 VulnerabilityFactory.ResolutionType resType)
                                          throws java.sql.SQLException
Return all vulnerabilities (optionally only open vulnerabilities) sorted by the given sort style.

Throws:
java.sql.SQLException

getVulnerabilities

public static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle,
                                                 VulnerabilityFactory.ResolutionType resType,
                                                 Filter[] filters)
                                          throws java.sql.SQLException
Return all vulnerabilities (optionally only open vulnerabilities) sorted by the given sort style.

Throws:
java.sql.SQLException

getVulnerabilities

public static Vulnerability[] getVulnerabilities(VulnerabilityFactory.SortStyle sortStyle,
                                                 VulnerabilityFactory.ResolutionType resType,
                                                 Filter[] filters,
                                                 int limit,
                                                 int offset)
                                          throws java.sql.SQLException
Return all vulnerabilities (optionally only open vulnerabilities) sorted by the given sort style.

Note: This limit/offset code is Postgres specific! Per Shane , this is okay for now until we can come up with an Oracle alternative too.

Parameters:
limit - if -1 or zero, no limit or offset is used
offset - if -1, no limit or offset if used
Throws:
java.sql.SQLException

rs2Vulnerabilities

protected static Vulnerability[] rs2Vulnerabilities(java.sql.ResultSet rs)
                                             throws java.sql.SQLException
Convenience method for translating a java.sql.ResultSet containing vulnerability information into an array of Vulnerability objects.

Throws:
java.sql.SQLException

getOrderByClause

protected static java.lang.String getOrderByClause(VulnerabilityFactory.SortStyle sortStyle)
Convenience method for getting the SQL ORDER BY clause related to a given sort style.


getResolutionTypeClause

protected static java.lang.String getResolutionTypeClause(VulnerabilityFactory.ResolutionType resType)
Convenience method for getting the SQL WHERE clause related to a given resolution type.

Parameters:
resType - the resolution type to map to a clause

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.