org.apache.servicemix.snmp
Class SnmpPollingEndpoint

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ConsumerEndpoint
              extended by org.apache.servicemix.common.endpoints.PollingEndpoint
                  extended by org.apache.servicemix.snmp.SnmpPollingEndpoint
All Implemented Interfaces:
EventListener, Endpoint, SnmpEndpointType, org.snmp4j.event.ResponseListener

public class SnmpPollingEndpoint
extends PollingEndpoint
implements SnmpEndpointType, org.snmp4j.event.ResponseListener

This is the polling endpoint for the snmp component.

Author:
lhein

Field Summary
static String DEFAULT_COMMUNITY
           
static int DEFAULT_SNMP_RETRIES
           
static int DEFAULT_SNMP_TIMEOUT
           
static int DEFAULT_SNMP_VERSION
           
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, logger, service, serviceUnit
 
Constructor Summary
SnmpPollingEndpoint()
           
 
Method Summary
 void activate()
           
 String getAddress()
           
 SnmpMarshalerSupport getMarshaler()
           
 OIDList getOids()
           
 int getRetries()
           
 String getSnmpCommunity()
           
 int getSnmpVersion()
           
 int getTimeout()
           
 void onResponse(org.snmp4j.event.ResponseEvent event)
           
 void poll()
           
 void process(javax.jbi.messaging.MessageExchange exchange)
           
 void setAddress(String address)
          Specifies the connection URI used to connect to a snmp capable device.
 void setMarshaler(SnmpMarshalerSupport marshaler)
          Specifies a marshaler class which provides the logic for converting a snmp response into a normalized message.
 void setOids(OIDList oids)
          Specifies a reference to a list of OID values which will be used for the snmp request.
 void setRetries(int retries)
          Specifies the connection retries.
 void setSnmpCommunity(String snmpCommunity)
          Specifies the snmp community to use.
 void setSnmpVersion(int snmpVersion)
          Specifies the snmp protocol version to use.
 void setTimeout(int timeout)
          Specifies the connection time out in milliseconds.
 void start()
           
 void stop()
           
 void validate()
           
 
Methods inherited from class org.apache.servicemix.common.endpoints.PollingEndpoint
getDelay, getExecutor, getFirstTime, getPeriod, getScheduler, handlePollException, isConcurrentPolling, setConcurrentPolling, setDelay, setFirstTime, setPeriod, setScheduler
 
Methods inherited from class org.apache.servicemix.common.endpoints.ConsumerEndpoint
configureExchangeTarget, deactivate, getLocationURI, getRole, getTargetEndpoint, getTargetInterface, getTargetOperation, getTargetService, getTargetUri, setTargetEndpoint, setTargetInterface, setTargetOperation, setTargetService, setTargetUri
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send, sendSync
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_COMMUNITY

public static final String DEFAULT_COMMUNITY
See Also:
Constant Field Values

DEFAULT_SNMP_VERSION

public static final int DEFAULT_SNMP_VERSION
See Also:
Constant Field Values

DEFAULT_SNMP_RETRIES

public static final int DEFAULT_SNMP_RETRIES
See Also:
Constant Field Values

DEFAULT_SNMP_TIMEOUT

public static final int DEFAULT_SNMP_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

SnmpPollingEndpoint

public SnmpPollingEndpoint()
Method Detail

activate

public void activate()
              throws Exception
Specified by:
activate in interface Endpoint
Overrides:
activate in class ConsumerEndpoint
Throws:
Exception

start

public void start()
           throws Exception
Specified by:
start in interface Endpoint
Overrides:
start in class PollingEndpoint
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Endpoint
Overrides:
stop in class PollingEndpoint
Throws:
Exception

validate

public void validate()
              throws javax.jbi.management.DeploymentException
Specified by:
validate in interface Endpoint
Overrides:
validate in class ConsumerEndpoint
Throws:
javax.jbi.management.DeploymentException

poll

public void poll()
          throws Exception
Specified by:
poll in class PollingEndpoint
Throws:
Exception

process

public void process(javax.jbi.messaging.MessageExchange exchange)
             throws Exception
Specified by:
process in interface Endpoint
Specified by:
process in class AbstractEndpoint
Throws:
Exception

onResponse

public void onResponse(org.snmp4j.event.ResponseEvent event)
Specified by:
onResponse in interface org.snmp4j.event.ResponseListener

getAddress

public String getAddress()

setAddress

public void setAddress(String address)

Specifies the connection URI used to connect to a snmp capable device.

Template:
   <protocol>:<host>/<port>

Details:

Name Description
protocol the protocol to use (udp or tcp)
host the name or ip address of the snmp capable device
port the port number to use

Example:
   udp:192.168.2.122/161

   The default value is null

Parameters:
address - a String value containing the connection details

getRetries

public int getRetries()

setRetries

public void setRetries(int retries)

Specifies the connection retries.

   The default value is 2

Parameters:
retries - a int value containing the retry count

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)

Specifies the connection time out in milliseconds.

   The default value is 1500

Parameters:
timeout - a int value containing the time out in millis

getSnmpVersion

public int getSnmpVersion()

setSnmpVersion

public void setSnmpVersion(int snmpVersion)

Specifies the snmp protocol version to use.

   The default value is 0 (version 1)

Parameters:
snmpVersion - a int value containing the snmp version

getSnmpCommunity

public String getSnmpCommunity()

setSnmpCommunity

public void setSnmpCommunity(String snmpCommunity)

Specifies the snmp community to use.

   The default value is "public"

Parameters:
snmpCommunity - a String value containing the snmp community

getMarshaler

public SnmpMarshalerSupport getMarshaler()

setMarshaler

public void setMarshaler(SnmpMarshalerSupport marshaler)

Specifies a marshaler class which provides the logic for converting a snmp response into a normalized message. This class has to implement the SnmpMarshalerSupport interface. If you don't specify a marshaler, the DefaultSnmpMarshaler will be used.

Parameters:
marshaler - a class which implements SnmpMarshalerSupport

getOids

public OIDList getOids()

setOids

public void setOids(OIDList oids)

Specifies a reference to a list of OID values which will be used for the snmp request. You have two possibilities how to specify the value:

 a) referencing to a file containing a list of OID values separated by a line feed
    or
 b) defining a coma (,) separated list of OID values

Examples:
   a) oids="classpath:myOids.txt"
       oids="file:/home/lhein/snmp/device_a/oids.txt"

   b) oids="1.3.6.1.2.1.1.3.0 , 1.3.6.1.2.1.25.3.2.1.5.1 , 1.3.6.1.2.1.25.3.5.1.1.1 , 1.3.6.1.2.1.43.5.1.1.11.1"

   The default value is null

Parameters:
oids - a OIDList containing the OID values for the request


Copyright © 2005-2009 The Apache Software Foundation. All Rights Reserved.