本文整理了Java中org.snmp4j.smi.OID.startsWith()
方法的一些代码示例,展示了OID.startsWith()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OID.startsWith()
方法的具体详情如下:
包路径:org.snmp4j.smi.OID
类名称:OID
方法名:startsWith
[英]Check if the OID starts with the given OID.
[中]检查OID是否以给定OID开头。
代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core
public boolean belongsToTables(OID oid) {
for (OID attributeOID : tables) {
if (oid.startsWith(attributeOID)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.jboss.jbossas/jboss-snmp
public boolean belongsToTables(OID oid) {
for (OID attributeOID : tables) {
if (oid.startsWith(attributeOID)) {
return true;
}
}
return false;
}
代码示例来源:origin: com.rogueai/snmp2bean
protected boolean isTableEnd(OID firstReqOid, OID firstRespOid) {
// TODO: END OF MIB
return !firstRespOid.startsWith(firstReqOid);
}
代码示例来源:origin: com.rogueai/snmp2bean
protected VariableBinding findVariableBindingByOid(OID oid, Vector<?> variableBindings) {
for (Iterator<?> it = variableBindings.iterator(); it.hasNext();) {
VariableBinding vb = (VariableBinding) it.next();
if (vb.getOid().startsWith(oid)) {
return vb;
}
}
return null;
}
代码示例来源:origin: com.rogueai/snmp2bean
protected Variable findVariableByOid(OID oid, Vector<?> variableBindings) {
for (Iterator<?> it = variableBindings.iterator(); it.hasNext();) {
VariableBinding vb = (VariableBinding) it.next();
if (vb.getOid().startsWith(oid)) {
return vb.getVariable();
}
}
return null;
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public U find(OID prefix) {
for (Iterator<U> it = iterator(); it.hasNext(); ) {
U sreq = it.next();
if (sreq.getVariableBinding().getOid().startsWith(prefix)) {
return sreq;
}
}
return null;
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public SubRequest find(OID prefix) {
for (Iterator it = iterator(); it.hasNext(); ) {
SubRequest sreq = (SubRequest) it.next();
if (sreq.getVariableBinding().getOid().startsWith(prefix)) {
return sreq;
}
}
return null;
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public void snmpTlstmServerCertificateUnknown(NotificationOriginator notificationOriginator,
OctetString context, VariableBinding[] vbs) {
if (vbs.length < 1) {
throw new IllegalArgumentException("Too few notification objects: " +
vbs.length + "<1");
}
if (!(vbs[0].getOid().startsWith(oidTrapVarSnmpTlstmSessionUnknownServerCertificate))) {
throw new IllegalArgumentException("Variable 0 has wrong OID: " + vbs[0].getOid() +
" does not start with " + oidTrapVarSnmpTlstmSessionUnknownServerCertificate);
}
notificationOriginator.notify(context, oidSnmpTlstmServerCertificateUnknown, vbs);
}
// Named traps:
代码示例来源:origin: com.github.kaitoy.sneo/sneo-core
public List<VariableBinding> walk(OID oid, int count) {
List<VariableBinding> varbinds = new ArrayList<VariableBinding>();
OID nextTarget = oid;
for (int i = 0; i < count; i++) {
VariableBinding vb = next(nextTarget);
if (vb == null || !vb.getOid().startsWith(oid)) {
return varbinds;
}
varbinds.add(vb);
nextTarget = vb.getOid();
}
return varbinds;
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
private static boolean isInSubtree(OID oid, OID subtree, OctetString mask) {
OID maskedSubtree = subtree.mask(mask);
OID maskedOID = oid.mask(mask);
if (maskedOID.equals(maskedSubtree)) {
return true;
}
return maskedOID.startsWith(maskedSubtree);
}
代码示例来源:origin: org.kaazing/snmp4j-agent
private static boolean isInSubtree(OID oid, OID subtree, OctetString mask) {
OID maskedSubtree = subtree.mask(mask);
OID maskedOID = oid.mask(mask);
if (maskedOID.equals(maskedSubtree)) {
return true;
}
return maskedOID.startsWith(maskedSubtree);
}
代码示例来源:origin: OpenNMS/opennms
/**
* @param oid
* @return
*/
public VariableBinding get(OID oid) {
for (OID agentKey : m_subAgents.keySet()) {
if (oid.startsWith(agentKey)) {
SubAgent subAgent = m_subAgents.get(agentKey);
return subAgent.get(oid);
}
}
return null;
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public boolean isCovered(MOScope other) {
return (other.getLowerBound().startsWith(oid) &&
(other.getLowerBound().size() > oid.size() ||
other.isLowerIncluded())) &&
(other.getUpperBound().startsWith(oid) &&
((other.getUpperBound().size() > oid.size()) ||
other.isUpperIncluded()));
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public final OID getIndexPart(OID anyOID) {
int offset = oid.size()+1;
if ((anyOID.size() <= offset) || (!anyOID.startsWith(oid))) {
return null;
}
return new OID(anyOID.getValue(), offset, anyOID.size() - offset);
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public CellInfo(OID oid) {
this.index = getIndexPart(oid);
if ((oid.size() > DefaultMOTable.this.oid.size()) &&
(oid.startsWith(DefaultMOTable.this.oid))) {
id = oid.get(DefaultMOTable.this.oid.size());
}
/*
else {
id = columns[0].getColumnID();
}
*/
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public final OID getIndexPart(OID anyOID) {
int offset = oid.size() + 1;
if ((anyOID.size() <= offset) || (!anyOID.startsWith(oid))) {
return null;
}
return new OID(anyOID.getValue(), offset, anyOID.size() - offset);
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public CellInfo(DefaultMOTable table, OID oid) {
this.table = table;
this.index = table.getIndexPart(oid);
if ((oid.size() > table.oid.size()) &&
(oid.startsWith(table.oid))) {
id = oid.get(table.oid.size());
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
@Override
public boolean isCovered(MOScope other) {
return (other.getLowerBound().startsWith(oid) &&
(other.getLowerBound().size() > oid.size() ||
other.isLowerIncluded())) &&
(other.getUpperBound().startsWith(oid) &&
((other.getUpperBound().size() > oid.size()) ||
other.isUpperIncluded()));
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public void incrementCounter(CounterEvent event) {
if ((event.getOid().startsWith(usmStatsPrefix)) &&
(event.getOid().size() > usmStatsPrefix.size())) {
Counter32 current = (Counter32)
usmStats[event.getOid().get(usmStatsPrefix.size())-1].getValue();
current.increment();
event.setCurrentValue((Counter32)current.clone());
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public void incrementCounter(CounterEvent event) {
if ((event.getOid().startsWith(usmStatsPrefix)) &&
(event.getOid().size() > usmStatsPrefix.size())) {
Counter32 current = (Counter32)
usmStats[event.getOid().get(usmStatsPrefix.size())-1].getValue();
current.increment();
event.setCurrentValue((Counter32)current.clone());
}
}
内容来源于网络,如有侵权,请联系作者删除!