Package org.snmp4j.smi

Examples of org.snmp4j.smi.OID


                     new OctetString("testReadView"),
                     new OctetString("testWriteView"),
                     new OctetString("testNotifyView"),
                     StorageType.nonVolatile);

      vacm.addViewTreeFamily(new OctetString("fullReadView"), new OID("1.3"),
                             new OctetString(), VacmMIB.vacmViewIncluded,
                             StorageType.nonVolatile);
      vacm.addViewTreeFamily(new OctetString("fullWriteView"), new OID("1.3"),
                             new OctetString(), VacmMIB.vacmViewIncluded,
                             StorageType.nonVolatile);
      vacm.addViewTreeFamily(new OctetString("fullNotifyView"), new OID("1.3"),
                             new OctetString(), VacmMIB.vacmViewIncluded,
                             StorageType.nonVolatile);
  }
View Full Code Here


  public boolean containsRow(OID index) {
    int i=0;
    for (Iterator it = table.rowIdIterator(tableOID); it.hasNext(); i++) {
      Object rowKey = it.next();
      OID rowIndex = table.mapToIndex(tableOID, rowKey, i);
      if (index.equals(rowIndex)) {
        return true;
      }
    }
    return false;
View Full Code Here

    }
    return null;
  }

  public MOTableRow firstRow() {
    OID firstIndex = firstIndex();
    if (firstIndex != null) {
      MOTableRow row = rowFactory.createRow(firstIndex, getInitialRowValues());
      table.getRow(tableOID, row);
      return row;
    }
View Full Code Here

   *
   * @return the <code>MOTableRow</code> with the greatest index or
   *   <code>null</code> if the model is empty.
   */
  public MOTableRow lastRow() {
    OID lastIndex = lastIndex();
    if (lastIndex != null) {
      MOTableRow row = rowFactory.createRow(lastIndex, getInitialRowValues());
      table.getRow(tableOID, row);
      return row;
    }
View Full Code Here

      return new JMXTableRowIterator(table.rowIdTailIterator(tableOID, rowId));
    }
    else {
      for (Iterator it = table.rowIdIterator(tableOID); it.hasNext(); i++) {
        Object key = it.next();
        OID index = table.mapToIndex(tableOID, key, i+1);
        if ((lowerBound == null) || (index.compareTo(lowerBound) >= 0)) {
          return new JMXTableRowIterator(it, key, i+1);
        }
      }
    }
    return null;
View Full Code Here

        nextKey = null;
      }
      if (key instanceof JMXArrayIndexKey) {
        nativeIndex = ((JMXArrayIndexKey)key).getIndex();
      }
      OID index = table.mapToIndex(tableOID, key, nativeIndex++);
      MOTableRow row = rowFactory.createRow(index, getInitialRowValues());
      int status = table.getRow(tableOID, row);
      if (status == SnmpConstants.SNMP_ERROR_SUCCESS) {
        return row;
      }
View Full Code Here

          return nativeRowId;
        }

        public OID mapToIndex(Object rowIdentifier) {
          Object[] key = (Object[])rowIdentifier;
          OID index = new OID(jvmMemManagerIndexSupport.mapToIndex(key[0]));
          index.append(jvmMemPoolIndexSupport.mapToIndex(key[1]));
          return index;
        }

        public Object mapToRowIdentifier(OID rowIndex) {
          if (rowIndex == null) {
           return null;
         }
         Object[] rowIdentifier = new Object[2];
         rowIdentifier[0] =
             jvmMemManagerIndexSupport.mapToRowIdentifier(
          new OID(rowIndex.toIntArray(), 0, 1));
         rowIdentifier[1] =
             jvmMemPoolIndexSupport.mapToRowIdentifier(
          new OID(rowIndex.toIntArray(), 1, 1));
         return rowIdentifier;
        }
      }
      ));


      ObjectName onameJvmThreading =
          new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME);

      tableSupport.add(super.oidJvmThreadInstanceEntry,
          new MBeanAttributeMOTableInfo(onameJvmThreading,
          new MBeanInvokationKeyProvider(onameJvmThreading,
                                         new TypedAttribute("AllThreadIds", long.class),
                                         "getThreadInfo", true),
          new TypedAttribute[] {
          new TypedCompositeDataAttribute(new TypedAttribute("threadId", Long.class)),
          new CombinedBitsType(new TypedAttribute[] {
                               new EnumBitsType("threadState", Thread.State.class, Thread.State.values(), 3),
                               new BooleanBitsType("inNative", 1),
                               new BooleanBitsType("suspended", 2)}),
          new TypedCompositeDataAttribute(new TypedAttribute("blockedCount", Long.class)),
          new TypedCompositeDataAttribute(new TypedAttribute("blockedTime", Long.class)),
          new TypedCompositeDataAttribute(new TypedAttribute("waitedCount", Long.class)),
          new TypedCompositeDataAttribute(new TypedAttribute("waitedTime", Long.class)),
          new MBeanProxyType(server, onameJvmThreading, Long.class,
                             "getThreadUserTime",
                             new TypedCompositeDataAttribute(new TypedAttribute("threadId", long.class))) {
            public Object transformFromNative(Object nativeValue, ObjectName objectName) {
              Long result = (Long) super.transformFromNative(nativeValue, objectName);
              if ((result == null) || (result.longValue() < 0)) {
                return 0L;
              }
              return result;
            }
          },
          new TypedCompositeDataAttribute(new TypedAttribute("threadName", String.class)),
          new TypedCompositeDataAttribute(new TypedAttribute("lockOwnerName", String.class)),
          new TypedCompositeDataAttribute(new TypedAttribute("lockOwnerId", Long.class)) {
            public Object transformFromNative(Object nativeValue, ObjectName objectName) {
              Long result = (Long)super.transformFromNative(nativeValue, objectName);
              if ((result == null) || (result.longValue() < 0)) {
                return "0.0";
              }
              OID rowPointer = new OID(JvmManagementMib.oidJvmThreadInstanceEntry);
              rowPointer.append(JvmManagementMib.colJvmThreadInstId);
              String index = Long.toHexString(result.longValue());
              OctetString os = new OctetString();
              os.fromHexString(index);
              rowPointer.append(os.toSubIndex(true));
              return rowPointer.toString();
            }
          }},
          new String[] { "ThreadId" },
          new JMXIndexSupport() {
        public ObjectName mapToRowMBean(Object rowIdentifier) {
View Full Code Here

    }
    Variable smiValue = (Variable) valueType.clone();
    SMIVariant smiVariant = new SMIVariant(smiValue);
    value = attribute.transformFromNative(value, null);
    smiVariant.setValue(value);
    OID oid = new OID(classID);
    if (index != null) {
      oid.append(index);
    }
    return new VariableBinding(oid, smiValue);
  }
View Full Code Here

  public void clear(MOTableRowFilter filter) {
    Iterator it = table.rowIdIterator(tableOID);
    List<OID> toRemove = new ArrayList<OID>();
    for (int i=0; it != null && it.hasNext(); i++) {
      Object rowID = it.next();
      OID index = table.mapToIndex(tableOID, rowID, i);
      MOTableRow row = getRow(index);
      if (filter.passesFilter(row)) {
        toRemove.add(index);
      }
    }
View Full Code Here

  public Object getRowIdentifier(Object nativeRowId, int nativeIndex) {
    return new JMXArrayIndexKey(nativeIndex);
  }

  public OID mapToIndex(Object rowIdentifier) {
    return new OID(new int[] { ((JMXArrayIndexKey)rowIdentifier).getIndex() });
  }
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.OID

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.