本文整理汇总了Java中com.sun.jmx.snmp.SnmpStatusException.snmpRspNoAccess方法的典型用法代码示例。如果您正苦于以下问题:Java SnmpStatusException.snmpRspNoAccess方法的具体用法?Java SnmpStatusException.snmpRspNoAccess怎么用?Java SnmpStatusException.snmpRspNoAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.snmp.SnmpStatusException
的用法示例。
在下文中一共展示了SnmpStatusException.snmpRspNoAccess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNewEntry
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
示例2: findHandlingNode
import com.sun.jmx.snmp.SnmpStatusException; //导入方法依赖的package包/类
@Override
final synchronized void findHandlingNode(SnmpVarBind varbind,
long[] oid, int depth,
SnmpRequestTree handlers)
throws SnmpStatusException {
final int length = oid.length;
if (handlers == null)
throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
if (depth >= length)
throw new SnmpStatusException(SnmpStatusException.noAccess);
if (oid[depth] != nodeId)
throw new SnmpStatusException(SnmpStatusException.noAccess);
if (depth+2 >= length)
throw new SnmpStatusException(SnmpStatusException.noAccess);
// Checks that the oid is valid
// validateOid(oid,depth);
// Gets the part of the OID that identifies the entry
final SnmpOid entryoid = new SnmpEntryOid(oid, depth+2);
// Finds the entry: false means that the entry does not exists
final Object data = handlers.getUserData();
final boolean hasEntry = contains(entryoid, data);
// Fails if the entry is not found and the table does not
// not support creation.
// We know that the entry does not exists if (isentry == false).
if (!hasEntry) {
if (!handlers.isCreationAllowed()) {
// we're not doing a set
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
} else if (!isCreationEnabled())
// we're doing a set but creation is disabled.
throw new
SnmpStatusException(SnmpStatusException.snmpRspNoAccess);
}
final long var = oid[depth+1];
// Validate the entry id
if (hasEntry) {
// The entry already exists - validate the id
validateVarEntryId(entryoid,var,data);
}
// Registers this node for the identified entry.
//
if (handlers.isSetRequest() && isRowStatus(entryoid,var,data))
// We only try to identify the RowStatus for SET operations
//
handlers.add(this,depth,entryoid,varbind,(!hasEntry),varbind);
else
handlers.add(this,depth,entryoid,varbind,(!hasEntry));
}