⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snmpnotificationmib.java

📁 你个snmp的源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*_############################################################################
  _##
  _##  SNMP4J-Agent - SnmpNotificationMIB.java
  _##
  _##  Copyright 2005-2006  Frank Fock (SNMP4J.org)
  _##
  _##  Licensed under the Apache License, Version 2.0 (the "License");
  _##  you may not use this file except in compliance with the License.
  _##  You may obtain a copy of the License at
  _##
  _##      http://www.apache.org/licenses/LICENSE-2.0
  _##
  _##  Unless required by applicable law or agreed to in writing, software
  _##  distributed under the License is distributed on an "AS IS" BASIS,
  _##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  _##  See the License for the specific language governing permissions and
  _##  limitations under the License.
  _##
  _##########################################################################*/


package org.snmp4j.agent.mo.snmp;

//--AgentGen BEGIN=_BEGIN
//--AgentGen END

import org.snmp4j.smi.*;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.agent.*;
import org.snmp4j.agent.mo.*;
import org.snmp4j.agent.mo.snmp.*;
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
import org.snmp4j.log.LogAdapter;
import org.snmp4j.log.LogFactory;

//--AgentGen BEGIN=_IMPORT
//--AgentGen END

public class SnmpNotificationMIB implements MOGroup {

  private static final LogAdapter logger =
      LogFactory.getLogger(SnmpNotificationMIB.class);

  // Constants

  private static final OID oidSnmpNotifyEntry =
    new OID(new int[] { 1,3,6,1,6,3,13,1,1,1 });

  // Column sub-identifer defintions for snmpNotifyEntry:
  private static final int colSnmpNotifyTag = 2;
  private static final int colSnmpNotifyType = 3;
  private static final int colSnmpNotifyStorageType = 4;
  private static final int colSnmpNotifyRowStatus = 5;

  // Column index defintions for snmpNotifyEntry:
  static final int idxSnmpNotifyTag = 0;
  static final int idxSnmpNotifyType = 1;
  static final int idxSnmpNotifyStorageType = 2;
  static final int idxSnmpNotifyRowStatus = 3;

  private static MOTableSubIndex[] snmpNotifyEntryIndexes =
    new MOTableSubIndex[] {
        new MOTableSubIndex(SMIConstants.SYNTAX_OCTET_STRING, 1, 32)
  };

  private static MOTableIndex snmpNotifyEntryIndex =
      new MOTableIndex(snmpNotifyEntryIndexes, true) {
    public boolean isValidIndex(OID index) {
      boolean isValidIndex = super.isValidIndex(index);
      if (isValidIndex) {
     //--AgentGen BEGIN=snmpNotifyEntry::isValidIndex
     //--AgentGen END
      }
      return isValidIndex;
    }
  };


  private DefaultMOTable             snmpNotifyEntry;
  private DefaultMOMutableTableModel snmpNotifyEntryModel;
  private static final OID oidSnmpNotifyFilterEntry =
    new OID(new int[] { 1,3,6,1,6,3,13,1,3,1 });

  // Column sub-identifer defintions for snmpNotifyFilterEntry:
  private static final int colSnmpNotifyFilterMask = 2;
  private static final int colSnmpNotifyFilterType = 3;
  private static final int colSnmpNotifyFilterStorageType = 4;
  private static final int colSnmpNotifyFilterRowStatus = 5;

  // Column index defintions for snmpNotifyFilterEntry:
  static final int idxSnmpNotifyFilterSubtree = 1;
  static final int idxSnmpNotifyFilterMask = 0;
  static final int idxSnmpNotifyFilterType = 1;
  static final int idxSnmpNotifyFilterStorageType = 2;
  static final int idxSnmpNotifyFilterRowStatus = 3;
  private static MOTableSubIndex[] snmpNotifyFilterEntryIndexes =
    new MOTableSubIndex[] {
        new MOTableSubIndex(SMIConstants.SYNTAX_OCTET_STRING, 1, 32),
        new MOTableSubIndex(SMIConstants.SYNTAX_OBJECT_IDENTIFIER, 0, 128)  };

  private static MOTableIndex snmpNotifyFilterEntryIndex =
      new MOTableIndex(snmpNotifyFilterEntryIndexes, true) {
    public boolean isValidIndex(OID index) {
      boolean isValidIndex = super.isValidIndex(index);
      if (isValidIndex) {
     //--AgentGen BEGIN=snmpNotifyFilterEntry::isValidIndex
     //--AgentGen END
      }
      return isValidIndex;
    }
  };


  private DefaultMOTable             snmpNotifyFilterEntry;
  private DefaultMOMutableTableModel snmpNotifyFilterEntryModel;
  private static final OID oidSnmpNotifyFilterProfileEntry =
    new OID(new int[] { 1,3,6,1,6,3,13,1,2,1 });

