|
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.DbIfServiceEntry
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_IFINDEX
|
private static int |
CHANGED_LASTFAIL
|
private static int |
CHANGED_LASTGOOD
|
private static int |
CHANGED_NOTIFY
|
private static int |
CHANGED_QUALIFIER
|
private static int |
CHANGED_SOURCE
|
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 int |
m_ifIndex
The SNMP ifIndex |
private java.net.InetAddress |
m_ipAddr
The IP address. |
private java.sql.Timestamp |
m_lastFail
The last time the interface failed. |
private java.sql.Timestamp |
m_lastGood
The last time the interface succeeded. |
private int |
m_nodeId
The node identifier |
private char |
m_notify
The notification state. |
private java.lang.String |
m_qualifier
The qualifier string |
private int |
m_serviceId
The integer service id |
private char |
m_source
The managed status, if any |
private char |
m_status
The status of the interface |
(package private) static char |
NOTIFY_OFF
|
(package private) static char |
NOTIFY_ON
|
(package private) static char |
NOTIFY_UNKNOWN
|
(package private) static char |
SOURCE_FORCED
|
(package private) static char |
SOURCE_PLUGIN
|
(package private) static char |
SOURCE_UNKNOWN
|
private static java.lang.String |
SQL_LOAD_REC
The SQL statement used to read a node from the database. |
static char |
STATUS_ACTIVE
|
static char |
STATUS_DELETED
|
static char |
STATUS_FORCED
|
static char |
STATUS_NOT_POLLED
|
static char |
STATUS_RESUME
|
static char |
STATUS_SUSPEND
|
static char |
STATUS_UNKNOWN
|
static char |
STATUS_UNMANAGED
|
Constructor Summary | |
private |
DbIfServiceEntry()
Default constructor. |
private |
DbIfServiceEntry(int nid,
java.net.InetAddress address,
int sid,
boolean exists)
Constructs a new interface. |
Method Summary | |
(package private) static DbIfServiceEntry |
create(int nid,
java.net.InetAddress address,
int sid)
Creates a new entry. |
(package private) static DbIfServiceEntry |
get(java.sql.Connection db,
int nid,
java.net.InetAddress addr,
int sid)
Retreives a current record from the database based upon the key fields of nodeID and ipAddr. |
(package private) static DbIfServiceEntry |
get(int nid,
java.net.InetAddress addr,
int sid)
Retreives a current record from the database based upon the key fields of nodeID and ipAddr. |
(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 |
getLastFail()
Gets the last fail poll time of the record |
(package private) java.lang.String |
getLastFailString()
Gets the last fail poll time of the record |
(package private) java.sql.Timestamp |
getLastGood()
Gets the last good poll time of the record |
(package private) java.lang.String |
getLastGoodString()
Gets the last good poll time of the record |
(package private) int |
getNodeId()
Returns the node entry's unique identifier. |
(package private) char |
getNotify()
Gets the notification state. |
(package private) java.lang.String |
getQualifier()
|
(package private) int |
getServiceId()
Returns the service id of this service entry. |
(package private) char |
getSource()
Gets the source of the interface service. |
(package private) char |
getStatus()
Gets the current operational status field |
(package private) boolean |
hasIfIndex()
Returns true if the ifIndex is defined. |
(package private) boolean |
hasIfIndexChanged()
|
(package private) boolean |
hasNotifyChanged()
|
(package private) boolean |
hasQualifierChanged()
|
(package private) boolean |
hasSourceChanged()
|
(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 |
setIfIndex(int ndx)
Sets the ifIndex value |
(package private) void |
setLastFail(java.util.Date time)
Sets the current last fail poll time. |
(package private) void |
setLastFail(java.lang.String time)
Sets the current last fail poll time |
(package private) void |
setLastFail(java.sql.Timestamp time)
Sets the current last fail poll time. |
(package private) void |
setLastGood(java.util.Date time)
Sets the current last good poll time. |
(package private) void |
setLastGood(java.lang.String time)
Sets the current last good poll time |
(package private) void |
setLastGood(java.sql.Timestamp time)
Sets the current last good poll time. |
(package private) void |
setNotify(char notify)
Sets the notification state |
(package private) void |
setQualifier(java.lang.String qualifier)
|
(package private) void |
setSource(char src)
Sets the source of the interface service |
(package private) void |
setStatus(char status)
Sets the current status of the service |
(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 ifServices table. |
(package private) boolean |
updateIfIndex(int newIfIndex)
|
(package private) boolean |
updateNotify(char newNotify)
|
(package private) boolean |
updateQualifier(java.lang.String newQualifier)
|
(package private) boolean |
updateSource(char newSource)
|
(package private) boolean |
updateStatus(char newStatus)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final char STATUS_UNMANAGED
public static final char STATUS_ACTIVE
public static final char STATUS_DELETED
public static final char STATUS_FORCED
public static final char STATUS_NOT_POLLED
public static final char STATUS_UNKNOWN
public static final char STATUS_SUSPEND
public static final char STATUS_RESUME
static final char SOURCE_PLUGIN
static final char SOURCE_FORCED
static final char SOURCE_UNKNOWN
static final char NOTIFY_ON
static final char NOTIFY_OFF
static final char NOTIFY_UNKNOWN
private static final java.lang.String SQL_LOAD_REC
private boolean m_fromDb
private int m_nodeId
private java.net.InetAddress m_ipAddr
private int m_serviceId
private int m_ifIndex
private char m_status
private char m_source
private java.sql.Timestamp m_lastFail
private java.sql.Timestamp m_lastGood
private char m_notify
private java.lang.String m_qualifier
private int m_changed
private static final int CHANGED_IFINDEX
private static final int CHANGED_LASTGOOD
private static final int CHANGED_LASTFAIL
private static final int CHANGED_STATUS
private static final int CHANGED_SOURCE
private static final int CHANGED_NOTIFY
private static final int CHANGED_QUALIFIER
Constructor Detail |
private DbIfServiceEntry()
private DbIfServiceEntry(int nid, java.net.InetAddress address, int sid, boolean exists)
nid
- The node identifier.address
- The target interface address.sid
- The service identifierexists
- 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()
int getServiceId()
java.lang.String getLastGoodString()
java.sql.Timestamp getLastGood()
void setLastGood(java.lang.String time) throws java.text.ParseException
time
- The poll time.
java.text.ParseException
void setLastGood(java.util.Date time)
time
- The poll time.void setLastGood(java.sql.Timestamp time)
time
- The poll time.java.lang.String getLastFailString()
java.sql.Timestamp getLastFail()
void setLastFail(java.lang.String time) throws java.text.ParseException
time
- The poll time.
java.text.ParseException
void setLastFail(java.util.Date time)
time
- The poll time.void setLastFail(java.sql.Timestamp time)
time
- The poll time.boolean hasIfIndex()
int getIfIndex()
void setIfIndex(int ndx)
ndx
- The new ifIndex.boolean hasIfIndexChanged()
boolean updateIfIndex(int newIfIndex)
char getStatus()
void setStatus(char status)
status
- The new status.boolean hasStatusChanged()
boolean updateStatus(char newStatus)
char getSource()
void setSource(char src)
boolean hasSourceChanged()
boolean updateSource(char newSource)
char getNotify()
void setNotify(char notify)
boolean hasNotifyChanged()
boolean updateNotify(char newNotify)
java.lang.String getQualifier()
void setQualifier(java.lang.String qualifier)
boolean hasQualifierChanged()
boolean updateQualifier(java.lang.String newQualifier)
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
static DbIfServiceEntry create(int nid, java.net.InetAddress address, int sid)
store
.
address
- The address of the interface.nid
- The node id of the interface.sid
- The service id for the interface.
static DbIfServiceEntry get(int nid, java.net.InetAddress addr, int sid) throws java.sql.SQLException
nid
- The node id keyaddr
- The ip address.sid
- The service id.
java.sql.SQLException
static DbIfServiceEntry get(java.sql.Connection db, int nid, java.net.InetAddress addr, int sid) throws java.sql.SQLException
db
- The databse connection used to load the entry.nid
- The node id keyaddr
- The internet address.
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 |