org.snmp4j.util
Class DefaultPDUFactory

java.lang.Object
  extended by org.snmp4j.util.DefaultPDUFactory
All Implemented Interfaces:
PDUFactory

public class DefaultPDUFactory
extends java.lang.Object
implements PDUFactory

The 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.

Since:
1.0.4
Version:
1.7.3
Author:
Frank Fock

Constructor Summary
DefaultPDUFactory()
          Creates a PDU factory for the PDU.GET PDU type.
DefaultPDUFactory(int pduType)
          Creates a PDU factory for the specified PDU type.
 
Method Summary
static PDU createPDU(int targetVersion)
          Create a PDU instance for the specified SNMP version.
 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.
 int getPduType()
           
 void setPduType(int pduType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPDUFactory

public DefaultPDUFactory()
Creates a PDU factory for the PDU.GET PDU type.


DefaultPDUFactory

public DefaultPDUFactory(int pduType)
Creates a PDU factory for the specified PDU type.

Parameters:
pduType - a PDU type as specified by PDU.
Method Detail

setPduType

public void setPduType(int pduType)

getPduType

public int getPduType()

createPDU

public PDU createPDU(Target target)
Create a PDU instance for the supplied target.

Specified by:
createPDU in interface PDUFactory
Parameters:
target - the Target where the PDU to be created will be sent.
Returns:
PDU a PDU instance that is compatible with the supplied target.

createPDU

public static PDU createPDU(Target target,
                            int pduType)
Create a PDU instance for the supplied target.

Parameters:
target - the Target where the PDU to be created will be sent.
pduType - a PDU type as specified by PDU.
Returns:
PDU a PDU instance that is compatible with the supplied target.

createPDU

public static PDU createPDU(int targetVersion)
Create a PDU instance for the specified SNMP version.

Parameters:
targetVersion - a SNMP version as defined by SnmpConstants.
Returns:
a PDU instance that is compatible with the supplied target SNMP version.
Since:
1.7.3

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.