devices
Class DeviceInterface

java.lang.Object
  extended bydevices.DeviceInterface

public class DeviceInterface
extends java.lang.Object

An interface (e.g., port) contained within a Device. Each interface may be a port, or a module of other ports. It is the interface that contains attributes to poll and monitor.

Version:
0.1
Author:
ryan/gswalters

Constructor Summary
DeviceInterface(java.sql.Connection dbConn, long deviceID, int ifIndex)
          Query the database and create a DeviceInterface from the query results.
DeviceInterface(long deviceID, int ifIndex, java.lang.String ifDescr, long ifSpeed, int ifOperStatus, boolean monitored, boolean removed)
          Create a full DeviceInterface object.
DeviceInterface(java.sql.ResultSet sqlResults)
          Create a DeviceInterface from a database query result set.
 
Method Summary
 boolean dbInsertInterface(java.sql.Connection dbConn)
          Add a new Interface to the database.
 boolean dbUpdateInterface(java.sql.Connection dbConn)
          Update detail fields in a DeviceInterface record in the database.
 long getDeviceID()
          Getters
 java.lang.String getIfDescr()
           
 int getIfIndex()
           
 int getIfOperStatus()
           
 long getIfSpeed()
           
 boolean isMonitored()
           
 boolean isRemoved()
           
 void setDeviceID(long deviceID)
          Setters
 void setIfDescr(java.lang.String ifDescr)
           
 void setIfIndex(int ifIndex)
           
 void setIfOperStatus(int ifOperStatus)
           
 void setIfSpeed(long ifSpeed)
           
 void setMonitored(boolean monitored)
           
 void setRemoved(boolean removed)
           
 java.lang.String toString()
          Convert the DeviceInterface object into a printable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeviceInterface

public DeviceInterface(long deviceID,
                       int ifIndex,
                       java.lang.String ifDescr,
                       long ifSpeed,
                       int ifOperStatus,
                       boolean monitored,
                       boolean removed)
Create a full DeviceInterface object. Use this constructor to create an DeviceInterface when all the data is available.

Parameters:
ifIndex - index of the DeviceInterface within the Device.
ifDescr - name of the DeviceInterface.
ifSpeed - port speed of the interface (e.g., 10000 for 10Mbit)
ifOperStatus - current status of the interface (up/down/testing)
monitored - monitoring state of the Interface
removed - availability of the Interface

DeviceInterface

public DeviceInterface(java.sql.Connection dbConn,
                       long deviceID,
                       int ifIndex)
                throws java.sql.SQLException
Query the database and create a DeviceInterface from the query results.

Parameters:
dbConn - Connection to the database
deviceID - long value of the Device's DB record ID
ifIndex - index of the DeviceInterface within the Device

DeviceInterface

public DeviceInterface(java.sql.ResultSet sqlResults)
                throws java.sql.SQLException
Create a DeviceInterface from a database query result set.

Parameters:
sqlResults - single result set from a database query of the Interface table
Method Detail

dbInsertInterface

public boolean dbInsertInterface(java.sql.Connection dbConn)
Add a new Interface to the database.

Returns:
Boolean indicating if the Interface was added

dbUpdateInterface

public boolean dbUpdateInterface(java.sql.Connection dbConn)
Update detail fields in a DeviceInterface record in the database. This method does not allow the update of the deviceID or ifIndex. These fields are the primary key of the Interface and cannot be changed.

Parameters:
dbConn - Connection to the database
Returns:
Boolean indicating if the record update succeeded

toString

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

Returns:
String containing the DeviceInterface information nicely formatted

setDeviceID

public void setDeviceID(long deviceID)
Setters


setIfIndex

public void setIfIndex(int ifIndex)

setIfDescr

public void setIfDescr(java.lang.String ifDescr)

setIfSpeed

public void setIfSpeed(long ifSpeed)

setIfOperStatus

public void setIfOperStatus(int ifOperStatus)

setMonitored

public void setMonitored(boolean monitored)

setRemoved

public void setRemoved(boolean removed)

getDeviceID

public long getDeviceID()
Getters


getIfIndex

public int getIfIndex()

getIfDescr

public java.lang.String getIfDescr()

getIfSpeed

public long getIfSpeed()

getIfOperStatus

public int getIfOperStatus()

isMonitored

public boolean isMonitored()

isRemoved

public boolean isRemoved()