Java Doc for BaseAgent.java in  » Net » snmp4j » org » snmp4j » agent » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » snmp4j » org.snmp4j.agent 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.snmp4j.agent.BaseAgent

All known Subclasses:   org.snmp4j.agent.test.TestAgent,  org.snmp4j.agent.mo.jmx.example.JMXTestAgent,  org.snmp4j.agent.agentx.master.AgentXMasterAgent,
BaseAgent
abstract public class BaseAgent implements Runnable,MOPersistenceProvider(Code)
The BaseAgent abstract class defines a framework for writing SNMP agents using the SNMP4J-Agent API. To implement your own SNMP agent, extend this class and implement the abstract methods defined by BaseAgent. The hook methods do not need any specific implementation. They only provide a defined mechanism to customize your agent.
author:
   Frank Fock
version:
   1.0


Field Summary
final public static  intSTATE_CREATED
    
final public static  intSTATE_INIT_FINISHED
    
final public static  intSTATE_INIT_STARTED
    
final public static  intSTATE_RUNNING
    
final public static  intSTATE_STOPPED
    
protected  CommandProcessoragent
    
protected  intagentState
    
protected  FilebootCounterFile
    
protected  FileconfigFile
    
protected  OctetStringdefaultContext
    
protected  ProxyForwarderdefaultProxyForwarder
    
protected  MessageDispatcherImpldispatcher
    
protected  MPv3mpv3
    
protected  NotificationOriginatornotificationOriginator
    
protected  DefaultMOServerserver
    
protected  Snmpsession
    
protected  Snmp4jConfigMibsnmp4jConfigMIB
    
protected  Snmp4jLogMibsnmp4jLogMIB
    
protected  SnmpCommunityMIBsnmpCommunityMIB
    
protected  SnmpFrameworkMIBsnmpFrameworkMIB
    
protected  SnmpNotificationMIBsnmpNotificationMIB
    
protected  SnmpProxyMIBsnmpProxyMIB
    
protected  SnmpTargetMIBsnmpTargetMIB
    
protected  SNMPv2MIBsnmpv2MIB
    
protected  OctetStringsysDescr
    
protected  OIDsysOID
    
protected  Integer32sysServices
    
protected  TransportMapping[]transportMappings
    
protected  USMusm
    
protected  UsmMIBusmMIB
    
protected  VacmMIBvacmMIB
    

Constructor Summary
protected  BaseAgent()
     Creates a base agent with a DefaultMOServer as MOServer .
protected  BaseAgent(File bootCounterFile, File configFile, CommandProcessor commandProcessor)
     Creates a base agent with boot-counter, config file, and a CommandProcessor for processing SNMP requests.
Parameters:
  bootCounterFile - a file with serialized boot-counter information (read/write).

Method Summary
abstract protected  voidaddCommunities(SnmpCommunityMIB communityMIB)
     Adds community to security name mappings needed for SNMPv1 and SNMPv2c.
abstract protected  voidaddNotificationTargets(SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB)
     Adds initial notification targets and filters.
protected  voidaddShutdownHook()
     Adds a shutdown hook that saves the internal config into the config file when a SIGTERM (Ctrl-C) is terminating the agent.
abstract protected  voidaddUsmUser(USM usm)
     Adds all the necessary initial users to the USM.
abstract protected  voidaddViews(VacmMIB vacmMIB)
     Adds initial VACM configuration.
protected  voidfinishInit()
     Finishes intialization of the agent by connecting server and command processor, setting up USM, VACM, notification targets, and finally sending a coldStart notification to configured targets.
public  CommandProcessorgetAgent()
    
public  intgetAgentState()
     Returns the agent's state.
public  FilegetBootCounterFile()
    
public  FilegetConfigFile()
    
protected  OctetStringgetContext(MOGroup mibGroup)
     This method can be overwritten by a subagent to specify the contexts each MIB module (group) will be registered to.
public  OctetStringgetDefaultContext()
     Returns the default context - which is the context that is used by the base agent to register its MIB objects.
public  ProxyForwardergetDefaultProxyForwarder()
    
protected  intgetEngineBoots()
     Reads the engine boots counter from the corresponding input stream (file).
public  MPv3getMPv3()
    
public  NotificationOriginatorgetNotificationOriginator()
    
public  DefaultMOServergetServer()
    
public  SnmpgetSession()
    
public  Snmp4jConfigMibgetSnmp4jConfigMIB()
    
public  Snmp4jLogMibgetSnmp4jLogMIB()
    
public  SnmpCommunityMIBgetSnmpCommunityMIB()
    
