com.sun.jdmk.snmp
Class SnmpPduFactoryBER

java.lang.Object
  extended bycom.sun.jdmk.snmp.SnmpPduFactoryBER
All Implemented Interfaces:
Serializable, SnmpPduFactory

Deprecated. Use package com.sun.management.snmp in preference to classes in this package. This class may be removed in a future version of Java DMK.

public class SnmpPduFactoryBER
extends Object
implements SnmpPduFactory, Serializable

Default implementation of the SnmpPduFactory interface.
It uses the BER (basic encoding rules) standardized encoding scheme associated with ASN.1.

This implementation of the SnmpPduFactory is very basic: it simply calls encoding and decoding methods from SnmpMsg.

 public SnmpPdu decodeSnmpPdu(SnmpMsg msg) 
 throws SnmpStatusException {
   return msg.decodeSnmpPdu() ;
 }
 
 public SnmpMsg encodeSnmpPdu(SnmpPdu pdu, int maxPktSize)
 throws SnmpStatusException, SnmpTooBigException {
   SnmpMsg result = new SnmpMessage() ;       // for SNMP v1/v2
 or
   SnmpMsg result = new SnmpV3Message() ;     // for SNMP v3
   result.encodeSnmpPdu(pdu, maxPktSize) ;
   return result ;
 }
 
To implement your own object, you can implement SnmpPduFactory or extend SnmpPduFactoryBER.

See Also:
Serialized Form

Constructor Summary
SnmpPduFactoryBER()
          Deprecated.  
 
Method Summary
 SnmpPduPacket decodePdu(SnmpMessage msg)
          Deprecated. As of Java Dynamic Management Kit 5.0, replaced by decodeSnmpPdu(SnmpMsg)
 SnmpPdu decodeSnmpPdu(SnmpMsg msg)
          Deprecated. Calls SnmpMsg.decodeSnmpPdu on the specified message and returns the resulting SnmpPdu.
 SnmpMessage encodePdu(SnmpPduPacket pdu, int maxPktSize)
          Deprecated. As of Java Dynamic Management Kit 5.0, replaced by encodeSnmpPdu(SnmpPdu, int)
 SnmpMsg encodeSnmpPdu(SnmpPdu pdu, int maxPktSize)
          Deprecated. Encodes the specified SnmpPdu and returns the resulting SnmpMsg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpPduFactoryBER

public SnmpPduFactoryBER()
Deprecated. 
Method Detail

decodePdu

public SnmpPduPacket decodePdu(SnmpMessage msg)
                        throws SnmpStatusException
Deprecated. As of Java Dynamic Management Kit 5.0, replaced by decodeSnmpPdu(SnmpMsg)

Specified by:
decodePdu in interface SnmpPduFactory
Throws:
SnmpStatusException

decodeSnmpPdu

public SnmpPdu decodeSnmpPdu(SnmpMsg msg)
                      throws SnmpStatusException
Deprecated. 
Calls SnmpMsg.decodeSnmpPdu on the specified message and returns the resulting SnmpPdu.

Specified by:
decodeSnmpPdu in interface SnmpPduFactory
Parameters:
msg - The SNMP message to be decoded.
Returns:
The resulting SNMP PDU packet.
Throws:
SnmpStatusException - If the encoding is invalid.
Since:
Java DMK 5.0

encodePdu

public SnmpMessage encodePdu(SnmpPduPacket pdu,
                             int maxPktSize)
                      throws SnmpStatusException,
                             SnmpTooBigException
Deprecated. As of Java Dynamic Management Kit 5.0, replaced by encodeSnmpPdu(SnmpPdu, int)

Specified by:
encodePdu in interface SnmpPduFactory
Throws:
SnmpStatusException
SnmpTooBigException

encodeSnmpPdu

public SnmpMsg encodeSnmpPdu(SnmpPdu pdu,
                             int maxPktSize)
                      throws SnmpStatusException,
                             SnmpTooBigException
Deprecated. 
Encodes the specified SnmpPdu and returns the resulting SnmpMsg. If this method returns null, the specified SnmpPdu will be dropped and the current SNMP request will be aborted.

Specified by:
encodeSnmpPdu in interface SnmpPduFactory
Parameters:
pdu - The SnmpPdu to be encoded.
maxPktSize - The size limit of the resulting encoding.
Returns:
Null or a fully encoded SnmpMsg.
Throws:
SnmpStatusException - If pdu contains illegal values and cannot be encoded.
SnmpTooBigException - If the resulting encoding does not fit into maxPktSize bytes.
Since:
Java DMK 5.0

FCS Release
jdmk-5_1-b34.2 2005.11.29_16:24:00_MET

Copyright 1998-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.