Package org.snmp4j.agent.agentx

Examples of org.snmp4j.agent.agentx.AgentXPeer


//--AgentGen BEGIN=_METHODS
  public void masterChanged(AgentXMasterEvent event) {
    switch (event.getType()) {
      case AgentXMasterEvent.PEER_ADDED: {
        AgentXPeer changedPeer = (AgentXPeer) event.getChangedObject();
        Address addr = changedPeer.getAddress();
        AgentxConnectionEntryRow row = (AgentxConnectionEntryRow)
            agentxConnectionEntry.createRow(connIndexGenerator.getNextSubIndex());
        agentxConnectionEntry.addRow(row);
        row.setAgentxConnOpenTime(((TimeStampScalar)agentxConnTableLastChange).
                                  getSysUpTime().get());
        row.setAgentxConnTransportAddress(addrFactory.getAddress(addr));
        row.setAgentxConnTransportDomain(addrFactory.getTransportDomain(addr));
        changedPeer.setId(row.getIndex());
        break;
      }
      case AgentXMasterEvent.PEER_REMOVED: {
        AgentXPeer changedPeer = (AgentXPeer) event.getChangedObject();
        if (changedPeer != null) {
          OID index = (OID) changedPeer.getId();
          OID next = index.nextPeer();
          agentxConnectionEntry.removeRow(index);
          ((DefaultMOMutableTableModel) agentxSessionEntryModel).
              removeRows(index, next);
          ((DefaultMOMutableTableModel) agentxRegistrationEntryModel).
              removeRows(index, next);
        }
        break;
      }
      case AgentXMasterEvent.SESSION_ADDED: {
        AgentXMasterSession session =
            (AgentXMasterSession)event.getChangedObject();
        OID index = new OID((OID)session.getPeer().getId());
        index.append(session.getSessionID());
        AgentxSessionEntryRow row = (AgentxSessionEntryRow)
            agentxSessionEntry.createRow(index);
        row.setAgentxSessionAdminStatus(
            new Integer32(AgentxSessionAdminStatusEnum.up));
        row.setAgentxSessionAgentXVer(new Integer32(session.getAgentXVersion()));
        row.setAgentxSessionDescr(session.getDescr());
        row.setAgentxSessionObjectID(session.getOid());
        row.setAgentxSessionOpenTime(((TimeStampScalar)agentxSessionTableLastChange).
                                     getSysUpTime().get());
        row.setAgentxSessionTimeout(new Integer32(session.getTimeout() & 0xFF));
        row.setSession(session);
        agentxSessionEntry.addRow(row);
        break;
      }
      case AgentXMasterEvent.SESSION_REMOVED: {
        AgentXMasterSession session =
            (AgentXMasterSession)event.getChangedObject();
        OID index = new OID((OID)session.getPeer().getId());
        index.append(session.getSessionID());
        agentxSessionEntry.removeRow(index);
        break;
      }
      case AgentXMasterEvent.REGISTRATION_ADDED: {
        AgentXRegEntry entry = (AgentXRegEntry)event.getChangedObject();
        AgentXMasterSession session = entry.getSession();
        AgentXPeer peer = session.getPeer();
        if (peer.getId() == null) {
          LOGGER.error("Peer ID is null for peer "+peer+
                       ", cannot add registration "+
                       entry+" to AgentXMIB");
        }
        else {
          OID index = new OID((OID)peer.getId());
          index.append(session.getSessionID());
          index.append(regEntryIndexGenerator.getNextSubIndex());
          entry.setId(index);
          AgentxRegistrationEntryRow row = (AgentxRegistrationEntryRow)
              agentxRegistrationEntry.createRow(index);
View Full Code Here

TOP

Related Classes of org.snmp4j.agent.agentx.AgentXPeer

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.