public  SnmpFrameworkMIBgetSnmpFrameworkMIB()
    
public  SnmpNotificationMIBgetSnmpNotificationMIB()
    
public  SnmpProxyMIBgetSnmpProxyMIB()
    
public  SnmpTargetMIBgetSnmpTargetMIB()
    
public  SNMPv2MIBgetSnmpv2MIB()
    
public  OctetStringgetSysDescr()
    
public  OIDgetSysOID()
    
public  Integer32getSysServices()
    
public  USMgetUsm()
    
public  UsmMIBgetUsmMIB()
    
public  VacmMIBgetVacmMIB()
    
public  voidinit()
     Initialize transport mappings, message dispatcher, basic MIB modules, proxy forwarder, VACM and USM security, and custom MIB modules and objects provided by sub-classes.
protected  voidinitMessageDispatcher()
     Initializes the message dispatcher ( MessageDispatcherImpl ) with the transport mappings.
protected  voidinitSnmpSession()
    
protected  voidinitTransportMappings()
     Initializes the transport mappings (ports) to be used by the agent.
public  voidloadConfig(int importMode)
     Loads the configuration using the specified import mode from the set config file.
public  voidloadConfig(InputStream configFile, int importMode)
     Loads the configuration using the specified import mode from the set config file.
abstract protected  voidregisterManagedObjects()
     Register additional managed objects at the agent's server.
protected  voidregisterSnmpMIBs()
     Register the basic MIB modules at the agent's MOServer.
public  voidrun()
     Starts the agent by let it listen on the configured SNMP agent ports (transpot mappings).
public  voidsaveConfig()
     Save the current (serializable) managed object configuration into the config file.
public  voidsaveConfig(OutputStream configFile)
     Saves the current (serializable) managed object configuration into the specified config file (output stream).
protected  voidsendColdStartNotification()
    
public  voidsetAgent(CommandProcessor agent)
    
public  voidsetBootCounterFile(File bootCounterFile)
    
public  voidsetConfigFile(File configFile)
    
public  voidsetDefaultContext(OctetString defaultContext)
     Sets the default context for this base agent.
public  voidsetDefaultProxyForwarder(ProxyForwarder defaultProxyForwarder)
    
protected  voidsetEngineBoots(int engineBoots)
    
public  voidsetSysDescr(OctetString sysDescr)
    
public  voidsetSysOID(OID sysOID)
    
public  voidsetSysServices(Integer32 sysServices)
    
protected  voidsetupDefaultProxyForwarder()
     Creates and registers the default proxy forwarder application ( ProxyForwarderImpl ).
public  voidstop()
     Stops the agent by closing the SNMP session and associated transport mappings.
abstract protected  voidunregisterManagedObjects()
     Unregister additional managed objects from the agent's server.
protected  voidunregisterSnmpMIBs()
     Unregister the basic MIB modules from the agent's MOServer.
protected  intupdateEngineBoots()
     Updates the engine boots counter and returns the actual value.

Field Detail
STATE_CREATED
final public static int STATE_CREATED(Code)



STATE_INIT_FINISHED
final public static int STATE_INIT_FINISHED(Code)



STATE_INIT_STARTED
final public static int STATE_INIT_STARTED(Code)



STATE_RUNNING
final public static int STATE_RUNNING(Code)



STATE_STOPPED
final public static int STATE_STOPPED(Code)



agent
protected CommandProcessor agent(Code)



agentState
protected int agentState(Code)



bootCounterFile
protected File bootCounterFile(Code)



configFile
protected File configFile(Code)



defaultContext
protected OctetString defaultContext(Code)



defaultProxyForwarder
protected ProxyForwarder defaultProxyForwarder(Code)



dispatcher
protected MessageDispatcherImpl dispatcher(Code)



mpv3
protected MPv3 mpv3(Code)



notificationOriginator
protected NotificationOriginator notificationOriginator(Code)



server
protected DefaultMOServer server(Code)



session
protected Snmp session(Code)



snmp4jConfigMIB
protected Snmp4jConfigMib snmp4jConfigMIB(Code)



snmp4jLogMIB
protected Snmp4jLogMib snmp4jLogMIB(Code)



snmpCommunityMIB
protected SnmpCommunityMIB snmpCommunityMIB(Code)



snmpFrameworkMIB
protected SnmpFrameworkMIB snmpFrameworkMIB(Code)



snmpNotificationMIB
protected SnmpNotificationMIB snmpNotificationMIB(Code)



snmpProxyMIB
protected SnmpProxyMIB snmpProxyMIB(Code)



snmpTargetMIB
protected SnmpTargetMIB snmpTargetMIB(Code)



snmpv2MIB
protected SNMPv2MIB snmpv2MIB(Code)



sysDescr
protected OctetString sysDescr(Code)



sysOID
protected OID sysOID(Code)



sysServices
protected Integer32 sysServices(Code)



transportMappings
protected TransportMapping[] transportMappings(Code)



usm
protected USM usm(Code)



usmMIB
protected UsmMIB usmMIB(Code)



vacmMIB
protected VacmMIB vacmMIB(Code)




Constructor Detail
BaseAgent
protected BaseAgent()(Code)
Creates a base agent with a DefaultMOServer as MOServer . To use a different server implementation, modify the BaseAgent.server member after construction.



BaseAgent
protected BaseAgent(File bootCounterFile, File configFile, CommandProcessor commandProcessor)(Code)
Creates a base agent with boot-counter, config file, and a CommandProcessor for processing SNMP requests.
Parameters:
  bootCounterFile - a file with serialized boot-counter information (read/write). If thefile does not exist it is created on shutdown of the agent.
Parameters:
  configFile - a file with serialized configuration information (read/write). If thefile does not exist it is created on shutdown of the agent.
Parameters:
  commandProcessor - the CommandProcessor instance that handles the SNMPrequests.




Method Detail
addCommunities
abstract protected void addCommunities(SnmpCommunityMIB communityMIB)(Code)
Adds community to security name mappings needed for SNMPv1 and SNMPv2c.
Parameters:
  communityMIB - the SnmpCommunityMIB holding coexistence configuration for communitybased security models.



addNotificationTargets
abstract protected void addNotificationTargets(SnmpTargetMIB targetMIB, SnmpNotificationMIB notificationMIB)(Code)
Adds initial notification targets and filters.
Parameters:
  targetMIB - the SnmpTargetMIB holding the target configuration.
Parameters:
  notificationMIB - the SnmpNotificationMIB holding the notification (filter)configuration.



addShutdownHook
protected void addShutdownHook()(Code)
Adds a shutdown hook that saves the internal config into the config file when a SIGTERM (Ctrl-C) is terminating the agent.



addUsmUser
abstract protected void addUsmUser(USM usm)(Code)
Adds all the necessary initial users to the USM.
Parameters:
  usm - the USM instance used by this agent.



addViews
abstract protected void addViews(VacmMIB vacmMIB)(Code)
Adds initial VACM configuration.
Parameters:
  vacmMIB - the VacmMIB holding the agent's view configuration.



finishInit
protected void finishInit()(Code)
Finishes intialization of the agent by connecting server and command processor, setting up USM, VACM, notification targets, and finally sending a coldStart notification to configured targets.



getAgent
public CommandProcessor getAgent()(Code)



getAgentState
public int getAgentState()(Code)
Returns the agent's state. one of the state's starting from BaseAgent.STATE_CREATED toBaseAgent.STATE_RUNNING.
since:
   1.1



getBootCounterFile
public File getBootCounterFile()(Code)



getConfigFile
public File getConfigFile()(Code)



getContext
protected OctetString getContext(MOGroup mibGroup)(Code)
This method can be overwritten by a subagent to specify the contexts each MIB module (group) will be registered to.
Parameters:
  mibGroup - a group of ManagedObjects (i.e., a MIB module).the context for which the module should be registered.
since:
   1.1



getDefaultContext
public OctetString getDefaultContext()(Code)
Returns the default context - which is the context that is used by the base agent to register its MIB objects. By default it is null which causes the objects to be registered virtually for all contexts. In that case, subagents for example my not register their own objects under the same subtree(s) in any context. To allow subagents to register their own instances of those MIB modules, an empty OctetString should be used as default context instead. null or an OctetString (normally the emptystring) denoting the context used for registering default MIBs.
since:
   1.1



getDefaultProxyForwarder
public ProxyForwarder getDefaultProxyForwarder()(Code)



getEngineBoots
protected int getEngineBoots()(Code)
Reads the engine boots counter from the corresponding input stream (file). the boots counter value read or zero if it could not be read.



getMPv3
public MPv3 getMPv3()(Code)



getNotificationOriginator
public NotificationOriginator getNotificationOriginator()(Code)



getServer
public DefaultMOServer getServer()(Code)



getSession
public Snmp getSession()(Code)



getSnmp4jConfigMIB
public Snmp4jConfigMib getSnmp4jConfigMIB()(Code)



getSnmp4jLogMIB
public Snmp4jLogMib getSnmp4jLogMIB()(Code)



getSnmpCommunityMIB
public SnmpCommunityMIB getSnmpCommunityMIB()(Code)



getSnmpFrameworkMIB
public SnmpFrameworkMIB getSnmpFrameworkMIB()(Code)



getSnmpNotificationMIB
public SnmpNotificationMIB getSnmpNotificationMIB()(Code)



getSnmpProxyMIB
public SnmpProxyMIB getSnmpProxyMIB()(Code)



getSnmpTargetMIB
public SnmpTargetMIB getSnmpTargetMIB()(Code)



getSnmpv2MIB
public SNMPv2MIB getSnmpv2MIB()(Code)



getSysDescr
public OctetString getSysDescr()(Code)



getSysOID
public OID getSysOID()(Code)



getSysServices
public Integer32 getSysServices()(Code)



getUsm
public USM getUsm()(Code)



getUsmMIB
public UsmMIB getUsmMIB()(Code)



getVacmMIB
public VacmMIB getVacmMIB()(Code)



init
public void init() throws IOException(Code)
Initialize transport mappings, message dispatcher, basic MIB modules, proxy forwarder, VACM and USM security, and custom MIB modules and objects provided by sub-classes.
throws:
  IOException - if initialization fails because transport initialization fails.



initMessageDispatcher
protected void initMessageDispatcher()(Code)
Initializes the message dispatcher ( MessageDispatcherImpl ) with the transport mappings.



initSnmpSession
protected void initSnmpSession()(Code)



initTransportMappings
protected void initTransportMappings() throws IOException(Code)
Initializes the transport mappings (ports) to be used by the agent.
throws:
  IOException -



loadConfig
public void loadConfig(int importMode)(Code)
Loads the configuration using the specified import mode from the set config file.
Parameters:
  importMode - one of the import modes defined by ImportModes.



loadConfig
public void loadConfig(InputStream configFile, int importMode) throws IOException(Code)
Loads the configuration using the specified import mode from the set config file.
Parameters:
  configFile - the config file (input stream) containing the serializedconfiguration data.
Parameters:
  importMode - one of the import modes defined by ImportModes.



registerManagedObjects
abstract protected void registerManagedObjects()(Code)
Register additional managed objects at the agent's server.



registerSnmpMIBs
protected void registerSnmpMIBs()(Code)
Register the basic MIB modules at the agent's MOServer.



run
public void run()(Code)
Starts the agent by let it listen on the configured SNMP agent ports (transpot mappings).



saveConfig
public void saveConfig()(Code)
Save the current (serializable) managed object configuration into the config file.



saveConfig
public void saveConfig(OutputStream configFile) throws IOException(Code)
Saves the current (serializable) managed object configuration into the specified config file (output stream).
Parameters:
  configFile - an OutputStream to hold the serialized MIB data.
throws:
  IOException - if the supplied output stream throws an IOException during writeoperation.



sendColdStartNotification
protected void sendColdStartNotification()(Code)



setAgent
public void setAgent(CommandProcessor agent)(Code)



setBootCounterFile
public void setBootCounterFile(File bootCounterFile)(Code)



setConfigFile
public void setConfigFile(File configFile)(Code)



setDefaultContext
public void setDefaultContext(OctetString defaultContext)(Code)
Sets the default context for this base agent. By setting this value before any MIB modules have been registered at the internal server, the context for which the registration is performed can be changed. The default context is null which causes MIB objects to be virtually registered for all contexts.
Parameters:
  defaultContext - the context for default MIB objects.
since:
   1.1



setDefaultProxyForwarder
public void setDefaultProxyForwarder(ProxyForwarder defaultProxyForwarder)(Code)



setEngineBoots
protected void setEngineBoots(int engineBoots)(Code)



setSysDescr
public void setSysDescr(OctetString sysDescr)(Code)



setSysOID
public void setSysOID(OID sysOID)(Code)



setSysServices
public void setSysServices(Integer32 sysServices)(Code)



setupDefaultProxyForwarder
protected void setupDefaultProxyForwarder()(Code)
Creates and registers the default proxy forwarder application ( ProxyForwarderImpl ).



stop
public void stop()(Code)
Stops the agent by closing the SNMP session and associated transport mappings.
since:
   1.1



unregisterManagedObjects
abstract protected void unregisterManagedObjects()(Code)
Unregister additional managed objects from the agent's server.



unregisterSnmpMIBs
protected void unregisterSnmpMIBs()(Code)
Unregister the basic MIB modules from the agent's MOServer.



updateEngineBoots
protected int updateEngineBoots()(Code)
Updates the engine boots counter and returns the actual value. the actual boots counter value.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.