Class NodeLabelJDBCImpl

  • All Implemented Interfaces:
    NodeLabel

    public class NodeLabelJDBCImpl
    extends Object
    implements NodeLabel
    Deprecated.
    This class is highly deprecated. You should use NodeDao directly in most cases or use NodeLabelDaoImpl.

    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
    
     
    Author:
    Mike , OpenNMS
    • Constructor Detail

      • NodeLabelJDBCImpl

        public NodeLabelJDBCImpl()
        Deprecated.
        Default constructor
      • NodeLabelJDBCImpl

        public NodeLabelJDBCImpl​(String nodeLabel,
                                 OnmsNode.NodeLabelSource nodeLabelSource)
        Deprecated.
        Constructor
        Parameters:
        nodeLabel - Node label
        nodeLabelSource - Flag indicating source of node label
    • Method Detail

      • getLabel

        public String getLabel()
        Deprecated.
        Returns the node label .
        Specified by:
        getLabel in interface NodeLabel
        Returns:
        node label
      • retrieveLabel

        public NodeLabel retrieveLabel​(int nodeID)
                                throws SQLException
        Deprecated.
        Use a NodeDao#load(Integer) method call instead
        This method queries the 'node' table for the value of the 'nodelabel' and 'nodelabelsource' fields for the node with the provided nodeID. A NodeLabel object is returned initialized with the retrieved values. WARNING: A properly instantiated and initialized Vault class object is required prior to calling this method. This method will initially only be called from the WEB UI.
        Specified by:
        retrieveLabel in interface NodeLabel
        Parameters:
        nodeID - Unique identifier of the node to be updated.
        Returns:
        Object containing label and source values.
        Throws:
        SQLException - if any.
      • assignLabel

        public void assignLabel​(int nodeID,
                                NodeLabel nodeLabel)
                         throws SQLException
        Deprecated.
        Use a NodeDao#update(org.opennms.netmgt.model.OnmsNode) method call instead
        This method updates the 'nodelabel' and 'nodelabelsource' fields of the 'node' table for the specified nodeID. A database connection is retrieved from the Vault. WARNING: A properly instantiated and initialized Vault class object is required prior to calling this method. This method will initially only be called from the WEB UI.
        Specified by:
        assignLabel in interface NodeLabel
        Parameters:
        nodeID - Unique identifier of the node to be updated.
        nodeLabel - Object containing label and source values.
        Throws:
        SQLException - if any.
      • computeLabel

        public NodeLabel computeLabel​(int nodeID)
                               throws SQLException
        Deprecated.
        Update this to use modern DAO methods instead of raw SQL
        This method determines what label should be associated with a particular node. A database connection is retrieved from the Vault. WARNING: A properly instantiated and initialized Vault class object is required prior to calling this method. This method will initially only be called from the WEB UI.
        Specified by:
        computeLabel in interface NodeLabel
        Parameters:
        nodeID - Unique identifier of the node to be updated.
        Returns:
        NodeLabel Object containing label and source values
        Throws:
        SQLException - if any.
      • toString

        public String toString()
        Deprecated.
        This method is responsible for returning a String object which represents the content of this NodeLabel. Primarily used for debugging purposes.
        Specified by:
        toString in interface NodeLabel
        Overrides:
        toString in class Object
        Returns:
        String which represents the content of this NodeLabel