当前位置: 首页>>代码示例>>Java>>正文


Java OID.size方法代码示例

本文整理汇总了Java中org.snmp4j.smi.OID.size方法的典型用法代码示例。如果您正苦于以下问题:Java OID.size方法的具体用法?Java OID.size怎么用?Java OID.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.snmp4j.smi.OID的用法示例。


在下文中一共展示了OID.size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkWalkFinished

import org.snmp4j.smi.OID; //导入方法依赖的package包/类
private static boolean checkWalkFinished(OID targetOID, PDU pdu, VariableBinding vb) {
    boolean finished = false;
    if (pdu.getErrorStatus() != 0) {
        finished = true;
    } else if (vb.getOid() == null) {
        finished = true;
    } else if (vb.getOid().size() < targetOID.size()) {
        finished = true;
    } else if (targetOID.leftMostCompare(targetOID.size(), vb.getOid()) != 0) {
        finished = true;
    } else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
        finished = true;
    } else if (vb.getOid().compareTo(targetOID) <= 0) {
        finished = true;
    }
    return finished;

}
 
开发者ID:DevopsJK,项目名称:SuitAgent,代码行数:19,代码来源:SNMPHelper.java

示例2: checkWalkFinished

import org.snmp4j.smi.OID; //导入方法依赖的package包/类
private static boolean checkWalkFinished(OID targetOID, PDU pdu,
    VariableBinding vb) {
  boolean finished = false;
  if (pdu.getErrorStatus() != 0) {
    System.out.println("[true] responsePDU.getErrorStatus() != 0 ");
    System.out.println(pdu.getErrorStatusText());
    finished = true;
  } else if (vb.getOid() == null) {
    System.out.println("[true] vb.getOid() == null");
    finished = true;
  } else if (vb.getOid().size() < targetOID.size()) {
    System.out.println("[true] vb.getOid().size() < targetOID.size()");
    finished = true;
  } else if (targetOID.leftMostCompare(targetOID.size(), vb.getOid()) != 0) {
    System.out.println("[true] targetOID.leftMostCompare() != 0");
    finished = true;
  } else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
    System.out
        .println("[true] Null.isExceptionSyntax(vb.getVariable().getSyntax())");
    finished = true;
  } else if (vb.getOid().compareTo(targetOID) <= 0) {
    System.out.println("[true] Variable received is not "
        + "lexicographic successor of requested " + "one:");
    System.out.println(vb.toString() + " <= " + targetOID);
    finished = true;
  }
  return finished;
 
}
 
开发者ID:waylau,项目名称:snmp4j-demos,代码行数:30,代码来源:SnmpData.java

示例3: checkWalkFinished

import org.snmp4j.smi.OID; //导入方法依赖的package包/类
private static boolean checkWalkFinished(OID walkOID, PDU pdu,
		VariableBinding vb) {
	boolean finished = false;
	if (pdu.getErrorStatus() != 0) {
		System.out.println("[true] pdu.getErrorStatus() != 0 ");
		System.out.println(pdu.getErrorStatusText());
		finished = true;
	} else if (vb.getOid() == null) {
		System.out.println("[true] vb.getOid() == null");
		finished = true;
	} else if (vb.getOid().size() < walkOID.size()) {
		System.out.println("[true] vb.getOid().size() < targetOID.size()");
		finished = true;
	} else if (walkOID.leftMostCompare(walkOID.size(), vb.getOid()) != 0) {
		System.out.println("[true] targetOID.leftMostCompare() != 0");
		finished = true;
	} else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
		System.out
				.println("[true] Null.isExceptionSyntax(vb.getVariable().getSyntax())");
		finished = true;
	} else if (vb.getOid().compareTo(walkOID) <= 0) {
		System.out.println("[true] vb.getOid().compareTo(walkOID) <= 0 ");
		finished = true;
	}
	return finished;

}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:28,代码来源:SnmpWalkMuliTAsyn.java

示例4: checkWalkFinished

import org.snmp4j.smi.OID; //导入方法依赖的package包/类
/**
 * 1)responsePDU == null<br>
 * 2)responsePDU.getErrorStatus() != 0<br>
 * 3)responsePDU.get(0).getOid() == null<br>
 * 4)responsePDU.get(0).getOid().size() < targetOID.size()<br>
 * 5)targetOID.leftMostCompare(targetOID.size(),responsePDU.get(0).getOid())
 * !=0<br>
 * 6)Null.isExceptionSyntax(responsePDU.get(0).getVariable().getSyntax())<br>
 * 7)responsePDU.get(0).getOid().compareTo(targetOID) <= 0<br>
 *
 * @param targetOID
 * @param pdu
 * @param vb
 * @return
 */
