org.jboss.jmx.adaptor.snmp.agent
Class SnmpAgentService

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.system.ListenerServiceMBeanSupport (src) 
              extended byorg.jboss.jmx.adaptor.snmp.agent.SnmpAgentService
All Implemented Interfaces:
java.util.EventListener, ListenerServiceMBean (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , NotificationListener (src) , Service (src) , ServiceMBean (src)

public class SnmpAgentService
extends ListenerServiceMBeanSupport (src)
implements NotificationListener (src)

SnmpAgentService is an MBean class implementing an SNMP agent. Currently, it allows to send V1 or V2 traps to one or more SNMP managers defined by their IP address, listening port number and expected SNMP version. It will hopefully grow into a full blown SNMP agent with get/set functionality.


Nested Class Summary
 
Nested classes inherited from class org.jboss.system.ListenerServiceMBeanSupport (src)
ListenerServiceMBeanSupport.SubscriptionInfo (src)
 
Field Summary
static java.lang.String DEFAULT_READ_COMMUNITY
          Default communities
static java.lang.String DEFAULT_WRITE_COMMUNITY
           
static int SNMPV1
          Supported versions
static int SNMPV2
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ListenerServiceMBean (src)
SL_FILTER_ELEMENT, SL_FILTER_FACTORY_ATTRIBUTE, SL_MBEAN_ELEMENT, SL_MBEAN_HANDBACK_ATTRIBUTE, SL_MBEAN_NAME_ATTRIBUTE, SL_NOTIFICATION_ELEMENT, SL_NOTIFICATION_TYPE_ATTRIBUTE, SL_ROOT_ELEMENT
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
SnmpAgentService()
          Default CTOR
 
Method Summary
 java.lang.String getBindAddress()
          Gets the agent bind address
 boolean getDynamicSubscriptions()
          Gets the dynamic subscriptions status
 int getHeartBeatPeriod()
          Gets the heartbeat switch
 long getInstantiationTime()
          Returns the difference, measured in milliseconds, between the instantiation time and midnight, January 1, 1970 UTC.
 java.lang.String getManagersResName()
          Gets the name of the file containing SNMP manager specifications
 java.lang.String getNotificationMapResName()
          Gets the name of the file containing the notification/trap mappings
 int getNumberOfThreads()
          Gets the number of threads in the agent requests processing thread pool
 int getPort()
          Gets the agent listening port number
 java.lang.String getRequestHandlerClassName()
          Gets the RequestHandler implementation class
 java.lang.String getRequestHandlerResName()
          Gets the resource file name containing get/set mappings
 int getSnmpVersion()
          Gets the snmp protocol version
 ObjectName (src) getTimerName()
          Gets the utilised timer MBean name
 long getTrapCount()
          Returns the current trap counter reading
 java.lang.String getTrapFactoryClassName()
          Gets the utilised trap factory name
 long getUptime()
          Returns the up-time
 void handleNotification2(Notification (src)  n, java.lang.Object handback)
          All notifications are intercepted here and are routed for emission.
 void setBindAddress(java.lang.String bindAddress)
          Sets the agent bind address
 void setDynamicSubscriptions(boolean dynamicSubscriptions)
          Enables/disables dynamic subscriptions
 void setHeartBeatPeriod(int heartBeatPeriod)
          Sets the heartbeat period (in seconds) switch
 void setManagersResName(java.lang.String managersResName)
          Sets the name of the file containing SNMP manager specifications
 void setNotificationMapResName(java.lang.String notificationMapResName)
          Sets the name of the file containing the notification/trap mappings
 void setNumberOfThreads(int numberOfThreads)
          Sets the number of threads in the agent request processing thread pool
 void setPort(int port)
          Sets the agent listening port number
 void setReadCommunity(java.lang.String readCommunity)
          Sets the read community (no getter)
 void setRequestHandlerClassName(java.lang.String requestHandlerClassName)
          Sets the RequestHandler implementation class
 void setRequestHandlerResName(java.lang.String requestHandlerResName)
          Sets the resource file name containing get/set mappings
 void setSnmpVersion(int snmpVersion)
          Sets the snmp protocol version
 void setTimerName(ObjectName (src)  timerName)
          Sets the utilised timer MBean name
 void setTrapFactoryClassName(java.lang.String name)
          Sets the utilised trap factory name
 void setWriteCommunity(java.lang.String writeCommunity)
          Sets the write community (no getter)
protected  void startService()
          Perform service start-up
protected  void stopService()
          Perform service shutdown
 
Methods inherited from class org.jboss.system.ListenerServiceMBeanSupport (src)
handleNotification, setSubscriptionList, subscribe, subscribe, subscribe, unsubscribe
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.management.NotificationListener (src)
handleNotification
 
Methods inherited from interface org.jboss.system.ServiceMBean (src)
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 

Field Detail

SNMPV1

public static final int SNMPV1
Supported versions

See Also:
Constant Field Values (src)

SNMPV2

public static final int SNMPV2
See Also:
Constant Field Values (src)

DEFAULT_READ_COMMUNITY

public static final java.lang.String DEFAULT_READ_COMMUNITY
Default communities

See Also:
Constant Field Values (src)

DEFAULT_WRITE_COMMUNITY

public static final java.lang.String DEFAULT_WRITE_COMMUNITY
See Also:
Constant Field Values (src)
Constructor Detail

SnmpAgentService

public SnmpAgentService()
Default CTOR

Method Detail

getHeartBeatPeriod

public int getHeartBeatPeriod()
Gets the heartbeat switch


setHeartBeatPeriod

public void setHeartBeatPeriod(int heartBeatPeriod)
Sets the heartbeat period (in seconds) switch


getInstantiationTime

public long getInstantiationTime()
Returns the difference, measured in milliseconds, between the instantiation time and midnight, January 1, 1970 UTC.


getUptime

public long getUptime()
Returns the up-time


getTrapCount

public long getTrapCount()
Returns the current trap counter reading


setManagersResName

public void setManagersResName(java.lang.String managersResName)
Sets the name of the file containing SNMP manager specifications


getManagersResName

public java.lang.String getManagersResName()
Gets the name of the file containing SNMP manager specifications


setNotificationMapResName

public void setNotificationMapResName(java.lang.String notificationMapResName)
Sets the name of the file containing the notification/trap mappings


getNotificationMapResName

public java.lang.String getNotificationMapResName()
Gets the name of the file containing the notification/trap mappings


setTrapFactoryClassName

public void setTrapFactoryClassName(java.lang.String name)
Sets the utilised trap factory name


getTrapFactoryClassName

public java.lang.String getTrapFactoryClassName()
Gets the utilised trap factory name


setTimerName

public void setTimerName(ObjectName (src)  timerName)
Sets the utilised timer MBean name


getTimerName

public ObjectName (src)  getTimerName()
Gets the utilised timer MBean name


setBindAddress

public void setBindAddress(java.lang.String bindAddress)
                    throws java.net.UnknownHostException
Sets the agent bind address

Throws:
java.net.UnknownHostException

getBindAddress

public java.lang.String getBindAddress()
Gets the agent bind address


setNumberOfThreads

public void setNumberOfThreads(int numberOfThreads)
Sets the number of threads in the agent request processing thread pool


getNumberOfThreads

public int getNumberOfThreads()
Gets the number of threads in the agent requests processing thread pool


setPort

public void setPort(int port)
Sets the agent listening port number


getPort

public int getPort()
Gets the agent listening port number


setSnmpVersion

public void setSnmpVersion(int snmpVersion)
Sets the snmp protocol version


getSnmpVersion

public int getSnmpVersion()
Gets the snmp protocol version


setReadCommunity

public void setReadCommunity(java.lang.String readCommunity)
Sets the read community (no getter)


setWriteCommunity

public void setWriteCommunity(java.lang.String writeCommunity)
Sets the write community (no getter)


setRequestHandlerClassName

public void setRequestHandlerClassName(java.lang.String requestHandlerClassName)
Sets the RequestHandler implementation class


getRequestHandlerClassName

public java.lang.String getRequestHandlerClassName()
Gets the RequestHandler implementation class


setRequestHandlerResName

public void setRequestHandlerResName(java.lang.String requestHandlerResName)
Sets the resource file name containing get/set mappings


getRequestHandlerResName

public java.lang.String getRequestHandlerResName()
Gets the resource file name containing get/set mappings


setDynamicSubscriptions

public void setDynamicSubscriptions(boolean dynamicSubscriptions)
Enables/disables dynamic subscriptions


getDynamicSubscriptions

public boolean getDynamicSubscriptions()
Gets the dynamic subscriptions status


startService

protected void startService()
                     throws java.lang.Exception
Perform service start-up

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Perform service shutdown

Overrides:
stopService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

handleNotification2

public void handleNotification2(Notification (src)  n,
                                java.lang.Object handback)
All notifications are intercepted here and are routed for emission.

Overrides:
handleNotification2 in class ListenerServiceMBeanSupport (src)