|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.utils.NodeLabel
This class contains convenience functions for retrieving and modifying the label associated with a managed node. The 'node' table contains a 'nodelabel' and 'nodelabelsource' field. The 'nodelabel' is a user-friendly name associated with the node. This name can be user-defined (via the WEB UI) or can be auto-generated based on what OpenNMS knows about the node and its interfaces. The 'nodelabelsource' field is a single character flag which indicates what the source for the node label was.
Valid values for node label source are: 'U' User defined 'H' Primary interface's IP host name 'S' Node's MIB-II sysName 'A' Primary interface's IP address
Field Summary | |
private static java.lang.String |
DEFAULT_SELECT_METHOD
Default primary interface select method. |
private java.lang.String |
m_nodeLabel
Node label |
private char |
m_nodeLabelSource
Flag describing source of node label |
static int |
MAX_NODE_LABEL_LENGTH
Maximum length for node label |
private static java.lang.String |
SELECT_METHOD_MAX
Primary interface selection method MAX. |
private static java.lang.String |
SELECT_METHOD_MIN
Primary interface selection method MIN. |
static char |
SOURCE_ADDRESS
|
static char |
SOURCE_HOSTNAME
|
static char |
SOURCE_NETBIOS
|
static char |
SOURCE_SYSNAME
|
static char |
SOURCE_UNKNOWN
Initalization value for node label source flag |
static char |
SOURCE_USERDEFINED
Valid values for node label source flag |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_MANAGED_INTERFACES
The SQL statement to retrieve all managed IP address & hostName values associated with a particular nodeID |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_NETBIOS_NAME
The SQL statement to retrieve the NetBIOS name associated with a particular nodeID |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_NODELABEL
The SQL statement to retrieve the current node label and node label source values associated with a node. |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_NON_MANAGED_INTERFACES
The SQL statement to retrieve all non-managed IP address & hostName values associated with a particular nodeID |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_SYSNAME
The SQL statement to retrieve the MIB-II sysname field from the node table |
(package private) static java.lang.String |
SQL_DB_UPDATE_NODE_LABEL
The SQL statement to update the 'nodelabel' and 'nodelabelsource' fields of 'node' table |
Constructor Summary | |
NodeLabel()
Default constructor |
|
NodeLabel(java.lang.String nodeLabel,
char nodeLabelSource)
Constructor |
Method Summary | |
static void |
assignLabel(int nodeID,
NodeLabel nodeLabel)
This method updates the 'nodelabel' and 'nodelabelsource' fields of the 'node' table for the specified nodeID. |
static void |
assignLabel(int nodeID,
NodeLabel nodeLabel,
java.sql.Connection dbConnection)
This method updates the 'nodelabel' and 'nodelabelsource' fields of the 'node' table for the specified nodeID. |
static NodeLabel |
computeLabel(int nodeID)
This method determines what label should be associated with a particular node. |
static NodeLabel |
computeLabel(int nodeID,
java.sql.Connection dbConnection)
This method determines what label should be associated with a particular node. |
java.lang.String |
getLabel()
Returns the node label . |
char |
getSource()
Returns the node label source flag . |
private static void |
loadAddressList(java.sql.ResultSet rs,
java.util.List ipv4AddrList,
java.util.List ipHostNameList)
Utility method for loading the address and host name lists from a result set retrieved from the 'ipInterface' table of the database. |
static NodeLabel |
retrieveLabel(int nodeID)
This method queries the 'node' table for the value of the 'nodelabel' and 'nodelabelsource' fields for the node with the provided nodeID. |
static NodeLabel |
retrieveLabel(int nodeID,
java.sql.Connection dbConnection)
This method queries the 'node' table for the value of the 'nodelabel' and 'nodelabelsource' fields for the node with the provided nodeID. |
private static IPv4Address |
selectPrimaryAddress(java.util.List ipv4AddrList,
java.lang.String method)
Returns the primary interface from a list of addresses based on the specified selection method. |
void |
setLabel(java.lang.String nodeLabel)
Sets the node label. |
void |
setSource(char nodeLabelSource)
Sets the node label source flag |
java.lang.String |
toString()
This method is responsible for returning a String object which represents the content of this NodeLabel. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final java.lang.String SQL_DB_UPDATE_NODE_LABEL
static final java.lang.String SQL_DB_RETRIEVE_NETBIOS_NAME
static final java.lang.String SQL_DB_RETRIEVE_MANAGED_INTERFACES
static final java.lang.String SQL_DB_RETRIEVE_NON_MANAGED_INTERFACES
static final java.lang.String SQL_DB_RETRIEVE_SYSNAME
static final java.lang.String SQL_DB_RETRIEVE_NODELABEL
public static final char SOURCE_USERDEFINED
public static final char SOURCE_NETBIOS
public static final char SOURCE_HOSTNAME
public static final char SOURCE_SYSNAME
public static final char SOURCE_ADDRESS
public static final char SOURCE_UNKNOWN
public static final int MAX_NODE_LABEL_LENGTH
private static final java.lang.String SELECT_METHOD_MIN
private static final java.lang.String SELECT_METHOD_MAX
private static final java.lang.String DEFAULT_SELECT_METHOD
private java.lang.String m_nodeLabel
private char m_nodeLabelSource
Constructor Detail |
public NodeLabel()
public NodeLabel(java.lang.String nodeLabel, char nodeLabelSource)
nodeLabel
- Node labelnodeLabelSource
- Flag indicating source of node labelMethod Detail |
public java.lang.String getLabel()
public char getSource()
public void setLabel(java.lang.String nodeLabel)
nodeLabel
- Node labelpublic void setSource(char nodeLabelSource)
nodeLabelSource
- Flag indicating source of node labelpublic static NodeLabel retrieveLabel(int nodeID) throws java.sql.SQLException
nodeID
- Unique identifier of the node to be updated.
java.sql.SQLException
public static NodeLabel retrieveLabel(int nodeID, java.sql.Connection dbConnection) throws java.sql.SQLException
nodeID
- Unique ID of node whose label info is to be retrieveddbConnection
- SQL database connection
java.sql.SQLException
public static void assignLabel(int nodeID, NodeLabel nodeLabel) throws java.sql.SQLException
nodeID
- Unique identifier of the node to be updated.nodeLabel
- Object containing label and source values.
java.sql.SQLException
public static void assignLabel(int nodeID, NodeLabel nodeLabel, java.sql.Connection dbConnection) throws java.sql.SQLException
nodeID
- Unique identifier of the node to be updated.nodeLabel
- Object containing label and source values.dbConnection
- SQL database connection
java.sql.SQLException
public static NodeLabel computeLabel(int nodeID) throws java.sql.SQLException
nodeID
- Unique identifier of the node to be updated.
java.sql.SQLException
public static NodeLabel computeLabel(int nodeID, java.sql.Connection dbConnection) throws java.sql.SQLException
nodeID
- Unique identifier of the node to be updated.dbConnection
- SQL database connection
java.sql.SQLException
private static void loadAddressList(java.sql.ResultSet rs, java.util.List ipv4AddrList, java.util.List ipHostNameList) throws java.sql.SQLException
rs
- Database result setipv4AddrList
- List of IPv4Address objects representing the node's interfacesipHostNameList
- List of IP host names associated with the node's interfaces.
java.sql.SQLException
- if there is any problem processing the information in the
result set.private static IPv4Address selectPrimaryAddress(java.util.List ipv4AddrList, java.lang.String method)
ipv4AddrList
- List of addresses from which to select the primary interface.method
- String (either "min" or "max") which indicates how the primary
interface is to be selected.
public java.lang.String toString()
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |