Class IndexRegistryEntry
java.lang.Object
org.snmp4j.agent.agentx.master.index.IndexRegistryEntry
- All Implemented Interfaces:
Comparable<IndexRegistryEntry>
- Direct Known Subclasses:
SubAgentXIndexRegistryEntry
A
IndexRegistryEntry
represents an index value registry for a specific table index type, represented
by a VariableBinding
.-
Field Summary
Modifier and TypeFieldDescriptionprotected SortedMap
<IndexEntry, IndexEntry> Registry for active index values.protected SortedMap
<IndexEntry, IndexEntry> Registry for used (old) index values. -
Constructor Summary
ConstructorDescriptionIndexRegistryEntry
(org.snmp4j.smi.OctetString context, org.snmp4j.smi.VariableBinding indexType) Creates a new registry based on an index type. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addUsed
(IndexEntry entry) 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
compareTo
(IndexRegistryEntry other) protected void
duplicateAllocation
(IndexEntry entry) boolean
org.snmp4j.smi.OctetString
Gets the context.org.snmp4j.smi.VariableBinding
Gets the index type identifier.int
hashCode()
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
removeEntry
(IndexEntry entryKey) Remove an index value from the active index values.
-
Field Details
-
indexValues
Registry for active index values. -
usedValues
Registry for used (old) index values.
-
-
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
-
duplicateAllocation
-
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
- iftrue
, 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
, andAgentXProtocol.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
- iftrue
, 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
Remove an index value from the active index values.- Parameters:
entryKey
- the index value entry.- Returns:
true
if the removal was successful.
-
addUsed
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
- Specified by:
compareTo
in interfaceComparable<IndexRegistryEntry>
-
hashCode
public int hashCode() -
equals
-
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
- iftrue
, 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
- iftrue
, only test if allocation could be done, otherwise directly allocate the index.- Returns:
- the allocated index value.
-