use of com.sun.jmx.snmp.SnmpOid in project jdk8u_jdk by JetBrains.
the class SnmpMibTable method set.
// ---------------------------------------------------------------------
//
// Implements the method defined in SnmpMibNode.
//
// ---------------------------------------------------------------------
/**
* Generic handling of the <CODE>set</CODE> operation.
* <p> The default implementation of this method is to
* call the generated
* <CODE>set(req,oid,depth+1)</CODE> method.
* <p>
* <pre>
* public void set(SnmpMibSubRequest req, int depth)
* throws SnmpStatusException {
* final SnmpOid oid = req.getEntryOid();
* final int action = getRowAction(req,oid,depth+1);
*
* set(req,oid,depth+1);
* endRowAction(req,oid,depth+1,action);
* }
* </pre>
* <p> You should not need to override this method in any cases, because
* it will eventually call
* <CODE>set(SnmpMibSubRequest req, int depth)</CODE> on the generated
* derivative of <CODE>SnmpMibEntry</CODE>. If you need to implement
* specific policies for minimizing the accesses made to some remote
* underlying resources, or if you need to implement some consistency
* checks between the different values provided in the varbind list,
* you should then rather override
* <CODE>set(SnmpMibSubRequest req, int depth)</CODE> on the generated
* derivative of <CODE>SnmpMibEntry</CODE>.
* <p>
*
*/
@Override
public void set(SnmpMibSubRequest req, int depth) throws SnmpStatusException {
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(), "set", "Entering set");
}
final SnmpOid oid = req.getEntryOid();
final int action = getRowAction(req, oid, depth + 1);
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(), "set", "Calling set for " + req.getSize() + " varbinds");
}
set(req, oid, depth + 1);
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(), "set", "Calling endRowAction");
}
endRowAction(req, oid, depth + 1, action);
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(), "set", "RowAction finished");
}
}
use of com.sun.jmx.snmp.SnmpOid in project jdk8u_jdk by JetBrains.
the class SnmpRequestTree method findOid.
//-------------------------------------------------------------------
// Search for the given oid in `oids'. If none is found, returns -1
// otherwise, returns the index at which the oid is located.
//-------------------------------------------------------------------
private static int findOid(SnmpOid[] oids, int count, SnmpOid oid) {
final int size = count;
int low = 0;
int max = size - 1;
int curr = low + (max - low) / 2;
//System.out.println("Try to retrieve: " + oid.toString());
while (low <= max) {
final SnmpOid pos = oids[curr];
//System.out.println("Compare with" + pos.toString());
// never know ...we might find something ...
//
final int comp = oid.compareTo(pos);
if (comp == 0)
return curr;
if (oid.equals(pos)) {
return curr;
}
if (comp > 0) {
low = curr + 1;
} else {
max = curr - 1;
}
curr = low + (max - low) / 2;
}
return -1;
}
use of com.sun.jmx.snmp.SnmpOid in project jdk8u_jdk by JetBrains.
the class JvmMemMgrPoolRelTableMetaImpl method getNextOid.
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg)
log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
//
if (dbg)
log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg)
log.debug("getNextOid", "next=" + next);
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
use of com.sun.jmx.snmp.SnmpOid in project jdk8u_jdk by JetBrains.
the class JvmRTClassPathTableMetaImpl method getNextOid.
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg)
log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
//
if (dbg)
log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg)
log.debug("*** **** **** **** getNextOid", "next=" + next);
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
use of com.sun.jmx.snmp.SnmpOid in project jdk8u_jdk by JetBrains.
the class JvmMemManagerTableMetaImpl method getNextOid.
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg)
log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
//
if (dbg)
log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg)
log.debug("getNextOid", "next=" + next);
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
Aggregations