Package org.snmp4j.agent.agentx.master.index.AgentXIndexRegistry

Examples of org.snmp4j.agent.agentx.master.index.AgentXIndexRegistry.IndexRegistryEntry


      vb.getVariable().toSubIndex(true);
    }
    catch (UnsupportedOperationException ex) {
      return AgentXProtocol.AGENTX_INDEX_WRONG_TYPE;
    }
    IndexRegistryEntry newEntry = new IndexRegistryEntry(context, vb);
    IndexRegistryEntry oldEntry = (IndexRegistryEntry) indexes.get(newEntry);
    if (oldEntry == null) {
      if (!testOnly) {
        int status = newEntry.allocate(sessionID, vb.getVariable(), testOnly);
        if (status == AgentXProtocol.AGENTX_SUCCESS) {
          indexes.put(newEntry, newEntry);
        }
        return status;
      }
      return AgentXProtocol.AGENTX_SUCCESS;
    }
    else {
      return oldEntry.allocate(sessionID, vb.getVariable(), testOnly);
    }
  }
View Full Code Here


  }

  public int release(int sessionID,
                     OctetString context, VariableBinding vb,
                     boolean testOnly) {
    IndexRegistryEntry newEntry = new IndexRegistryEntry(context, vb);
    IndexRegistryEntry entry = (IndexRegistryEntry) indexes.get(newEntry);
    if (entry == null) {
      return AgentXProtocol.AGENTX_INDEX_NOT_ALLOCATED;
    }
    else {
      if (entry.getIndexType().getSyntax() != vb.getSyntax()) {
        return AgentXProtocol.AGENTX_INDEX_NOT_ALLOCATED;
      }
      return entry.release(sessionID, vb.getVariable(), testOnly);
    }
  }
View Full Code Here

  }

  public void release(int sessionID) {
    synchronized (indexes) {
      for (Iterator it = indexes.values().iterator(); it.hasNext(); ) {
        IndexRegistryEntry entry = (IndexRegistryEntry) it.next();
        entry.release(sessionID);
      }
    }
  }
View Full Code Here

  }

  public int newIndex(int sessionID,
                      OctetString context, VariableBinding vb,
                      boolean testOnly) {
    IndexRegistryEntry newEntry = new IndexRegistryEntry(context, vb);
    IndexRegistryEntry entry = (IndexRegistryEntry) indexes.get(newEntry);
    if (entry == null) {
      entry = new IndexRegistryEntry(context, vb);
    }
    Variable v = entry.newIndex(sessionID, testOnly);
    if (v == null) {
      return AgentXProtocol.AGENTX_INDEX_NONE_AVAILABLE;
    }
    else if (!testOnly) {
      vb.setVariable(v);
View Full Code Here

  }

  public int anyIndex(int sessionID,
                      OctetString context, VariableBinding vb,
                      boolean testOnly) {
    IndexRegistryEntry newEntry = new IndexRegistryEntry(context, vb);
    IndexRegistryEntry entry = (IndexRegistryEntry) indexes.get(newEntry);
    boolean newEntryCreated = false;
    if (entry == null) {
      entry = new IndexRegistryEntry(context, vb);
      newEntryCreated = true;
    }
    Variable v = entry.anyIndex(sessionID, testOnly);
    if (v == null) {
      return AgentXProtocol.AGENTX_INDEX_NONE_AVAILABLE;
    }
    else if (!testOnly) {
      vb.setVariable(v);
View Full Code Here

        }
      }
    }

    public int compareTo(Object o) {
      IndexRegistryEntry other = (IndexRegistryEntry)o;
      int c = context.compareTo(other.context);
      if (c == 0) {
        c = indexType.getOid().compareTo(other.indexType.getOid());
      }
      return c;
View Full Code Here

TOP

Related Classes of org.snmp4j.agent.agentx.master.index.AgentXIndexRegistry.IndexRegistryEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.