com.adventnet.snmp.ui
Class TrapViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.adventnet.snmp.ui.TrapViewer
All Implemented Interfaces:
TrapListener, TrapParserListener, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

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

Nested Class Summary
(package private)  class TrapViewer.CommunityListener
           
(package private)  class TrapViewer.LogItemListener
           
(package private)  class TrapViewer.V3TrapListener
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
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)  com.adventnet.snmp.ui.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)  com.adventnet.snmp.ui.TrapParserCustomizer trapparsercustomizer
           
(package private)  TrapTasks trapReceiver
           
(package private)  boolean v3auth
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
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, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
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

com.adventnet.snmp.ui.TrapParserCustomizer trapparsercustomizer

trapReceiver

TrapTasks trapReceiver

fileSasDialog

com.adventnet.snmp.ui.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
SnmpException

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()