本文整理汇总了Java中org.snmp4j.smi.VariableBinding.getVariable方法的典型用法代码示例。如果您正苦于以下问题:Java VariableBinding.getVariable方法的具体用法?Java VariableBinding.getVariable怎么用?Java VariableBinding.getVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.snmp4j.smi.VariableBinding
的用法示例。
在下文中一共展示了VariableBinding.getVariable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processResponse
import org.snmp4j.smi.VariableBinding; //导入方法依赖的package包/类
private void processResponse(PDU response) {
try {
if (log().isDebugEnabled()) {
log().debug("Received a tracker PDU of type "+PDU.getTypeString(response.getType())+" from "+getAddress()+" of size "+response.size()+", errorStatus = "+response.getErrorStatus()+", errorStatusText = "+response.getErrorStatusText()+", errorIndex = "+response.getErrorIndex());
}
if (response.getType() == PDU.REPORT) {
handleAuthError("A REPORT PDU was returned from the agent. This is most likely an authentication problem. Please check the config");
} else {
if (!processErrors(response.getErrorStatus(), response.getErrorIndex())) {
if (response.size() == 0) { // NMS-6484
handleError("A PDU with no errors and 0 varbinds was returned from the agent at " + getAddress() + ". This seems to be related with a broken SNMP agent.");
} else {
for (int i = 0; i < response.size(); i++) {
VariableBinding vb = response.get(i);
SnmpObjId receivedOid = SnmpObjId.get(vb.getOid().getValue());
SnmpValue val = new Snmp4JValue(vb.getVariable());
Snmp4JWalker.this.processResponse(receivedOid, val);
}
}
}
buildAndSendNextPdu();
}
} catch (Throwable e) {
handleFatalError(e);
}
}
示例2: splitBody
import org.snmp4j.smi.VariableBinding; //导入方法依赖的package包/类
/**
* The split body method returns something that is iteratable such as a java.util.List.
*
* @param body the payload of the incoming message
* @return a list containing each part splitted
*/
public List<VariableBinding> splitBody(Vector<? extends VariableBinding> body) {
List<VariableBinding> answer = new ArrayList<VariableBinding>();
for (VariableBinding var : body) {
OID oid = var.getOid();
Variable variable = var.getVariable();
LOG.debug("oid: {}, value: {}, syntax: {}",oid,variable.toLong(),variable.getSyntaxString());
answer.add(var);
}
return answer;
}
示例3: splitMessage
import org.snmp4j.smi.VariableBinding; //导入方法依赖的package包/类
/**
* The split message method returns something that is iteratable such as a java.util.List.
*
* @param body the payload of the incoming message
* @return a list containing each part splitted
*/
public List<VariableBinding> splitMessage(@Body Vector<? extends VariableBinding> body) {
List<VariableBinding> answer = new ArrayList<VariableBinding>();
for (VariableBinding var : body) {
OID oid = var.getOid();
Variable variable = var.getVariable();
LOG.debug("oid: {}, value: {}, syntax: {}",oid,variable.toLong(),variable.getSyntaxString());
answer.add(var);
}
return answer;
}
示例4: decode
import org.snmp4j.smi.VariableBinding; //导入方法依赖的package包/类
/**
* Decode a table event for a table, assuming the columns are as ordered in the
* call to {@link #getTable(String)}.
*
* @param tableName
* @param te
* @return
*/
public Map<String, Variable> decode(String tableName, TableEvent te) {
HashMap<String, Variable> hm = new HashMap<String, Variable>();
log.debug(te);
for (VariableBinding vb : te.getColumns()) {
String key = oids.get(vb.getOid());
Variable var = vb.getVariable();
hm.put(key, var);
}
return hm;
}
示例5: commit
import org.snmp4j.smi.VariableBinding; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void commit(final SubRequest request) {
final VariableBinding vb = request.getVariableBinding();
final Variable v = vb.getVariable();
m_vars.put(vb.getOid(), v);
final RequestStatus status = request.getStatus();
status.setPhaseComplete(true);
}
示例6: verify
import org.snmp4j.smi.VariableBinding; //导入方法依赖的package包/类
public void verify(VariableBinding vb) {
assertNotNull("variable binding should not be null", vb);
Variable val = vb.getVariable();
assertNotNull("variable should not be null", val);
assertEquals("OID (value: " + val + ")", new OID(m_expectedOid), vb.getOid());
assertEquals("syntax", m_expectedSyntax, vb.getSyntax());
assertEquals("value", m_expectedValue, val);
}
示例7: verify
import org.snmp4j.smi.VariableBinding; //导入方法依赖的package包/类
public void verify(VariableBinding vb) {
assertNotNull("variable binding should not be null", vb);
Variable val = vb.getVariable();
assertNotNull("variable should not be null", val);
assertEquals("OID (value: " + val + ")", new OID(m_expectedOid), vb.getOid());
assertEquals("syntax", m_expectedSyntax, vb.getSyntax());
assertEquals("value", m_expectedValue, val);
}