|
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.DbIpInterfaceEntry
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_HOSTNAME
|
private static int |
CHANGED_IFINDEX
|
private static int |
CHANGED_MANAGED
|
private static int |
CHANGED_POLLTIME
|
private static int |
CHANGED_PRIMARY
|
private static int |
CHANGED_STATUS
|
private int |
m_changed
The bit map used to determine which elements have changed since the record was created. |
private boolean |
m_fromDb
True if this recored was loaded from the database. |
private java.lang.String |
m_hostname
The hostname string, if any |
private int |
m_ifIndex
The SNMP ifIndex |
private java.net.InetAddress |
m_ipAddr
The IP address. |
private java.sql.Timestamp |
m_lastPoll
The last time the interface was checked. |
private char |
m_managedState
The managed status, if any |
private int |
m_nodeId
The node identifier |
private char |
m_primaryState
The SNMP primary status. |
private int |
m_status
The status of the interface |
private boolean |
m_useIfIndexAsKey
|
static char |
SNMP_NOT_ELIGIBLE
|
static char |
SNMP_PRIMARY
|
static char |
SNMP_SECONDARY
|
static char |
SNMP_UNKNOWN
|
private static java.lang.String |
SQL_LOAD_IFSVC_LIST
This is the SQL statement used to load the list of service identifiers associated with this interface. |
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_REC_IFINDEX
This is the SQL statement used to load a record when the ifIndex is involved as part of the key lookup. |
static char |
STATE_ALIAS
|
static char |
STATE_DELETED
|
static char |
STATE_FORCED
|
static char |
STATE_MANAGED
|
static char |
STATE_NOT_POLLED
|
static char |
STATE_UNKNOWN
|
static char |
STATE_UNMANAGED
|
Constructor Summary | |
private |
DbIpInterfaceEntry()
Default constructor. |
private |
DbIpInterfaceEntry(int nid,
java.net.InetAddress address,
boolean exists)
Constructs a new interface. |
private |
DbIpInterfaceEntry(int nid,
java.net.InetAddress address,
int ifIndex,
boolean exists)
Constructs a new interface, this constructor will only work for entries loaded from the database! |
Method Summary | |
(package private) static DbIpInterfaceEntry |
clone(DbIpInterfaceEntry entry)
Clones an existing entry. |
(package private) static DbIpInterfaceEntry |
create(int nid,
java.net.InetAddress address)
Creates a new entry. |
(package private) static DbIpInterfaceEntry |
create(int nid,
java.net.InetAddress address,
int ifIndex)
Creates a new entry. |
(package private) static DbIpInterfaceEntry |
get(java.sql.Connection db,
int nid,
java.net.InetAddress addr)
Retreives a current record from the database based upon the key fields of nodeID and ipAddr. |
(package private) static DbIpInterfaceEntry |
get(java.sql.Connection db,
int nid,
java.net.InetAddress addr,
int ifIndex)
Retreives a current record from the database based upon the key fields of nodeID and ipAddr. |
(package private) static DbIpInterfaceEntry |
get(int nid,
java.net.InetAddress addr)
Retreives a current record from the database based upon the key fields of nodeID and ipAddr. |
(package private) static DbIpInterfaceEntry |
get(int nid,
java.net.InetAddress addr,
int ifIndex)
Retreives a current record from the database based upon the key fields of nodeID and ipAddr. |
(package private) java.lang.String |
getHostname()
Returns the current hostname. |
(package private) java.net.InetAddress |
getIfAddress()
Returns the name of the distributed poller for the entry. |
(package private) int |
getIfIndex()
Returns the current ifIndex |
(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) char |
getManagedState()
Returns the current managed state of the interface |
(package private) int |
getNodeId()
Returns the node entry's unique identifier. |
(package private) char |
getPrimaryState()
Returns the current primary state. |
(package private) DbIfServiceEntry[] |
getServices()
|
(package private) DbIfServiceEntry[] |
getServices(java.sql.Connection db)
|
(package private) int |
getStatus()
Gets the current operational status field |
(package private) boolean |
hasHostnameChanged()
|
(package private) boolean |
hasIfIndex()
Returns true if the ifIndex is defined. |
(package private) boolean |
hasIfIndexChanged()
|
(package private) boolean |
hasManagedStateChanged()
|
(package private) boolean |
hasPrimaryStateChanged()
|
(package private) boolean |
hasStatusChanged()
|
private void |
insert(java.sql.Connection c)
Inserts the new interface into the ipInterface table of the OpenNMS databasee. |
private boolean |
load(java.sql.Connection c)
Load the current interface from the database. |
static void |
main(java.lang.String[] args)
For debugging only |
(package private) void |
setHostname(java.lang.String name)
Sets the current hostname. |
(package private) void |
setIfIndex(int ndx)
Sets the ifIndex value |
(package private) void |
setLastPoll(java.util.Date time)
Sets the current creation time. |
(package private) void |
setLastPoll(java.lang.String time)
Sets the current creation time. |
(package private) void |
setLastPoll(java.sql.Timestamp time)
Sets the current creation time. |
(package private) void |
setManagedState(char state)
Sets the managed state of the instance. |
(package private) void |
setPrimaryState(char state)
Sets the new primary state. |
(package private) void |
setStatus(int status)
Sets the current status of the interface |
(package private) void |
store()
Updates the interface information in the configured database. |
(package private) void |
store(java.sql.Connection db)
Updates the interface 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 ipInterface table. |
(package private) boolean |
updateHostname(java.lang.String newHostname)
|
(package private) boolean |
updateIfIndex(int newIfIndex)
|
(package private) boolean |
updateManagedState(char newManagedState)
|
(package private) boolean |
updatePrimaryState(char newPrimaryState)
|
(package private) boolean |
updateStatus(int newStatus)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final char SNMP_PRIMARY
public static final char SNMP_SECONDARY
public static final char SNMP_NOT_ELIGIBLE
public static final char SNMP_UNKNOWN
public static final char STATE_MANAGED
public static final char STATE_UNMANAGED
public static final char STATE_ALIAS
public static final char STATE_DELETED
public static final char STATE_FORCED
public static final char STATE_NOT_POLLED
public static final char STATE_UNKNOWN
private static final java.lang.String SQL_LOAD_REC
private static final java.lang.String SQL_LOAD_IFSVC_LIST
private static final java.lang.String SQL_LOAD_REC_IFINDEX
private boolean m_fromDb
private int m_nodeId
private java.net.InetAddress m_ipAddr
private int m_ifIndex
private java.lang.String m_hostname
private int m_status
private char m_managedState
private java.sql.Timestamp m_lastPoll
private char m_primaryState
private int m_changed
private static final int CHANGED_IFINDEX
private static final int CHANGED_HOSTNAME
private static final int CHANGED_MANAGED
private static final int CHANGED_STATUS
private static final int CHANGED_POLLTIME
private static final int CHANGED_PRIMARY
private boolean m_useIfIndexAsKey
Constructor Detail |
private DbIpInterfaceEntry()
private DbIpInterfaceEntry(int nid, java.net.InetAddress address, boolean exists)
nid
- The node identifier.address
- The target interface address.exists
- True if the interface already exists.private DbIpInterfaceEntry(int nid, java.net.InetAddress address, int ifIndex, boolean exists)
nid
- The node identifier.address
- The target interface address.ifIndex
- The target ifIndex of the node/address pairexists
- True if the interface already exists.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.net.InetAddress getIfAddress()
java.lang.String getLastPollString()
java.sql.Timestamp getLastPoll()
void setLastPoll(java.lang.String time) throws java.text.ParseException
time
- The creation time.
java.text.ParseException
void setLastPoll(java.util.Date time)
time
- The creation time.void setLastPoll(java.sql.Timestamp time)
time
- The creation time.boolean hasIfIndex()
int getIfIndex()
void setIfIndex(int ndx)
ndx
- The new ifIndex.boolean hasIfIndexChanged()
boolean updateIfIndex(int newIfIndex)
java.lang.String getHostname()
void setHostname(java.lang.String name)
name
- The new hostnameboolean hasHostnameChanged()
boolean updateHostname(java.lang.String newHostname)
char getManagedState()
void setManagedState(char state)
state
- The new managed stateboolean hasManagedStateChanged()
boolean updateManagedState(char newManagedState)
int getStatus()
void setStatus(int status)
status
- The new status.boolean hasStatusChanged()
boolean updateStatus(int newStatus)
char getPrimaryState()
void setPrimaryState(char state)
state
- The new primary state.boolean hasPrimaryStateChanged()
boolean updatePrimaryState(char newPrimaryState)
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
DbIfServiceEntry[] getServices() throws java.sql.SQLException
java.sql.SQLException
DbIfServiceEntry[] getServices(java.sql.Connection db) throws java.sql.SQLException
java.sql.SQLException
static DbIpInterfaceEntry create(int nid, java.net.InetAddress address)
store
.
address
- The address of the interface.nid
- The node id of the interface.
static DbIpInterfaceEntry create(int nid, java.net.InetAddress address, int ifIndex)
store
.
address
- The address of the interface.nid
- The node id of the interface.ifIndex
- The ifindex of the interface.
static DbIpInterfaceEntry clone(DbIpInterfaceEntry entry)
entry
- The entry to be cloned
static DbIpInterfaceEntry get(int nid, java.net.InetAddress addr) throws java.sql.SQLException
nid
- The node id keyaddr
- The ip address.
java.sql.SQLException
static DbIpInterfaceEntry get(int nid, java.net.InetAddress addr, int ifIndex) throws java.sql.SQLException
nid
- The node id keyaddr
- The ip address.ifIndex
- The interface index.
java.sql.SQLException
static DbIpInterfaceEntry get(java.sql.Connection db, int nid, java.net.InetAddress addr) throws java.sql.SQLException
db
- The databse connection used to load the entry.nid
- The node id keyaddr
- The internet address.
java.sql.SQLException
static DbIpInterfaceEntry get(java.sql.Connection db, int nid, java.net.InetAddress addr, int ifIndex) throws java.sql.SQLException
db
- The databse connection used to load the entry.nid
- The node id keyaddr
- The internet address.ifIndex
- The interface index.
java.sql.SQLException
public java.lang.String toString()
public static void main(java.lang.String[] args)
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |