|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.snmp4j.agent.AgentConfigManager
public class AgentConfigManager
The AgentConfigManager is the main component of a SNMP4J-Agent.
It puts together agent configuration and agent components like command
processor, message dispatcher, managed objects and server, USM, VACM, etc.
| Nested Class Summary | |
|---|---|
class |
AgentConfigManager.AgentState
|
| Constructor Summary | |
|---|---|
AgentConfigManager(org.snmp4j.smi.OctetString agentsOwnEngineID,
org.snmp4j.MessageDispatcher messageDispatcher,
VACM vacm,
MOServer[] moServers,
org.snmp4j.util.WorkerPool workerPool,
MOInputFactory configurationFactory,
MOPersistenceProvider persistenceProvider,
EngineBootsProvider engineBootsProvider)
Creates a SNMP agent configuration which can be run by calling run() later. |
|
| Method Summary | |
|---|---|
void |
configure()
Configures components and managed objects. |
boolean |
continueProcessing()
Continues processing of SNMP requests by coupling message dispatcher and agent. |
protected CommandProcessor |
createCommandProcessor(org.snmp4j.smi.OctetString engineID)
Creates the command processor. |
protected NotificationOriginator |
createNotificationOriginator()
|
protected ProxyForwarder |
createProxyForwarder(CommandProcessor agent)
Creates and registers the default proxy forwarder application ( ProxyForwarderImpl). |
protected org.snmp4j.Session |
createSnmpSession(org.snmp4j.MessageDispatcher dispatcher)
Creates the SNMP session to be used for this agent. |
protected org.snmp4j.security.USM |
createUSM()
Creates the USM used by this agent configuration. |
protected void |
fireLaunchNotifications()
Fire notifications after agent start, i.e. sending a coldStart trap. |
protected org.snmp4j.smi.OctetString |
getContext(MOGroup mibGroup,
org.snmp4j.smi.OctetString defaultContext)
This method can be overwritten by a subagent to specify the contexts each MIB module (group) will be registered to. |
org.snmp4j.smi.OctetString |
getDefaultContext()
Returns the default context - which is the context that is used by the base agent to register its MIB objects. |
NotificationOriginator |
getNotificationOriginator()
Gets the notification originator of this agent configuration. |
protected org.snmp4j.security.SecurityProtocols |
getSupportedSecurityProtocols()
Gets the set of security protocols supported by this agent configuration. |
org.snmp4j.smi.OctetString |
getSysDescr()
Returns the sysDescr.0 value for this agent which can be modified by altering its value. |
org.snmp4j.smi.OID |
getSysOID()
Gets the system OID which can be modified by altering its value. |
org.snmp4j.smi.Integer32 |
getSysServices()
Gets the system services ID which can be modified by altering its value. |
SysUpTime |
getSysUpTime()
Gets the sysUpTime.0 instance for the default context. |
void |
initialize()
|
protected void |
initMandatoryMIBs()
|
protected void |
initMessageDispatcherWithMPs(org.snmp4j.MessageDispatcher mp)
|
protected void |
initOptionalMIBs()
|
protected void |
initSecurityModels(EngineBootsProvider engineBootsProvider)
|
void |
initSnmp4jConfigMIB(MOPersistenceProvider[] persistenceProvider)
|
void |
initSnmp4jLogMIB()
|
protected void |
launch()
Launch the agent by registering and lauching (i.e., set to listen mode) transport mappings. |
protected void |
launchTransportMappings()
|
protected static void |
launchTransportMappings(java.util.Collection transportMappings)
Puts a list of transport mappings into listen mode. |
protected void |
linkCounterListener()
|
protected void |
registerMIBs(org.snmp4j.smi.OctetString context)
Register the initialized MIB modules in the specified context of the agent. |
void |
registerShutdownHook()
Registers a shutdown hook Thread at the Runtime
instance. |
protected void |
registerTransportMappings()
|
boolean |
restoreState()
Restore a previously persistently saved state - if available. |
void |
run()
Initializes, configures, restores agent state, and then launches the SNMP agent depending on its current run state. |
void |
saveState()
Save the state of the agent persistently - if necessary persistent storage is available. |
void |
setNotificationOriginator(NotificationOriginator notificationOriginator)
Sets the notification originator of this agent configuration. |
void |
setupProxyForwarder()
|
void |
shutdown()
Shutdown the agent by closing the internal SNMP session - including the transport mappings provided through the configured MessageDispatcher and then store the agent state to persistent
storage (if available). |
protected static void |
stopTransportMappings(java.util.Collection transportMappings)
Closes a list of transport mappings. |
void |
suspendProcessing()
Suspends processing of SNMP requests. |
protected void |
unregisterMIBs(org.snmp4j.smi.OctetString context)
Unregister the initialized MIB modules from the default context of the agent. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STATE_CREATED
public static final int STATE_INITIALIZED
public static final int STATE_CONFIGURED
public static final int STATE_RESTORED
public static final int STATE_SUSPENDED
public static final int STATE_RUNNING
public static final int STATE_UNSAVED_CHANGES
public static final int STATE_SAVED
public static final int STATE_SHUTDOWN
protected CommandProcessor agent
protected org.snmp4j.util.WorkerPool workerPool
protected VACM vacm
protected org.snmp4j.security.USM usm
protected MOServer[] servers
protected org.snmp4j.Session session
protected org.snmp4j.MessageDispatcher dispatcher
protected org.snmp4j.smi.OctetString engineID
protected ProxyForwarder proxyForwarder
protected NotificationOriginator notificationOriginator
protected MOInputFactory configuration
protected MOPersistenceProvider persistenceProvider
protected int persistenceImportMode
protected EngineBootsProvider engineBootsProvider
protected SNMPv2MIB snmpv2MIB
protected SnmpTargetMIB targetMIB
protected SnmpCommunityMIB communityMIB
protected SnmpNotificationMIB notificationMIB
protected SnmpFrameworkMIB frameworkMIB
protected UsmMIB usmMIB
protected VacmMIB vacmMIB
protected SnmpProxyMIB proxyMIB
protected Snmp4jLogMib snmp4jLogMIB
protected Snmp4jConfigMib snmp4jConfigMIB
protected org.snmp4j.smi.OctetString sysDescr
protected org.snmp4j.smi.OID sysOID
protected org.snmp4j.smi.Integer32 sysServices
protected org.snmp4j.smi.OctetString defaultContext
protected AgentConfigManager.AgentState runState
| Constructor Detail |
|---|
public AgentConfigManager(org.snmp4j.smi.OctetString agentsOwnEngineID,
org.snmp4j.MessageDispatcher messageDispatcher,
VACM vacm,
MOServer[] moServers,
org.snmp4j.util.WorkerPool workerPool,
MOInputFactory configurationFactory,
MOPersistenceProvider persistenceProvider,
EngineBootsProvider engineBootsProvider)
run() later.
agentsOwnEngineID - the authoritative engine ID of the agent.messageDispatcher - the MessageDispatcher to use. The message dispatcher must be configured
outside, i.e. transport mappings have to be added before this
constructor is being called.vacm - a view access control model. Typically, this parameter is set to
null to use the default VACM associated with the
VacmMIB.moServers - the managed object server(s) that server the managed objects available
to this agent.workerPool - the WorkerPool to be used to process incoming request.configurationFactory - a MOInputFactory that creates a MOInput stream
with containing serialized ManagedObject information with the agent's
configuration or null otherwise.persistenceProvider - the primary MOPersistenceProvider to be used to load
and store persistent MOs.engineBootsProvider - the provider of engine boots counter.| Method Detail |
|---|
public void run()
initialize() has not yet been called it will be called before
the agent is being configured in the next step.
See also initialize(), configure(),
restoreState(), and launch().
run in interface java.lang.Runnableprotected void launch()
protected void fireLaunchNotifications()
public boolean continueProcessing()
STATE_SUSPENDED.
true if the running state could be restored,
false otherwise.public void suspendProcessing()
public void shutdown()
MessageDispatcher and then store the agent state to persistent
storage (if available).
public void registerShutdownHook()
Thread at the Runtime
instance.
public void initSnmp4jLogMIB()
public void initSnmp4jConfigMIB(MOPersistenceProvider[] persistenceProvider)
protected void initSecurityModels(EngineBootsProvider engineBootsProvider)
protected void initMessageDispatcherWithMPs(org.snmp4j.MessageDispatcher mp)
protected void registerTransportMappings()
protected void launchTransportMappings()
throws java.io.IOException
java.io.IOException
protected static void launchTransportMappings(java.util.Collection transportMappings)
throws java.io.IOException
transportMappings - a list of TransportMapping instances.
java.io.IOException - if a transport cannot listen to incoming messages.
protected static void stopTransportMappings(java.util.Collection transportMappings)
throws java.io.IOException
transportMappings - a list of TransportMapping instances.
java.io.IOException - if a transport cannot be closed.public void saveState()
public boolean restoreState()
true if the agent state could be restored successfully,
false otherwise.public void configure()
protected void initMandatoryMIBs()
protected void linkCounterListener()
protected org.snmp4j.security.SecurityProtocols getSupportedSecurityProtocols()
SecurityProtocols.getInstance() by default after initialization
by SecurityProtocols.addDefaultProtocols().protected org.snmp4j.security.USM createUSM()
engineBootsProvider and engineID.public org.snmp4j.smi.Integer32 getSysServices()
public org.snmp4j.smi.OID getSysOID()
public org.snmp4j.smi.OctetString getSysDescr()
SNMP4J-Agent version [SNMP4J-version] -
- - .public SysUpTime getSysUpTime()
SysUpTime instance.public NotificationOriginator getNotificationOriginator()
NotificationOriginator instance.public void setNotificationOriginator(NotificationOriginator notificationOriginator)
notificationOriginator - a NotificationOriginator instance.public void initialize()
protected void initOptionalMIBs()
public org.snmp4j.smi.OctetString getDefaultContext()
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 empty
string) denoting the context used for registering default MIBs.
protected org.snmp4j.smi.OctetString getContext(MOGroup mibGroup,
org.snmp4j.smi.OctetString defaultContext)
mibGroup - a group of ManagedObjects (i.e., a MIB module).defaultContext - the context to be used by default (i.e., the null context)
protected void registerMIBs(org.snmp4j.smi.OctetString context)
throws DuplicateRegistrationException
context - the context to register the internal MIB modules. This should be
null by default.
DuplicateRegistrationException - if some of the MIB modules
registration regions conflict with already registered regions.protected void unregisterMIBs(org.snmp4j.smi.OctetString context)
context - the context where the MIB modules have been previously registered.public void setupProxyForwarder()
protected NotificationOriginator createNotificationOriginator()
protected ProxyForwarder createProxyForwarder(CommandProcessor agent)
ProxyForwarderImpl).
agent - the command processor that uses the proxy forwarder.
protected CommandProcessor createCommandProcessor(org.snmp4j.smi.OctetString engineID)
engineID - the engine ID of the agent.
protected org.snmp4j.Session createSnmpSession(org.snmp4j.MessageDispatcher dispatcher)
dispatcher - the message dispatcher to be associated with the session.
Snmp instance by default).
|
Copyright 2005-2008 Frank Fock (SNMP4J.org) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||