|
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.capsd.DbNodeEntry
This class is used to model a row of the node table from the
OpenNMS database. The node table is indexed by the elements dpNode
and nodeID. When a new element is created using the
create
call a node id will be automatically defined. If the
name of the distribute poller is not passed to the create method, the it also
is assigned a default value.
Once loaded or create, the class tracks any changes and will write those
changes to the database whenever the store
method is invoked.
If a database conneciton is not passed to the store method, then a temporary
one is allocated to write the results.
NOTE: if the connection is passed in and is not in auto commit mode, then the
caller must call commit
to inform the database that the
transaction is complete.
Field Summary | |
private static int |
CHANGED_CREATE_TIME
|
private static int |
CHANGED_DOMAIN_NAME
|
private static int |
CHANGED_DPNAME
|
private static int |
CHANGED_LABEL
|
private static int |
CHANGED_LABEL_SOURCE
|
private static int |
CHANGED_NETBIOS_NAME
|
private static int |
CHANGED_OS
|
private static int |
CHANGED_PARENT_ID
|
private static int |
CHANGED_POLLTIME
|
private static int |
CHANGED_SYSCONTACT
|
private static int |
CHANGED_SYSDESCR
|
private static int |
CHANGED_SYSLOC
|
private static int |
CHANGED_SYSNAME
|
private static int |
CHANGED_SYSOID
|
private static int |
CHANGED_TYPE
|
private static java.lang.String |
DEFAULT_DP_NAME
The default distributed poller name to use if one is not supplied |
(package private) static char |
LABEL_SOURCE_ADDRESS
Label source set by IP Address |
(package private) static char |
LABEL_SOURCE_HOSTNAME
Label source set by hostname |
(package private) static char |
LABEL_SOURCE_NETBIOS
Label source set by netbios |
(package private) static char |
LABEL_SOURCE_SYSNAME
Label source set by SNMP sysname |
(package private) static char |
LABEL_SOURCE_UNKNOWN
Label source unset/unknown |
(package private) static char |
LABEL_SOURCE_USER
Label source set by user |
private int |
m_changed
The bit map used to determine which elements have changed since the record was created. |
private java.sql.Timestamp |
m_createTime
The date the record was created, if any |
private java.lang.String |
m_dpName
The name of the distributed poller |
private boolean |
m_fromDb
True if this recored was loaded from the database. |
private java.lang.String |
m_label
The node's label |
private char |
m_labelSource
Source of the label |
private java.sql.Timestamp |
m_lastPoll
The last time the node was scanned. |
private java.lang.String |
m_nbDomainName
The netbios domain name |
private java.lang.String |
m_nbName
The netbios name |
private int |
m_nodeId
The node identifier |
private java.lang.String |
m_os
The operating system |
private int |
m_parentId
The parent identifier, if any |
private java.lang.String |
m_syscontact
SNMP system contact |
private java.lang.String |
m_sysdescr
SNMP system description |
private java.lang.String |
m_syslocation
SNMP system location |
private java.lang.String |
m_sysname
SNMP system name |
private java.lang.String |
m_sysoid
SNMP system object identifier |
private char |
m_type
The type of node, active or deleted. |
(package private) static char |
NODE_TYPE_ACTIVE
The character returned if the node is active |
(package private) static char |
NODE_TYPE_DELETED
The character returned if the node is deleted |
(package private) static char |
NODE_TYPE_UNKNOWN
The character returned if the node type is unset/unknown. |
private static java.lang.String |
SQL_LOAD_IF_LIST
The SQL statement used to read the list of IP Addresses associated with this node. |
private static java.lang.String |
SQL_LOAD_MANAGED_IF_LIST
The SQL statement used to read the list of managed IP Addresses associated with this node. |
private static java.lang.String |
SQL_LOAD_REC
The SQL statement used to read a node from the database. |
private static java.lang.String |
SQL_LOAD_SNMP_LIST
The SQL statement used to read the list of SNMP interface entries for this particular node. |
private static java.lang.String |
SQL_NEXT_NID
The SQL text used to extract the next sequence id for the node table. |
Constructor Summary | |
private |
DbNodeEntry()
Default constructor. |
private |
DbNodeEntry(int nid)
Constructs a new entry with the specific node identifier. |
private |
DbNodeEntry(int nid,
java.lang.String dpName)
Constructs a new entry with the specific node identifier. |
private |
DbNodeEntry(java.lang.String poller)
Constructs a new node entry with no data, except that the distributed poller name is set to the passed string. |
Method Summary | |
(package private) static DbNodeEntry |
clone(DbNodeEntry entry)
Clones an existing entry. |
(package private) static DbNodeEntry |
create()
Creates a new entry. |
(package private) static DbNodeEntry |
create(java.lang.String poller)
Creates a new entry. |
void |
createAssetNodeEntry(java.sql.Connection conn,
int nodeid)
Creates a null entry for a nodeid into the assets table |
(package private) static DbNodeEntry |
get(java.sql.Connection db,
int nid)
Retreives a current record from the database based upon the key fields of nodeID and dpName. |
(package private) static DbNodeEntry |
get(java.sql.Connection db,
int nid,
java.lang.String dpName)
Retreives a current record from the database based upon the key fields of nodeID and dpName. |
(package private) static DbNodeEntry |
get(int nid)
Retreives a current record from the database based upon the key fields of nodeID and dpName. |
(package private) static DbNodeEntry |
get(int nid,
java.lang.String dpName)
Retreives a current record from the database based upon the key fields of nodeID and dpName. |
(package private) java.sql.Timestamp |
getCreationTime()
Gets the creation time of the record. |
(package private) java.lang.String |
getDistributedPollerName()
Returns the name of the distributed poller for the entry. |
(package private) java.lang.String |
getDomainName()
Returns the current domain name. |
(package private) java.lang.String |
getFormattedCreationTime()
Gets the creation time of the record. |
(package private) DbIpInterfaceEntry[] |
getInterfaces()
|
(package private) DbIpInterfaceEntry[] |
getInterfaces(java.sql.Connection db)
|
(package private) java.lang.String |
getLabel()
Returns the entry's label. |
(package private) char |
getLabelSource()
Returns the current label source. |
(package private) java.sql.Timestamp |
getLastPoll()
Gets the last poll time of the record |
(package private) java.lang.String |
getLastPollString()
Gets the last poll time of the record |
(package private) DbIpInterfaceEntry[] |
getManagedInterfaces()
|
(package private) DbIpInterfaceEntry[] |
getManagedInterfaces(java.sql.Connection db)
|
(package private) java.lang.String |
getNetBIOSName()
Returns the current NetBIOS name. |
(package private) int |
getNodeId()
Returns the node entry's unique identifier. |
(package private) char |
getNodeType()
Returns the current node type |
(package private) java.lang.String |
getOS()
Returns the current operating system string |
(package private) int |
getParentId()
Returns the id of the parent. |
(package private) static DbIpInterfaceEntry |
getPrimarySnmpInterface(DbIpInterfaceEntry[] ipInterfaces)
|
(package private) DbSnmpInterfaceEntry[] |
getSnmpInterfaces()
|
(package private) DbSnmpInterfaceEntry[] |
getSnmpInterfaces(java.sql.Connection db)
|
(package private) java.lang.String |
getSystemContact()
Returns the current system contact. |
(package private) java.lang.String |
getSystemDescription()
Returns the current system description |
(package private) java.lang.String |
getSystemLocation()
Returns the current system location |
(package private) java.lang.String |
getSystemName()
Gets the current system name |
(package private) java.lang.String |
getSystemOID()
Returns the current SNMP system object id, if any. |
(package private) boolean |
hasDomainNameChanged()
|
(package private) boolean |
hasLabelChanged()
|
(package private) boolean |
hasLabelSourceChanged()
|
(package private) boolean |
hasNetBIOSNameChanged()
|
(package private) boolean |
hasNodeTypeChanged()
|
(package private) boolean |
hasOSChanged()
|
(package private) boolean |
hasParentId()
Returns true if the entry has a parent identity. |
(package private) boolean |
hasParentIdChanged()
|
(package private) boolean |
hasSystemContactChanged()
|
(package private) boolean |
hasSystemDescriptionChanged()
|
(package private) boolean |
hasSystemLocationChanged()
|
(package private) boolean |
hasSystemNameChanged()
|
(package private) boolean |
hasSystemOIDChanged()
|
private void |
insert(java.sql.Connection c)
Inserts the new node into the node table of the OpenNMS databasee. |
private boolean |
load(java.sql.Connection c)
Load the current node from the database. |
(package private) void |
setCreationTime(java.util.Date time)
Sets the current creation time. |
(package private) void |
setCreationTime(java.lang.String time)
Sets the current creation time. |
(package private) void |
setCreationTime(java.sql.Timestamp time)
Sets the current creation time. |
(package private) void |
setDomainName(java.lang.String domain)
Sets the current domain name. |
(package private) void |
setLabel(java.lang.String label)
Sets the current label for the entry. |
(package private) void |
setLabelSource(char src)
Sets the source of the node's label. |
(package private) void |
setLastPoll(java.util.Date time)
Sets the last poll time. |
(package private) void |
setLastPoll(java.lang.String time)
Sets the last poll time. |
(package private) void |
setLastPoll(java.sql.Timestamp time)
Sets the last poll time. |
(package private) void |
setNetBIOSName(java.lang.String name)
Sets the current NetBIOS name. |
(package private) void |
setNodeType(char type)
Sets the node type |
(package private) void |
setOS(java.lang.String os)
Sets the current operating system string. |
(package private) void |
setParentId(int id)
Sets the id of the parent. |
(package private) void |
setSystemContact(java.lang.String contact)
Sets the current system contact. |
(package private) void |
setSystemDescription(java.lang.String descr)
Sets the current system description |
(package private) void |
setSystemLocation(java.lang.String loc)
Sets the current system location. |
(package private) void |
setSystemName(java.lang.String name)
Sets the current system name. |
(package private) void |
setSystemOID(java.lang.String oid)
Sets the current SNMP system object id. |
(package private) void |
store()
Updates the node information in the configured database. |
(package private) void |
store(java.sql.Connection db)
Updates the node information in the configured database. |
java.lang.String |
toString()
Creates a string that displays the internal contents of the record. |
private void |
update(java.sql.Connection c)
Updates an existing record in the OpenNMS node table. |
(package private) boolean |
updateDomainName(java.lang.String domain)
|
(package private) boolean |
updateLabel(java.lang.String newlabel)
|
(package private) boolean |
updateLabelSource(char newlabelSource)
|
(package private) boolean |
updateNetBIOSName(java.lang.String newnbName)
|
(package private) boolean |
updateNodeType(char newtype)
|
(package private) boolean |
updateOS(java.lang.String newos)
|
(package private) boolean |
updateParentId(int newparentId)
|
(package private) boolean |
updateSystemContact(java.lang.String newsyscontact)
|
(package private) boolean |
updateSystemDescription(java.lang.String newsysdescr)
|
(package private) boolean |
updateSystemLocation(java.lang.String newsyslocation)
|
(package private) boolean |
updateSystemName(java.lang.String newsysname)
|
(package private) boolean |
updateSystemOID(java.lang.String newsysoid)
Update the value of sysoid associated with this node entry. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final char NODE_TYPE_ACTIVE
static final char NODE_TYPE_DELETED
static final char NODE_TYPE_UNKNOWN
static final char LABEL_SOURCE_USER
static final char LABEL_SOURCE_NETBIOS
static final char LABEL_SOURCE_HOSTNAME
static final char LABEL_SOURCE_SYSNAME
static final char LABEL_SOURCE_ADDRESS
static final char LABEL_SOURCE_UNKNOWN
private static final java.lang.String DEFAULT_DP_NAME
private static final java.lang.String SQL_NEXT_NID
private static final java.lang.String SQL_LOAD_REC
private static final java.lang.String SQL_LOAD_IF_LIST
private static final java.lang.String SQL_LOAD_MANAGED_IF_LIST
private static final java.lang.String SQL_LOAD_SNMP_LIST
private boolean m_fromDb
private int m_nodeId
private java.lang.String m_dpName
private java.sql.Timestamp m_createTime
private int m_parentId
private char m_type
private java.lang.String m_sysoid
private java.lang.String m_sysname
private java.lang.String m_sysdescr
private java.lang.String m_syslocation
private java.lang.String m_syscontact
private java.lang.String m_label
private char m_labelSource
private java.lang.String m_nbName
private java.lang.String m_nbDomainName
private java.lang.String m_os
private java.sql.Timestamp m_lastPoll
private int m_changed
private static final int CHANGED_CREATE_TIME
private static final int CHANGED_PARENT_ID
private static final int CHANGED_TYPE
private static final int CHANGED_SYSOID
private static final int CHANGED_SYSNAME
private static final int CHANGED_SYSLOC
private static final int CHANGED_SYSCONTACT
private static final int CHANGED_LABEL
private static final int CHANGED_LABEL_SOURCE
private static final int CHANGED_NETBIOS_NAME
private static final int CHANGED_DOMAIN_NAME
private static final int CHANGED_OS
private static final int CHANGED_DPNAME
private static final int CHANGED_SYSDESCR
private static final int CHANGED_POLLTIME
Constructor Detail |
private DbNodeEntry()
private DbNodeEntry(java.lang.String poller)
poller
- The poller name.private DbNodeEntry(int nid)
nid
- The node identifier.private DbNodeEntry(int nid, java.lang.String dpName)
nid
- The node identifier.dpName
- The name of the distributed poller.Method Detail |
private void insert(java.sql.Connection c) throws java.sql.SQLException
c
- The connection to the database.
java.sql.SQLException
- Thrown if an error occurs with the connectionprivate void update(java.sql.Connection c) throws java.sql.SQLException
c
- The connection used for the update.
java.sql.SQLException
- Thrown if an error occurs with the connectionprivate boolean load(java.sql.Connection c) throws java.sql.SQLException
c
- The connection used to load the data.
java.sql.SQLException
- Thrown if an error occurs with the connectionint getNodeId()
java.lang.String getDistributedPollerName()
java.sql.Timestamp getCreationTime()
java.lang.String getFormattedCreationTime()
void setCreationTime(java.lang.String time) throws java.text.ParseException
time
- The creation time.
java.text.ParseException
void setCreationTime(java.util.Date time)
time
- The creation time.void setCreationTime(java.sql.Timestamp time)
time
- The creation time.boolean hasParentId()
int getParentId()
void setParentId(int id)
id
- The new parent id.boolean hasParentIdChanged()
boolean updateParentId(int newparentId)
char getNodeType()
void setNodeType(char type)
type
- The new node type.boolean hasNodeTypeChanged()
boolean updateNodeType(char newtype)
java.lang.String getSystemOID()
void setSystemOID(java.lang.String oid)
boolean hasSystemOIDChanged()
boolean updateSystemOID(java.lang.String newsysoid)
java.lang.String getSystemName()
void setSystemName(java.lang.String name)
name
- The new system nameboolean hasSystemNameChanged()
boolean updateSystemName(java.lang.String newsysname)
java.lang.String getSystemDescription()
void setSystemDescription(java.lang.String descr)
descr
- The new system description.boolean hasSystemDescriptionChanged()
boolean updateSystemDescription(java.lang.String newsysdescr)
java.lang.String getSystemLocation()
void setSystemLocation(java.lang.String loc)
loc
- The new locationboolean hasSystemLocationChanged()
boolean updateSystemLocation(java.lang.String newsyslocation)
java.lang.String getSystemContact()
void setSystemContact(java.lang.String contact)
contact
- The new system contactboolean hasSystemContactChanged()
boolean updateSystemContact(java.lang.String newsyscontact)
java.lang.String getLabel()
void setLabel(java.lang.String label)
label
- The new label.boolean hasLabelChanged()
boolean updateLabel(java.lang.String newlabel)
char getLabelSource()
void setLabelSource(char src)
src
- The new label source.boolean hasLabelSourceChanged()
boolean updateLabelSource(char newlabelSource)
java.lang.String getNetBIOSName()
void setNetBIOSName(java.lang.String name)
name
- The new NetBIOS name.boolean hasNetBIOSNameChanged()
boolean updateNetBIOSName(java.lang.String newnbName)
java.lang.String getDomainName()
void setDomainName(java.lang.String domain)
domain
- The new domain name.boolean hasDomainNameChanged()
boolean updateDomainName(java.lang.String domain)
java.lang.String getOS()
void setOS(java.lang.String os)
os
- The OS stringboolean hasOSChanged()
boolean updateOS(java.lang.String newos)
java.lang.String getLastPollString()
java.sql.Timestamp getLastPoll()
void setLastPoll(java.lang.String time) throws java.text.ParseException
time
- The last poll time.
java.text.ParseException
void setLastPoll(java.util.Date time)
time
- The last poll time.void setLastPoll(java.sql.Timestamp time)
time
- The last poll time.void store() throws java.sql.SQLException
java.sql.SQLException
void store(java.sql.Connection db) throws java.sql.SQLException
db
- The database connection used to write the record.
java.sql.SQLException
DbIpInterfaceEntry[] getInterfaces() throws java.sql.SQLException
java.sql.SQLException
DbIpInterfaceEntry[] getInterfaces(java.sql.Connection db) throws java.sql.SQLException
java.sql.SQLException
DbIpInterfaceEntry[] getManagedInterfaces() throws java.sql.SQLException
java.sql.SQLException
DbIpInterfaceEntry[] getManagedInterfaces(java.sql.Connection db) throws java.sql.SQLException
java.sql.SQLException
static DbIpInterfaceEntry getPrimarySnmpInterface(DbIpInterfaceEntry[] ipInterfaces)
DbSnmpInterfaceEntry[] getSnmpInterfaces() throws java.sql.SQLException
java.sql.SQLException
DbSnmpInterfaceEntry[] getSnmpInterfaces(java.sql.Connection db) throws java.sql.SQLException
java.sql.SQLException
static DbNodeEntry create()
store
.
static DbNodeEntry create(java.lang.String poller)
store
.
poller
- The name of the distributed poller to use.
static DbNodeEntry clone(DbNodeEntry entry)
entry
- The entry to be cloned
static DbNodeEntry get(int nid) throws java.sql.SQLException
nid
- The node id key
java.sql.SQLException
static DbNodeEntry get(int nid, java.lang.String dpName) throws java.sql.SQLException
nid
- The node id key
java.sql.SQLException
static DbNodeEntry get(java.sql.Connection db, int nid) throws java.sql.SQLException
db
- The databse connection used to load the entry.nid
- The node id key
java.sql.SQLException
static DbNodeEntry get(java.sql.Connection db, int nid, java.lang.String dpName) throws java.sql.SQLException
db
- The databse connection used to load the entry.nid
- The node id keydpName
- The distribute poller name key
java.sql.SQLException
public java.lang.String toString()
public void createAssetNodeEntry(java.sql.Connection conn, int nodeid) throws java.sql.SQLException
java.sql.SQLException
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |