org.apache.servicemix.snmp
Class SnmpTrapConsumerEndpoint

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.snmp.SnmpTrapConsumerEndpoint
All Implemented Interfaces:
java.util.EventListener, Endpoint, SnmpEndpointType, org.snmp4j.CommandResponder

public class SnmpTrapConsumerEndpoint
extends ConsumerEndpoint
implements SnmpEndpointType, org.snmp4j.CommandResponder

This is the trap endpoint for the snmp component. This endpoint receives and process trap PDUs from a device. Then it sends an exchange to the target service containing the processed content.

Author:
gperdiguero, jbonofre

Field Summary
static boolean DEFAULT_ENABLED_VALUE
           
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, logger, service, serviceUnit
 
Constructor Summary
SnmpTrapConsumerEndpoint()
           
 
Method Summary
 void activate()
           
 java.lang.String getAddress()
           
 SnmpMarshalerSupport getMarshaler()
           
 org.snmp4j.Snmp getSnmp()
           
 boolean isEnabled()
           
 void process(javax.jbi.messaging.MessageExchange exchange)
           
 void processPdu(org.snmp4j.CommandResponderEvent event)
           
 void setAddress(java.lang.String address)
          Specifies the connection URI used to connect to a snmp capable device.
 void setEnabled(boolean enabled)
          Specifies wether the endpoint is enabled or not.
 void setMarshaler(SnmpMarshalerSupport marshaler)
          Specifies a marshaler class which provides the logic for converting a snmp trap into a normalized message.
 void start()
           
 void stop()
           
 void validate()
           
 
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_ENABLED_VALUE

public static final boolean DEFAULT_ENABLED_VALUE
See Also:
Constant Field Values
Constructor Detail

SnmpTrapConsumerEndpoint

public SnmpTrapConsumerEndpoint()
Method Detail

activate

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

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Endpoint
Overrides:
start in class SimpleEndpoint
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Endpoint
Overrides:
stop in class SimpleEndpoint
Throws:
java.lang.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

process

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

processPdu

public void processPdu(org.snmp4j.CommandResponderEvent event)
Specified by:
processPdu in interface org.snmp4j.CommandResponder

getSnmp

public org.snmp4j.Snmp getSnmp()

getAddress

public java.lang.String getAddress()

setAddress

public void setAddress(java.lang.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/162

   The default value is null

Parameters:
listenAddress - a String value containing the connection details

getMarshaler

public SnmpMarshalerSupport getMarshaler()

setMarshaler

public void setMarshaler(SnmpMarshalerSupport marshaler)

Specifies a marshaler class which provides the logic for converting a snmp trap 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

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)

Specifies wether the endpoint is enabled or not. If its value is set to true, the connection data will be setted and trap PDUs will be processed. Otherwise, the endpoint won't do anything.

Parameters:
enabled - the enabled to set


Copyright © 2005-2011 FuseSource. All Rights Reserved.