devices
Class Attribute

java.lang.Object
  extended bydevices.Attribute

public class Attribute
extends java.lang.Object

Attributes are the actual data elements of interest on an interface. Some attributes are static and known (e.g., syntax). Others track the dynamic aspects of the interface (e.g., I/O). This class holds the information about a dynamic attribute. That attribute will be polled at certain intervals to retrieve the attribute's value.

Version:
0.1
Author:
ryan/gswalters

Field Summary
static java.lang.String IF_IN_ERRORS
           
static java.lang.String IF_IN_OCTETS
           
static java.lang.String IF_OUT_ERRORS
           
static java.lang.String IF_OUT_OCTETS
           
 
Constructor Summary
Attribute(java.sql.Connection dbConn, long deviceID, int ifIndex, int oid)
          Query the database and create a Device from the query results.
Attribute(long deviceID, int ifIndex, int oid, java.lang.String oidName, int pollFrequency, int maxPollLimit, int minThreshold, int maxThreshold, boolean monitored, boolean removed)
          Create a full Attribute object.
Attribute(java.sql.ResultSet sqlResults)
          Create an Attribute from a database query result set.
 
Method Summary
 boolean dbInsertAttribute(java.sql.Connection dbConn)
          Insert a new Attribute into the database.
 boolean dbUpdateAttribute(java.sql.Connection dbConn)
          Update detail fields in an Attribute record in the database.
 long getDeviceID()
          Getters
 int getIfIndex()
           
 int getMaxPollLimit()
           
 int getMaxThreshold()
           
 int getMinThreshold()
           
 int getOid()
           
 java.lang.String getOidName()
           
 int getPollFrequency()
           
 boolean isMonitored()
           
 boolean isRemoved()
           
 void setDeviceID(long deviceID)
          Setters
 void setIfIndex(int ifIndex)
           
 void setMaxPollLimit(int maxPollLimit)
           
 void setMaxThreshold(int maximumThreshold)
           
 void setMinThreshold(int minimumThreshold)
           
 void setMonitored(boolean monitored)
           
 void setOid(int oid)
           
 void setOidName(java.lang.String oidName)
           
 void setPollFrequency(int pollFrequency)
           
 void setPollInfo(int frequency, int limit)
          Set the Attribute's polling vlaues.
 void setRemoved(boolean removed)
           
 void setThresholds(int min, int max)
           
 java.lang.String toString()
          Convert the Attribute object into a printable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IF_IN_OCTETS

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

IF_IN_ERRORS

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

IF_OUT_OCTETS

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

IF_OUT_ERRORS

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

Attribute

public Attribute(long deviceID,
                 int ifIndex,
                 int oid,
                 java.lang.String oidName,
                 int pollFrequency,
                 int maxPollLimit,
                 int minThreshold,
                 int maxThreshold,
                 boolean monitored,
                 boolean removed)
Create a full Attribute object. Use this constructor to create an Attribute object when all data is available.

Parameters:
deviceID - long value of the Device's DB record ID
ifIndex - index of the DeviceInterface within the Device
oid - unique part of the OID for each attribute
pollFrequency - how often to poll in seconds
maxPollLimit -
minThreshold -
maxThreshold -
monitored - monitoring state of the Attribute
removed - availability of the Attribute

Attribute

public Attribute(java.sql.Connection dbConn,
                 long deviceID,
                 int ifIndex,
                 int oid)
          throws java.sql.SQLException
Query the database and create a Device 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
oid - unique part of the OID for each attribute

Attribute

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

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

dbInsertAttribute

public boolean dbInsertAttribute(java.sql.Connection dbConn)
Insert a new Attribute into the database.

Returns:
Boolean indicating if the Attribute was added

dbUpdateAttribute

public boolean dbUpdateAttribute(java.sql.Connection dbConn)
Update detail fields in an Attribute record in the database. This method does not allow the update of the deviceID, ifIndex, or OID. These fields are the primary key of the Attribute 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 Attribute object into a printable String.

Returns:
String containing the Attribute information nicely formatted

setDeviceID

public void setDeviceID(long deviceID)
Setters


setIfIndex

public void setIfIndex(int ifIndex)

setOid

public void setOid(int oid)

setOidName

public void setOidName(java.lang.String oidName)

setPollFrequency

public void setPollFrequency(int pollFrequency)

setMaxPollLimit

public void setMaxPollLimit(int maxPollLimit)

setMinThreshold

public void setMinThreshold(int minimumThreshold)

setMaxThreshold

public void setMaxThreshold(int maximumThreshold)

setMonitored

public void setMonitored(boolean monitored)

setRemoved

public void setRemoved(boolean removed)

getDeviceID

public long getDeviceID()
Getters


getIfIndex

public int getIfIndex()

getOid

public int getOid()

getOidName

public java.lang.String getOidName()

getPollFrequency

public int getPollFrequency()

getMinThreshold

public int getMinThreshold()

getMaxPollLimit

public int getMaxPollLimit()

getMaxThreshold

public int getMaxThreshold()

isMonitored

public boolean isMonitored()

isRemoved

public boolean isRemoved()

setPollInfo

public void setPollInfo(int frequency,
                        int limit)
Set the Attribute's polling vlaues.

Parameters:
frequency -
limit -

setThresholds

public void setThresholds(int min,
                          int max)