devices
Class Change

java.lang.Object
  extended bydevices.Change

public class Change
extends java.lang.Object

Changes represent database changes the polling process needs to know. Each Change record indicates the monitoring or unmonitoring of a Device, DeviceInterface, or Attribute, the indication that a Device, Interface, or Attribute's DB record changed, or a record may indicate time to shutdown the system.

Version:
0.1
Author:
gswalters

Field Summary
static java.lang.String MONITOR
           
static java.lang.String SHUTDOWN
           
static java.lang.String UNMONITOR
           
static java.lang.String UPDATE
           
 
Constructor Summary
Change(long changeID, java.lang.String changeType, long deviceID, int ifIndex, int oid)
          Construct full object.
 
Method Summary
 boolean dbDeleteChange(java.sql.Connection dbConn)
          Delete this Change record from the database.
 boolean dbInsertChange(java.sql.Connection dbConn)
          Insert a new Change into the database.
 long getChangeID()
          Getters
 java.lang.String getChangeType()
           
 long getDeviceID()
           
 int getIfIndex()
           
 int getOid()
           
 java.lang.String toString()
          Convert the Change object into a printable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MONITOR

public static final java.lang.String MONITOR
See Also:
Constant Field Values

UNMONITOR

public static final java.lang.String UNMONITOR
See Also:
Constant Field Values

UPDATE

public static final java.lang.String UPDATE
See Also:
Constant Field Values

SHUTDOWN

public static final java.lang.String SHUTDOWN
See Also:
Constant Field Values
Constructor Detail

Change

public Change(long changeID,
              java.lang.String changeType,
              long deviceID,
              int ifIndex,
              int oid)
Construct full object. A change may pertain to an Attribute, thus all three data members contain valid values. If the change pertains to an Interface, only the deviceID and ifIndex contain valid values. If the change pertains to a Device, only the deviceID holds a valid value. If the change is shutdown, only the changeType contains a valid value.

Valid combinations:
    shutdown, 0, 0, 0
    monitor, x, 0, 0 (device)
    unmonitor, x, 0, 0 (device)
    monitor, x, x, 0 (interface)
    unmonitor, x, x, 0 (interface)
    monitor, x, x, x (attribute)
    unmonitor, x, x, x (attribute)
    update, x, 0, 0 (device)
    update, x, x, 0 (interface)
    update, x, x, x (attribute)

Parameters:
changeID - int value of the Change table record ID
changeType - String containing the type of change
deviceID - int value of the changed Device record in the database
ifIndex - int value of the changed DeviceInterface's index
oid - int value of the changed Attribute's OID
Method Detail

dbInsertChange

public boolean dbInsertChange(java.sql.Connection dbConn)
Insert a new Change into the database.

Returns:
Boolean indicating if the Change was added

dbDeleteChange

public boolean dbDeleteChange(java.sql.Connection dbConn)
Delete this Change record from the database.

Parameters:
dbConn - Connection to the databse
Returns:
Boolean value indicating operation success

toString

public java.lang.String toString()
Convert the Change object into a printable String.

Returns:
String containing the Change information nicely formatted

getChangeID

public long getChangeID()
Getters


getChangeType

public java.lang.String getChangeType()

getDeviceID

public long getDeviceID()

getIfIndex

public int getIfIndex()

getOid

public int getOid()