backend
Class backEnd

java.lang.Object
  extended byjava.lang.Thread
      extended bybackend.backEnd
All Implemented Interfaces:
Runnable, snmp.SNMPTrapListener

public class backEnd
extends Thread
implements snmp.SNMPTrapListener

This class is the backend thread that spawns upto 15 ping thereads and 15 snmp threads. It controls the time interval inbetween each snmp and ping interval. It also has built in SNMP functions that allow for retervial of a remotes computers information and the ability to set specific information as well.


Field Summary
static boolean pauseFlag
          a boolean that if set to false will do continous monitoring and if true it will pause the monitoring
static boolean stopFlag
          A boolean if true means pinging and snmp calls should stop false means pinging and snmp calls should continue
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
backEnd()
          this second constructor is needed for the mibBrowser
backEnd(BlackBoard fromMain)
          Constructor which enables the interfaces to the blackbaord
 
Method Summary
 void processTrap(snmp.SNMPTrapPDU pdu)
          function that handles all the SNMP traps recived
 void run()
          This is where thread execution starts
static String snmpGet(String OID, String ipAddress, String community)
          The simple version of snmpGet which just returns the value of the snmp calls
static String snmpGetExtended(String OID, String ipAddress, String community)
          Get extended information about the snmp OID.
static Vector snmpGetNext(String OID, String ipAddress, String community)
          GET NEXT OID...
static String snmpGetTable(String OID, String ipAddress, String community)
          Used to get a SNMP table
 boolean snmpHasAgent(String ip)
           
static boolean snmpHasAgent(String ip, String community)
          This function is used to check if a specific computer has SNMP installed or not
static boolean snmpSet(String value, String OID, String host, String community)
          A function that used to set SNMP values given the OID to set
 void updateAllNodes()
          This it the main backend loop which continously monitors the computers using ping and snmp calls
 void updateNode(LanNode currentNode)
          This function updates the current node being passed in.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stopFlag

public static boolean stopFlag
A boolean if true means pinging and snmp calls should stop false means pinging and snmp calls should continue


pauseFlag

public static boolean pauseFlag
a boolean that if set to false will do continous monitoring and if true it will pause the monitoring

Constructor Detail

backEnd

public backEnd(BlackBoard fromMain)
Constructor which enables the interfaces to the blackbaord

Parameters:
fromMain - Expects the blackboard class which was created in main

backEnd

public backEnd()
this second constructor is needed for the mibBrowser

Method Detail

run

public void run()
This is where thread execution starts

Specified by:
run in interface Runnable

updateAllNodes

public void updateAllNodes()
This it the main backend loop which continously monitors the computers using ping and snmp calls


snmpGet

public static String snmpGet(String OID,
                             String ipAddress,
                             String community)
The simple version of snmpGet which just returns the value of the snmp calls

Parameters:
OID - A string containing a valid OID number
ipAddress - String containing a valid ip address or hostname
Returns:
returns the value of the OID from the specified ip address

snmpSet

public static boolean snmpSet(String value,
                              String OID,
                              String host,
                              String community)
A function that used to set SNMP values given the OID to set

Parameters:
value - This is the value that is going to be set
OID - OID in string format
host - Contains the ip address or host name of the computer to set the value to.
Returns:
true if the set was sucessful false otherwise

snmpHasAgent

public boolean snmpHasAgent(String ip)

snmpHasAgent

public static boolean snmpHasAgent(String ip,
                                   String community)
This function is used to check if a specific computer has SNMP installed or not

Parameters:
ip - String containing either the hostname or ipaddress
Returns:
returns true if the ip address has snmp and returns false if it does not

snmpGetExtended

public static String snmpGetExtended(String OID,
                                     String ipAddress,
                                     String community)
Get extended information about the snmp OID. More verbose then snmpGet function

Parameters:
OID - String containing the OID value
ipAddress - String containing either the ip address or host name
Returns:
returns the extended string value of the OID

snmpGetNext

public static Vector snmpGetNext(String OID,
                                 String ipAddress,
                                 String community)
GET NEXT OID... PAUL I ADDED THIS METHOD BELOW... feel free to play around with it.. its the same as above except it makes a call to .getNextMIBEntry instead... so next OID in tree This is also the method i call from the mibBrowser to getAll OID's in tree... so pretty important ;)


snmpGetTable

public static String snmpGetTable(String OID,
                                  String ipAddress,
                                  String community)
Used to get a SNMP table

Parameters:
OID - String value containing the OID
ipAddress - String address containing either an ip address or hostname
Returns:
returns a string which contains a table of all of the OID values

processTrap

public void processTrap(snmp.SNMPTrapPDU pdu)
function that handles all the SNMP traps recived

Specified by:
processTrap in interface snmp.SNMPTrapListener
Parameters:
pdu - interface of information about the trap that came in

updateNode

public void updateNode(LanNode currentNode)
This function updates the current node being passed in. It does a ping update and a snmp update

Parameters:
currentNode - LanNode containing the node to be updated