private static boolean checkWalkFinished(OID targetOID, PDU pdu,
		VariableBinding vb) {
	boolean finished = false;
	if (pdu.getErrorStatus() != 0) {
		System.out.println("[true] responsePDU.getErrorStatus() != 0 ");
		System.out.println(pdu.getErrorStatusText());
		finished = true;
	} else if (vb.getOid() == null) {
		System.out.println("[true] vb.getOid() == null");
		finished = true;
	} else if (vb.getOid().size() < targetOID.size()) {
		System.out.println("[true] vb.getOid().size() < targetOID.size()");
		finished = true;
	} else if (targetOID.leftMostCompare(targetOID.size(), vb.getOid()) != 0) {
		System.out.println("[true] targetOID.leftMostCompare() != 0");
		finished = true;
	} else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
		System.out
				.println("[true] Null.isExceptionSyntax(vb.getVariable().getSyntax())");
		finished = true;
	} else if (vb.getOid().compareTo(targetOID) <= 0) {
		System.out.println("[true] Variable received is not "
				+ "lexicographic successor of requested " + "one:");
		System.out.println(vb.toString() + " <= " + targetOID);
		finished = true;
	}
	return finished;

}
 
开发者ID:micmiu,项目名称:snmp-tutorial,代码行数:45,代码来源:SnmpWalk.java

示例5: toName

import org.snmp4j.smi.OID; //导入方法依赖的package包/类
/**
 * Inverse operation of {@link #toOid(String)}.
 * Returns the exact matching name part suffixed with the remainder OID.
 */
public String toName(OID oid) {
    if (oid == null)
        throw new NullPointerException("value");
    String name = this.oids.get(oid);
    if (name != null)
        return name;
    Entry<OID, String> lowerEntry = this.oids.lowerEntry(oid);
    if (lowerEntry != null && oid.startsWith(lowerEntry.getKey())) {
        OID parent = lowerEntry.getKey();
        OID suffix = new OID(oid.getValue(), parent.size(), oid.size() - parent.size());
        return lowerEntry.getValue() + "." + suffix;
    }
    return oid.toString();
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:19,代码来源:MibIndex.java

示例6: walk

import org.snmp4j.smi.OID; //导入方法依赖的package包/类
public static List<VariableBinding> walk(Target target, OID oid) {
    List<VariableBinding> ret = new ArrayList<VariableBinding>();

    PDU requestPDU = new PDU();
    requestPDU.add(new VariableBinding(oid));
    requestPDU.setType(PDU.GETNEXT);
    boolean finished = false;
    try{
        while (!finished) {
            VariableBinding vb = null;

            ResponseEvent respEvt = snmp.send(requestPDU, target);
            PDU responsePDU = respEvt.getResponse();
            if (responsePDU != null) {
                vb = responsePDU.get(0);
            }

            if (responsePDU == null) {
                finished = true;
            } else if (responsePDU.getErrorStatus() != 0) {
                finished = true;
            } else if (vb.getOid() == null) {
                finished = true;
            } else if (vb.getOid().size() < oid.size()) {
                finished = true;
            } else if (oid.leftMostCompare(oid.size(), vb.getOid()) != 0) {
                finished = true;
            } else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
                finished = true;
            } else if (vb.getOid().compareTo(oid) <= 0) {
                finished = true;
            } else {
                ret.add(vb);

                // Set up the variable binding for the next entry.
                requestPDU.setRequestID(new Integer32(0));
                requestPDU.set(0, vb);
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return ret;
}
 
开发者ID:PRTG,项目名称:JMXMiniProbe,代码行数:45,代码来源:SNMPUtil.java

示例7: matches

import org.snmp4j.smi.OID; //导入方法依赖的package包/类
/**
 * Returns {@code true} if this wildcard {@code OID} matches with the specified {@code OID}.
 * <p/>
 * Here some examples for matching {@code OID}s:
 * <ul>
 * <li>{@code .1.3.3.*.7} and {@code .1.3.3.7}</li>
 * <li>{@code .1.3.3.*.7} and {@code .1.3.3.3.7}</li>
 * <li>{@code .1.3.3.*.7} and {@code .1.3.3.1.2.3.4.5.7}</li>
 * </ul>
 *
 * @param oid the {@code OID} to test
 * @return {@code true} if the {@code OID}s are matching, otherwise {@code false}
 */
public boolean matches(final OID oid) {
    return oid.startsWith(startsWith) && (endsWith == null || oid.size() >= endsWith.size() && oid.rightMostCompare(endsWith.size(), endsWith) == 0);
}
 
开发者ID:1and1,项目名称:snmpman,代码行数:17,代码来源:WildcardOID.java


注:本文中的org.snmp4j.smi.OID.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。