com.adventnet.snmp.ui
Class TrapViewer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.adventnet.snmp.ui.TrapViewer

public class TrapViewer
extends javax.swing.JPanel
implements TrapParserListener, java.awt.event.ActionListener, TrapListener

This class receives, filters and displays the received traps. Set the port number to listen for traps on the specified port. Also set the parser file name to filter the incoming traps. If the parser file is not specified, default parser file will be created to allow all the traps received on the port.

See Also:
Serialized Form

Inner Class Summary
(package private)  class TrapViewer.CommunityListener
           
(package private)  class TrapViewer.LogItemListener
           
(package private)  class TrapViewer.V3TrapListener
           
 
Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardBinding, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  javax.swing.JButton add
           
(package private)  java.applet.Applet applet
           
(package private)  javax.swing.JCheckBox authComm
           
(package private)  javax.swing.JCheckBox authV3
           
(package private)  javax.swing.JButton closeButton
           
(package private)  boolean commauth
           
(package private)  javax.swing.JTextField commText
           
(package private)  javax.swing.JButton delete
           
(package private)  javax.swing.JButton deleteTrap
           
(package private)  DebugInterface di
           
(package private)  java.lang.String encStr
           
(package private)  SasFileDialog fileSasDialog
           
(package private)  int informcounter
           
(package private)  java.awt.Font lfont
           
(package private)  com.adventnet.utils.LedPanel linkStatus
           
(package private)  javax.swing.JButton load
           
(package private)  MibOperations mibOps
           
(package private)  javax.swing.JDialog parserFrame
           
(package private)  javax.swing.JTextField parserText
           
(package private)  javax.swing.JTextField portText
           
(package private)  javax.swing.JButton settings
           
(package private)  javax.swing.JButton start
           
(package private)  com.adventnet.utils.StatusPanel statusPanel
           
(package private)  javax.swing.JButton stop
           
(package private)  int trapcounter
           
(package private)  javax.swing.JButton trapDetails
           
(package private)  TrapParserBean trapparserbean
           
(package private)  TrapParserCustomizer trapparsercustomizer
           
(package private)  TrapTasks trapReceiver
           
(package private)  boolean v3auth
           
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
component, containerListener, layoutMgr, ncomponents
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
TrapViewer()
          Constructor for applications
TrapViewer(java.applet.Applet applet)
          Constructor for applets
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
(package private)  java.lang.String dateToStr(java.util.Date dt)
           
 void eventParsed(ParsedTrapEvent e)
          this should be implemented for TrapParserListener.The TrapBrowser gets ParsedTrapEvent and dispalyes it in TrapBrowser Table.
protected  void finalize()
          this cleans up if no one using
 java.lang.String getAuthPassword()
          get AuthPassword
 int getAuthProtocol()
          get AuthProtocol
 java.lang.String getCharacterEncoding()
          Get the Character Encoding being used.
 java.lang.String getCommunity()
          get the community string
 java.lang.String getContextID()
          get the SNMP V3 contextID
 java.lang.String getContextName()
          get the SNMP V3 Context name
(package private)  DebugInterface getDebugInterface()
           
 java.lang.String getFileName()
          get the loaded parser file
 java.lang.String[] getLocalAddresses()
          get the local addresses
 java.lang.String getMibModules()
          get the loaded mibs
 int getPort()
          get the listening SNMP port number
 java.lang.String getPrincipal()
          get Principal ie userName
 java.lang.String getPrivPassword()
          get PrivPassword
 int getSnmpVersion()
          get the SNMP Version
 void receivedTrap(TrapEvent e)
          this should be implemented for TrapListener.The TrapParserBean gets trapEvent and parses it and generates ParsedTrapEvent if it matches the Match Criteria in Trap parser file.
 void setAuthPassword(java.lang.String password)
          set AuthPassword
 void setAuthProtocol(int protocol)
          set AuthProtocol
 void setCharacterEncoding(java.lang.String enc)
          Set the Character Encoding to be used.
 void setCommunity(java.lang.String community)
          set the community string
 void setContextID(byte[] ctxtID)
          set the SNMP V3 contextID
 void setContextName(java.lang.String cName)
          set the SNMP V3 Context name
(package private)  void setDebugInterface(DebugInterface deb)
           
 void setFileName(java.lang.String fileName)
          set the parser file to be parsed.
 void setLocalAddresses(java.lang.String[] addresses)
          set the local addresses to listen on
 void setMibModules(java.lang.String mibs)
          set the mibs to be loaded
(package private)  void setMibOperations(MibOperations mib)
          set MibOperations
 void setPort(int port)
          set the local SNMP port number to listen on.
 void setPrincipal(java.lang.String userName)
          set Principal ie userName
 void setPrivPassword(java.lang.String password)
          set PrivPassword
 void setSnmpVersion(int version)
          set the SNMP Version
 void setTrapAuthEnable(boolean isAuth)
          Specify whether traps should be authenticated while receiving SNMPV3 trap messages.
 void stop()
          Stops all the TrapReceivers listening for traps.
(package private)  void updateStatusPanel()
           
 
Methods inherited from class javax.swing.JPanel
, getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, alwaysOnTop, bindingForKeyStroke, checkIfChildObscuredBySibling, computeVisibleRect, computeVisibleRect, contains, createToolTip, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getCursorTarget, getLayout, getMouseEventTarget, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, nextFocus, paintComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setCursor, setFocusOwner, setLayout, transferFocus, updateCursor, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, constructComponentName, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocale, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

v3auth

boolean v3auth

commauth

boolean commauth

di

DebugInterface di

mibOps

MibOperations mibOps

applet

java.applet.Applet applet

linkStatus

com.adventnet.utils.LedPanel linkStatus

statusPanel

com.adventnet.utils.StatusPanel statusPanel

settings

javax.swing.JButton settings

start

javax.swing.JButton start

stop

javax.swing.JButton stop

trapDetails

javax.swing.JButton trapDetails

deleteTrap

javax.swing.JButton deleteTrap

add

javax.swing.JButton add

delete

javax.swing.JButton delete

load

javax.swing.JButton load

authV3

javax.swing.JCheckBox authV3

authComm

javax.swing.JCheckBox authComm

portText

javax.swing.JTextField portText

commText

javax.swing.JTextField commText

parserText

javax.swing.JTextField parserText

lfont

java.awt.Font lfont

trapcounter

int trapcounter

informcounter

int informcounter

encStr

java.lang.String encStr

trapparserbean

TrapParserBean trapparserbean

trapparsercustomizer

TrapParserCustomizer trapparsercustomizer

trapReceiver

TrapTasks trapReceiver

fileSasDialog

SasFileDialog fileSasDialog

parserFrame

javax.swing.JDialog parserFrame

closeButton

javax.swing.JButton closeButton
Constructor Detail

TrapViewer

public TrapViewer()
Constructor for applications

TrapViewer

public TrapViewer(java.applet.Applet applet)
Constructor for applets
Method Detail

getSnmpVersion

public int getSnmpVersion()
get the SNMP Version

setSnmpVersion

public void setSnmpVersion(int version)
set the SNMP Version

getLocalAddresses

public java.lang.String[] getLocalAddresses()
get the local addresses

setDebugInterface

void setDebugInterface(DebugInterface deb)

getDebugInterface

DebugInterface getDebugInterface()

setLocalAddresses

public void setLocalAddresses(java.lang.String[] addresses)
set the local addresses to listen on

setPort

public void setPort(int port)
             throws SnmpException
set the local SNMP port number to listen on. It is set in the trap field.
Throws:
java.lang.Throwable - if the port set is <= 0

getPort

public int getPort()
get the listening SNMP port number

setCommunity

public void setCommunity(java.lang.String community)
set the community string

getCommunity

public java.lang.String getCommunity()
get the community string

setCharacterEncoding

public void setCharacterEncoding(java.lang.String enc)
Set the Character Encoding to be used. The encoding specified will be used internally to convert String <--> byte[]. The Default value is ISO8859_1.
Parameters:
enc - The name of a character encoding. All the string encoding will be done base on this encoding.

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Get the Character Encoding being used. This encoding scheme will be used internally to convert String <--> byte[]. The Default value is ISO8859_1.
Returns:
enc The character encoding used.

getContextName

public java.lang.String getContextName()
get the SNMP V3 Context name

setContextName

public void setContextName(java.lang.String cName)
set the SNMP V3 Context name

getContextID

public java.lang.String getContextID()
get the SNMP V3 contextID

setContextID

public void setContextID(byte[] ctxtID)
set the SNMP V3 contextID

getPrincipal

public java.lang.String getPrincipal()
get Principal ie userName

setPrincipal

public void setPrincipal(java.lang.String userName)
set Principal ie userName

getAuthProtocol

public int getAuthProtocol()
get AuthProtocol

setAuthProtocol

public void setAuthProtocol(int protocol)
set AuthProtocol

getAuthPassword

public java.lang.String getAuthPassword()
get AuthPassword

setAuthPassword

public void setAuthPassword(java.lang.String password)
set AuthPassword

getPrivPassword

public java.lang.String getPrivPassword()
get PrivPassword

setPrivPassword

public void setPrivPassword(java.lang.String password)
set PrivPassword

setMibModules

public void setMibModules(java.lang.String mibs)
set the mibs to be loaded

getMibModules

public java.lang.String getMibModules()
get the loaded mibs

setFileName

public void setFileName(java.lang.String fileName)
set the parser file to be parsed. It should be .parser file

getFileName

public java.lang.String getFileName()
get the loaded parser file

receivedTrap

public void receivedTrap(TrapEvent e)
this should be implemented for TrapListener.The TrapParserBean gets trapEvent and parses it and generates ParsedTrapEvent if it matches the Match Criteria in Trap parser file.
Specified by:
receivedTrap in interface TrapListener

dateToStr

java.lang.String dateToStr(java.util.Date dt)

eventParsed

public void eventParsed(ParsedTrapEvent e)
this should be implemented for TrapParserListener.The TrapBrowser gets ParsedTrapEvent and dispalyes it in TrapBrowser Table.
Specified by:
eventParsed in interface TrapParserListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

stop

public void stop()
Stops all the TrapReceivers listening for traps.

finalize

protected void finalize()
                 throws java.lang.Throwable
this cleans up if no one using
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - in case of finalization errors

setMibOperations

void setMibOperations(MibOperations mib)
set MibOperations

setTrapAuthEnable

public void setTrapAuthEnable(boolean isAuth)
Specify whether traps should be authenticated while receiving SNMPV3 trap messages. Default value is false.
Parameters:
isAuth - Set this to true if traps should be authenticated while receiving SNMPV3 trap messages. False otherwise.

updateStatusPanel

void updateStatusPanel()