  // Column sub-identifer defintions for snmpNotifyFilterProfileEntry:
  private static final int colSnmpNotifyFilterProfileName = 1;
  private static final int colSnmpNotifyFilterProfileStorType = 2;
  private static final int colSnmpNotifyFilterProfileRowStatus = 3;

  // Column index defintions for snmpNotifyFilterProfileEntry:
  private static final int idxSnmpNotifyFilterProfileName = 0;
  private static final int idxSnmpNotifyFilterProfileStorType = 1;
  private static final int idxSnmpNotifyFilterProfileRowStatus = 2;
  private static MOTableSubIndex[] snmpNotifyFilterProfileEntryIndexes =
    new MOTableSubIndex[] {
        new MOTableSubIndex(SMIConstants.SYNTAX_OCTET_STRING, 1, 32)
  };

  private static MOTableIndex snmpNotifyFilterProfileEntryIndex =
      new MOTableIndex(snmpNotifyFilterProfileEntryIndexes, true) {
    public boolean isValidIndex(OID index) {
      boolean isValidIndex = super.isValidIndex(index);
      if (isValidIndex) {
     //--AgentGen BEGIN=snmpNotifyFilterProfileEntry::isValidIndex
     //--AgentGen END
      }
      return isValidIndex;
    }
  };


  private DefaultMOTable             snmpNotifyFilterProfileEntry;
  private DefaultMOMutableTableModel snmpNotifyFilterProfileEntryModel;

  public SnmpNotificationMIB() {
    createSnmpNotifyEntry();
    createSnmpNotifyFilterEntry();
    createSnmpNotifyFilterProfileEntry();
  }


  private void createSnmpNotifyEntry() {
    MOColumn[] snmpNotifyEntryColumns = new MOColumn[4];
    snmpNotifyEntryColumns[idxSnmpNotifyTag] =
      new SnmpTagValue(colSnmpNotifyTag,
                       MOAccessImpl.ACCESS_READ_CREATE,
                       new OctetString(new byte[] {  }),
                       true);
    snmpNotifyEntryColumns[idxSnmpNotifyType] =
      new Enumerated(colSnmpNotifyType,
                      MOAccessImpl.ACCESS_READ_CREATE,
                      new Integer32(1),
                      true,
                      new int[] {  1, 2 });
    snmpNotifyEntryColumns[idxSnmpNotifyStorageType] =
      new StorageType(colSnmpNotifyStorageType,
                      MOAccessImpl.ACCESS_READ_CREATE,
                      new Integer32(3),
                      true);
    snmpNotifyEntryColumns[idxSnmpNotifyRowStatus] =
      new RowStatus(colSnmpNotifyRowStatus);

    snmpNotifyEntry =
      new DefaultMOTable(oidSnmpNotifyEntry,
                         snmpNotifyEntryIndex,
                         snmpNotifyEntryColumns);
    snmpNotifyEntryModel = new DefaultMOMutableTableModel();
    snmpNotifyEntryModel.setRowFactory(new DefaultMOMutableRow2PCFactory());
    snmpNotifyEntry.setModel(snmpNotifyEntryModel);
  }

  private void createSnmpNotifyFilterEntry() {
    MOColumn[] snmpNotifyFilterEntryColumns = new MOColumn[4];
    snmpNotifyFilterEntryColumns[idxSnmpNotifyFilterMask] =
      new MOMutableColumn(colSnmpNotifyFilterMask,
                          SMIConstants.SYNTAX_OCTET_STRING,
                          MOAccessImpl.ACCESS_READ_CREATE,
                          new OctetString(new byte[] {  }),
                          true);
    ((MOMutableColumn)snmpNotifyFilterEntryColumns[idxSnmpNotifyFilterMask]).
      addMOValueValidationListener(new SnmpNotifyFilterMaskValidator());
    snmpNotifyFilterEntryColumns[idxSnmpNotifyFilterType] =
      new Enumerated(colSnmpNotifyFilterType,
                      MOAccessImpl.ACCESS_READ_CREATE,
                      new Integer32(1),
                      true,
                      new int[] {  1, 2 });
    snmpNotifyFilterEntryColumns[idxSnmpNotifyFilterStorageType] =
      new StorageType(colSnmpNotifyFilterStorageType,
                      MOAccessImpl.ACCESS_READ_CREATE,
                      new Integer32(3),
                      true);
    snmpNotifyFilterEntryColumns[idxSnmpNotifyFilterRowStatus] =
      new RowStatus(colSnmpNotifyFilterRowStatus);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -