Class IndexRegistryEntry

java.lang.Object
org.snmp4j.agent.agentx.master.index.IndexRegistryEntry
All Implemented Interfaces:
Comparable<IndexRegistryEntry>
Direct Known Subclasses:
SubAgentXIndexRegistryEntry

public class IndexRegistryEntry extends Object implements Comparable<IndexRegistryEntry>
A IndexRegistryEntry represents an index value registry for a specific table index type, represented by a VariableBinding.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Registry for active index values.
    Registry for used (old) index values.
  • Constructor Summary

    Constructors
    Constructor
    Description
    IndexRegistryEntry(org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding indexType)
    Creates a new registry based on an index type.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Add a used index value to the used registry.
    int
    allocate(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly)
    Allocate an INDEX instance this index type.
    org.snmp4j.smi.Variable
    anyIndex(int sessionID, boolean testOnly)
    Creates any (used before or new) index value for this index type.
    int
     
    protected void
     
    boolean
     
    org.snmp4j.smi.OctetString
    Gets the context.
    org.snmp4j.smi.VariableBinding
    Gets the index type identifier.
    int
     
    org.snmp4j.smi.Variable
    newIndex(int sessionID, boolean testOnly)
    Creates a new (never used before) index value for this index type.
    protected IndexEntry
    newIndexEntry(int sessionID, org.snmp4j.smi.Variable indexValue)
     
    void
    release(int sessionID)
    Release all index values of the specified session ID.
    int
    release(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly)
    Release a previously allocated INDEX instance.
    protected boolean
    Remove an index value from the active index values.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • IndexRegistryEntry

      public IndexRegistryEntry(org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding indexType)
      Creates a new registry based on an index type.
      Parameters:
      context - the SNMPv3 context.
      indexType - the index type.
  • Method Details

    • newIndexEntry

      protected IndexEntry newIndexEntry(int sessionID, org.snmp4j.smi.Variable indexValue)
    • duplicateAllocation

      protected void duplicateAllocation(IndexEntry entry)
    • allocate

      public int allocate(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly)
      Allocate an INDEX instance this index type.
      Parameters:
      sessionID - the session allocating the index.
      indexValue - the index value of the requested index instance.
      testOnly - if true, only test if allocation could be done, otherwise directly allocate the index.
      Returns:
      AgentXProtocol.AGENTX_SUCCESS if the allocation was successful, AgentXProtocol.AGENTX_INDEX_WRONG_TYPE, AgentXProtocol.AGENTX_INDEX_NONE_AVAILABLE, and AgentXProtocol.AGENTX_INDEX_ALREADY_ALLOCATED on error.
    • release

      public int release(int sessionID, org.snmp4j.smi.Variable indexValue, boolean testOnly)
      Release a previously allocated INDEX instance.
      Parameters:
      sessionID - the session allocating the index.
      indexValue - the variable with the index value to release.
      testOnly - if true, only test if release could be done, otherwise directly release the index.
      Returns:
      AgentXProtocol.AGENTX_SUCCESS if the allocation was successful, AgentXProtocol.AGENTX_INDEX_NOT_ALLOCATED, AgentXProtocol.AGENTX_INDEX_ALREADY_ALLOCATED on error.
    • removeEntry

      protected boolean removeEntry(IndexEntry entryKey)
      Remove an index value from the active index values.
      Parameters:
      entryKey - the index value entry.
      Returns:
      true if the removal was successful.
    • addUsed

      protected void addUsed(IndexEntry entry)
      Add a used index value to the used registry.
      Parameters:
      entry - the index value entry.
    • release

      public void release(int sessionID)
      Release all index values of the specified session ID.
      Parameters:
      sessionID - the session to release index values for.
    • compareTo

      public int compareTo(IndexRegistryEntry other)
      Specified by:
      compareTo in interface Comparable<IndexRegistryEntry>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getIndexType

      public org.snmp4j.smi.VariableBinding getIndexType()
      Gets the index type identifier.
      Returns:
      an index type identifier.
    • getContext

      public org.snmp4j.smi.OctetString getContext()
      Gets the context.
      Returns:
      a SNMPv3 context.
    • newIndex

      public org.snmp4j.smi.Variable newIndex(int sessionID, boolean testOnly)
      Creates a new (never used before) index value for this index type.
      Parameters:
      sessionID - the session ID requesting the index.
      testOnly - if true, only test if allocation could be done, otherwise directly allocate the index.
      Returns:
      the allocated index value.
    • anyIndex

      public org.snmp4j.smi.Variable anyIndex(int sessionID, boolean testOnly)
      Creates any (used before or new) index value for this index type.
      Parameters:
      sessionID - the session ID requesting the index.
      testOnly - if true, only test if allocation could be done, otherwise directly allocate the index.
      Returns:
      the allocated index value.