[SNMP4J] Improved table index

Frank Fock fock at agentpp.com
Wed Feb 1 00:24:30 CET 2006


Hi again,

Frank Fock wrote:

> Hello Matthias,
>
> Matthias Wiesmann wrote:
>
>
>> One thing that strikes me in the code of this class is that there are
>> a lot of switches on the syntax of variables. It might make sense to
>> move the index building functionality directly into the different
>> subclasses of Variable, maybe with methods like:
>>
>> void fromIndex(OID index) ;
>> OID toIndex(boolean implied_length);
>>
>>  
>>
> These methods will also be added to v1.7. It is a natural property of 
> many SMI values
> to be able to be converted to/from an index.
>
The interface of Variable in v1.7 will look like:

  /**
   * Converts the value of this <code>Variable</code> to a (sub-)index
   * value.
   * @param impliedLength
   *    specifies if the sub-index has an implied length. This parameter 
applies
   *    to variable length variables only (e.g. {@link OctetString} and
   *    {@link OID}). For other variables it has no effect.
   * @return
   *    an OID that represents this value as an (sub-)index.
   * @throws UnsupportedOperationException
   *    if this variable cannot be used in an index.
   * @since 1.7
   */
  public abstract OID toSubIndex(boolean impliedLength);
 
  /**
   * Sets the value of this <code>Variable</code> from the supplied 
(sub-)index.
   * @param subIndex
   *    the sub-index OID.
   * @param impliedLength
   *    specifies if the sub-index has an implied length. This parameter 
applies
   *    to variable length variables only (e.g. {@link OctetString} and
   *    {@link OID}). For other variables it has no effect.
   * @throws UnsupportedOperationException
   *    if this variable cannot be used in an index.
   * @since 1.7
   */
  public abstract void fromSubIndex(OID subIndex, boolean impliedLength);

Any objections?

Best regards,
Frank





More information about the SNMP4J mailing list