- java.lang.Object
-
- java.util.EventObject
-
- org.snmp4j.CommandResponderEvent<A>
-
- All Implemented Interfaces:
java.io.Serializable
public class CommandResponderEvent<A extends Address> extends java.util.EventObjectTheCommandResponderEventis fired by theMessageDispatcherto listeners that potentially can process the included request, report, or trap/notification.- Version:
- 2.0
- Author:
- Frank Fock, Jochen Katz
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CommandResponderEvent(java.lang.Object source, CommandResponderEvent<A> other)Creates shallow copy of the suppliedCommandResponderEventbut the source of the event is set to the supplied source.CommandResponderEvent(MessageDispatcher messageDispatcher, TransportMapping<? super A> transportMapping, A sourceAddress, int messageProcessingModel, int securityModel, byte[] securityName, int securityLevel, PduHandle pduHandle, PDU pdu, int maxSizeResponseScopedPDU, StateReference<A> stateReference)Constructs an event for processing an incoming request or notification PDU.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxSizeResponsePDU()MessageDispatchergetMessageDispatcher()Gets the message dispatcher instance that received the command (request PDU) or unconfirmed PDU like a report, trap, or notification..intgetMessageProcessingModel()PDUgetPDU()PduHandlegetPduHandle()AgetPeerAddress()Gets the transport address of the sending entity.intgetSecurityLevel()intgetSecurityModel()Gets the security model used by the command.byte[]getSecurityName()StateReference<A>getStateReference()TransportStateReferencegetTmStateReference()Gets the transport model state reference as defined by RFC 5590.TransportMapping<? super A>getTransportMapping()Returns the transport mapping that received the PDU that triggered this event.booleanisProcessed()Checks whether this event is already processed or not.voidsetMaxSizeResponsePDU(int maxSizeResponsePDU)voidsetMessageProcessingModel(int messageProcessingModel)voidsetPDU(PDU pdu)voidsetPduHandle(PduHandle pduHandle)voidsetPeerAddress(A peerAddress)Sets the transport address of the sending entity.voidsetProcessed(boolean processed)Sets the status of this PDU.voidsetSecurityLevel(int securityLevel)voidsetSecurityModel(int securityModel)voidsetSecurityName(byte[] securityName)voidsetStateReference(StateReference<A> stateReference)voidsetTmStateReference(TransportStateReference tmStateReference)Sets the transport model state reference as defined by RFC 5590.protected voidsetTransportMapping(TransportMapping<? super A> transportMapping)java.lang.StringtoString()
-
-
-
Constructor Detail
-
CommandResponderEvent
public CommandResponderEvent(MessageDispatcher messageDispatcher, TransportMapping<? super A> transportMapping, A sourceAddress, int messageProcessingModel, int securityModel, byte[] securityName, int securityLevel, PduHandle pduHandle, PDU pdu, int maxSizeResponseScopedPDU, StateReference<A> stateReference)
Constructs an event for processing an incoming request or notification PDU.- Parameters:
messageDispatcher- the source of the event. May be used to send response PDUs.transportMapping- theTransportMappingwhich received the PDU.sourceAddress- the source transport address of the SNMP message.messageProcessingModel- the message processing model ID.securityModel- the security model ID.securityName- the principal.securityLevel- the requested security level.pduHandle- the PDU handle that uniquely identifies thepdu.pdu- the SNMP request PDU to process.maxSizeResponseScopedPDU- the maximum size of a possible response PDU.stateReference- needed for responding a request, will benullfor notifications.
-
CommandResponderEvent
public CommandResponderEvent(java.lang.Object source, CommandResponderEvent<A> other)Creates shallow copy of the suppliedCommandResponderEventbut the source of the event is set to the supplied source.- Parameters:
source- the (new) source of event copy to create.other- theCommandResponderEventto copy.- Since:
- 1.1
-
-
Method Detail
-
getMessageDispatcher
public MessageDispatcher getMessageDispatcher()
Gets the message dispatcher instance that received the command (request PDU) or unconfirmed PDU like a report, trap, or notification..- Returns:
- the
MessageDispatcherinstance that received the command.
-
getSecurityModel
public int getSecurityModel()
Gets the security model used by the command.- Returns:
- int
-
setSecurityModel
public void setSecurityModel(int securityModel)
-
setSecurityLevel
public void setSecurityLevel(int securityLevel)
-
getSecurityLevel
public int getSecurityLevel()
-
setMaxSizeResponsePDU
public void setMaxSizeResponsePDU(int maxSizeResponsePDU)
-
getMaxSizeResponsePDU
public int getMaxSizeResponsePDU()
-
setPduHandle
public void setPduHandle(PduHandle pduHandle)
-
getPduHandle
public PduHandle getPduHandle()
-
setStateReference
public void setStateReference(StateReference<A> stateReference)
-
getStateReference
public StateReference<A> getStateReference()
-
setPDU
public void setPDU(PDU pdu)
-
getPDU
public PDU getPDU()
-
setMessageProcessingModel
public void setMessageProcessingModel(int messageProcessingModel)
-
getMessageProcessingModel
public int getMessageProcessingModel()
-
setSecurityName
public void setSecurityName(byte[] securityName)
-
getSecurityName
public byte[] getSecurityName()
-
setProcessed
public void setProcessed(boolean processed)
Sets the status of this PDU.- Parameters:
processed- If set totrue, the dispatcher stops dispatching this event to other event listeners, because it has been successfully processed.
-
isProcessed
public boolean isProcessed()
Checks whether this event is already processed or not.- Returns:
trueif this event has been processed,falseotherwise.
-
getPeerAddress
public A getPeerAddress()
Gets the transport address of the sending entity.- Returns:
- the
Addressof the PDU sender.
-
getTransportMapping
public TransportMapping<? super A> getTransportMapping()
Returns the transport mapping that received the PDU that triggered this event.- Returns:
- a
TransportMappinginstance.
-
setPeerAddress
public void setPeerAddress(A peerAddress)
Sets the transport address of the sending entity.- Parameters:
peerAddress- theAddressof the PDU sender.
-
setTransportMapping
protected void setTransportMapping(TransportMapping<? super A> transportMapping)
-
getTmStateReference
public TransportStateReference getTmStateReference()
Gets the transport model state reference as defined by RFC 5590.- Returns:
- a
TransportStateReferenceinstance if the transport and/or the security model supports it ornullotherwise. - Since:
- 2.0
-
setTmStateReference
public void setTmStateReference(TransportStateReference tmStateReference)
Sets the transport model state reference as defined by RFC 5590.- Parameters:
tmStateReference- the transport model (mapping) state information associated with this command responder event.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.EventObject
-
-