public class DefaultPDUFactory extends Object implements PDUFactory
DefaultPDUFactory is a default implementation of the
PDUFactory interface. It creates PDUs depending on the
target's message processing model. That is, a PDUv1 instance is
created for a SNMPv1 target whereas a ScopedPDU is created
for a SNMPv3 target. In all other cases a PDU instance is created.| Modifier and Type | Field and Description |
|---|---|
static int |
GETBULK_DEFAULT_MAX_REPETITIONS |
static int |
GETBULK_DEFAULT_NON_REPEATERS |
| Constructor and Description |
|---|
DefaultPDUFactory()
Creates a PDU factory for the
PDU.GET PDU type. |
DefaultPDUFactory(int pduType)
Creates a PDU factory for the specified PDU type.
|
DefaultPDUFactory(int pduType,
OctetString contextEngineID,
OctetString contextName)
Creates a
PDUFactory with type and context information. |
| Modifier and Type | Method and Description |
|---|---|
static PDU |
createPDU(int targetVersion)
Creates a
PDU instance for the specified SNMP version. |
PDU |
createPDU(MessageProcessingModel messageProcessingModel)
Creates a
PDU instance for the specified MessageProcessingModel. |
static PDU |
createPDU(MessageProcessingModel messageProcessingModel,
int pduType)
Creates a
PDU instance for the specified MessageProcessingModel and PDU type. |
PDU |
createPDU(Target target)
Create a
PDU instance for the supplied target. |
static PDU |
createPDU(Target target,
int pduType)
Create a
PDU instance for the supplied target. |
static PDU |
createPDU(Target target,
int pduType,
int maxRepetitions,
int nonRepeaters)
Create a
PDU instance for the supplied target. |
OctetString |
getContextEngineID()
Gets the context engine ID for
ScopedPDU instances created
by this factory. |
OctetString |
getContextName()
Gets the context name for
ScopedPDU instances created
by this factory. |
int |
getMaxRepetitions()
Gets the maximum number of repetitions for the repetitions
variable bindings for
PDU.GETBULK PDUs. |
int |
getNonRepeaters()
Gets the number of non repeater variable bindings for
PDU.GETBULK PDUs. |
int |
getPduType() |
void |
setContextEngineID(OctetString contextEngineID)
Sets the context engine ID for
ScopedPDU instances created
by this factory. |
void |
setContextName(OctetString contextName)
Sets the context name for
ScopedPDU instances created
by this factory. |
void |
setMaxRepetitions(int maxRepetitions)
Sets the max repetitions parameter value for GETBULK PDUs created by
this factory.
|
void |
setNonRepeaters(int nonRepeaters)
Sets the non repeaters parameter value for GETBULK PDUs created by
this factory.
|
void |
setPduType(int pduType) |
public static final int GETBULK_DEFAULT_MAX_REPETITIONS
public static final int GETBULK_DEFAULT_NON_REPEATERS
public DefaultPDUFactory()
PDU.GET PDU type.public DefaultPDUFactory(int pduType)
pduType - a PDU type as specified by PDU.public DefaultPDUFactory(int pduType,
OctetString contextEngineID,
OctetString contextName)
PDUFactory with type and context information.public void setPduType(int pduType)
public int getPduType()
public PDU createPDU(Target target)
PDU instance for the supplied target.createPDU in interface PDUFactorytarget - the Target where the PDU to be created will be
sent.public static PDU createPDU(Target target, int pduType)
PDU instance for the supplied target. For GETBULK
PDUs, the default max repetitions and non repeaters are used. See
GETBULK_DEFAULT_MAX_REPETITIONS and
GETBULK_DEFAULT_NON_REPEATERS.target - the Target where the PDU to be created will be
sent.pduType - a PDU type as specified by PDU.public static PDU createPDU(Target target, int pduType, int maxRepetitions, int nonRepeaters)
PDU instance for the supplied target.target - the Target where the PDU to be created will be
sent.pduType - a PDU type as specified by PDU.maxRepetitions - the maximum number of repetitions for GETBULK PDUs created
by this factory.nonRepeaters - the number of non-repeater variable bindings
(processed like GETNEXT) for GETBULK PDUs created
by this factory.public static PDU createPDU(int targetVersion)
PDU instance for the specified SNMP version.targetVersion - a SNMP version as defined by SnmpConstants.public PDU createPDU(MessageProcessingModel messageProcessingModel)
PDU instance for the specified MessageProcessingModel.createPDU in interface PDUFactorymessageProcessingModel - a message processing model instance.public static PDU createPDU(MessageProcessingModel messageProcessingModel, int pduType)
PDU instance for the specified MessageProcessingModel and PDU type.messageProcessingModel - a message processing model instance.pduType - the type for the new PDU.public int getMaxRepetitions()
PDU.GETBULK PDUs.
Default is GETBULK_DEFAULT_MAX_REPETITIONSpublic void setMaxRepetitions(int maxRepetitions)
maxRepetitions - the maximum number of repetitions for GETBULK PDUs created
by this factory.public int getNonRepeaters()
PDU.GETBULK PDUs.
Default is GETBULK_DEFAULT_NON_REPEATERS.public void setNonRepeaters(int nonRepeaters)
nonRepeaters - the number of non-repeater variable bindings
(processed like GETNEXT) for GETBULK PDUs created
by this factory.public OctetString getContextEngineID()
ScopedPDU instances created
by this factory.null if context engine ID is
the same as authoritative engine ID.public void setContextEngineID(OctetString contextEngineID)
ScopedPDU instances created
by this factory.contextEngineID - the context engine ID or null if context engine ID is
the same as authoritative engine ID.public OctetString getContextName()
ScopedPDU instances created
by this factory.null for the default context.public void setContextName(OctetString contextName)
ScopedPDU instances created
by this factory.contextName - the context name or null for the default context.Copyright © 2016 SNMP4J.org. All Rights Reserved.