com.sun.jmx.snmp.SnmpOid

Here are the examples of the java api com.sun.jmx.snmp.SnmpOid taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

109 Examples 7

19 Source : SnmpTableSupport.java
with MIT License
from wupeixuan

/**
 * Add an entry in this table.
 *
 * This method registers an entry in the table and performs
 * synchronization with the replacedociated table metadata object.
 *
 * @param index The SnmpIndex built from the given entry.
 * @param name  The ObjectName with which this entry will be registered.
 * @param entry The entry that should be added in the table.
 *
 * @exception SnmpStatusException if the entry cannot be registered with
 *            the given index.
 */
protected void addEntry(SnmpIndex index, ObjectName name, Object entry) throws SnmpStatusException {
    SnmpOid oid = buildOidFromIndex(index);
    meta.addEntry(oid, name, entry);
}

19 Source : SnmpTableSupport.java
with MIT License
from wupeixuan

/**
 * Add an entry in this table.
 *
 * This method registers an entry in the table and perform
 * synchronization with the replacedociated table metadata object.
 *
 * This method replacedumes that the given entry will not be registered,
 * or will be registered with its default ObjectName built from the
 * replacedociated  SnmpIndex.
 * <p>
 * If the entry is going to be registered, then
 * {@link com.sun.jmx.snmp.agent.SnmpTableSupport#addEntry(SnmpIndex, ObjectName, Object)} should be preferred.
 * <br> This function is mainly provided for backward compatibility.
 *
 * @param index The SnmpIndex built from the given entry.
 * @param entry The entry that should be added in the table.
 *
 * @exception SnmpStatusException if the entry cannot be registered with
 *            the given index.
 */
protected void addEntry(SnmpIndex index, Object entry) throws SnmpStatusException {
    SnmpOid oid = buildOidFromIndex(index);
    ObjectName name = null;
    if (isRegistrationRequired()) {
        name = buildNameFromIndex(index);
    }
    meta.addEntry(oid, name, entry);
}

19 Source : SnmpTableSupport.java
with MIT License
from wupeixuan

/**
 * This callback is called by  the replacedociated metadata object
 * when a new table entry has been removed from the
 * table metadata.
 *
 * This method will update the <code>entries</code> list.
 *
 * @param pos   The position from which the entry was deleted
 * @param row   The row OID of the deleted entry
 * @param name  The ObjectName of the deleted entry (may be null if
 *              ObjectName's were not required)
 * @param entry The deleted entry (may be null if only ObjectName's
 *              were required)
 * @param meta  The table metadata object.
 */
public void removeEntryCb(int pos, SnmpOid row, ObjectName name, Object entry, SnmpMibTable meta) throws SnmpStatusException {
    try {
        if (entries != null)
            entries.remove(pos);
    } catch (Exception e) {
    }
}

19 Source : SnmpTableSupport.java
with MIT License
from wupeixuan

/**
 * Remove an entry from this table.
 *
 * This method unregisters an entry from the table and performs
 * synchronization with the replacedociated table metadata object.
 *
 * @param index The SnmpIndex identifying the entry.
 * @param entry The entry that should be removed in the table. This
 *              parameter is optional and can be omitted if it doesn't
 *              need to be preplaceded along to the
 *              <code>removeEntryCb()</code> callback defined in the
 *              {@link com.sun.jmx.snmp.agent.SnmpTableCallbackHandler}
 *              interface.
 *
 * @exception SnmpStatusException if the entry cannot be unregistered.
 */
protected void removeEntry(SnmpIndex index, Object entry) throws SnmpStatusException {
    SnmpOid oid = buildOidFromIndex(index);
    meta.removeEntry(oid, entry);
}

19 Source : SnmpTableSupport.java
with MIT License
from wupeixuan

// -----------------------------------------------------------------
// 
// Implementation of the SnmpTableEntryFactory interface
// 
// -----------------------------------------------------------------
/**
 * This callback is called by  the replacedociated metadata object
 * when a new table entry has been registered in the
 * table metadata.
 *
 * This method will update the <code>entries</code> list.
 *
 * @param pos   The position at which the new entry was inserted
 *              in the table.
 * @param row   The row OID of the new entry
 * @param name  The ObjectName of the new entry (as specified by the
 *              factory)
 * @param entry The new entry (as returned by the factory)
 * @param meta  The table metadata object.
 */
public void addEntryCb(int pos, SnmpOid row, ObjectName name, Object entry, SnmpMibTable meta) throws SnmpStatusException {
    try {
        if (entries != null)
            entries.add(pos, entry);
    } catch (Exception e) {
        throw new SnmpStatusException(SnmpStatusException.noSuchName);
    }
}

19 Source : SnmpRequestTree.java
with MIT License
from wupeixuan

// -------------------------------------------------------------------
// Returns the subrequest replacedociated with the entry identified by
// the given entry (only for tables)
// -------------------------------------------------------------------
SnmpMibSubRequest getSubRequest(Handler handler, SnmpOid oid) {
    if (handler == null)
        return null;
    final int pos = handler.getEntryPos(oid);
    if (pos == -1)
        return null;
    return new SnmpMibSubRequestImpl(request, handler.getEntrySubList(pos), handler.getEntryOid(pos), handler.isNewEntry(pos), getnextflag, handler.getRowStatusVarBind(pos));
}

19 Source : SnmpRequestTree.java
with MIT License
from wupeixuan

// -------------------------------------------------------------------
// Return the index at which the given oid should be inserted in the
// `oids' array.
// -------------------------------------------------------------------
private static int getInsertionPoint(SnmpOid[] oids, int count, SnmpOid oid) {
    final SnmpOid[] localoids = oids;
    final int size = count;
    int low = 0;
    int max = size - 1;
    int curr = low + (max - low) / 2;
    while (low <= max) {
        final SnmpOid pos = localoids[curr];
        // never know ...we might find something ...
        // 
        final int comp = oid.compareTo(pos);
        // In the calling method we will have to check for this case...
        // if (comp == 0)
        // return -1;
        // Returning curr instead of -1 avoids having to call
        // findOid() first and getInsertionPoint() afterwards.
        // We can simply call getInsertionPoint() and then checks whether
        // there's an OID at the returned position which equals the
        // given OID.
        if (comp == 0)
            return curr;
        if (comp > 0) {
            low = curr + 1;
        } else {
            max = curr - 1;
        }
        curr = low + (max - low) / 2;
    }
    return curr;
}

19 Source : SnmpMibAgent.java
with MIT License
from wupeixuan

/**
 * Sets the reference to the SNMP protocol adaptor through which the MIB
 * will be SNMP accessible and add this new MIB in the SNMP MIB handler
 * replacedociated to the specified <CODE>name</CODE>.
 * This method is to be called to set a specific agent to a specific OID. This can be useful when dealing with MIB overlapping.
 * Some OID can be implemented in more than one MIB. In this case, the OID nearer agent will be used on SNMP operations.
 * @param name The name of the SNMP protocol adaptor.
 * @param oids The set of OIDs this agent implements.
 * @exception InstanceNotFoundException The SNMP protocol adaptor does
 *     not exist in the MBean server.
 *
 * @exception ServiceNotFoundException This SNMP MIB is not registered
 *     in the MBean server or the requested service is not supported.
 *
 * @since 1.5
 */
@Override
public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids) throws InstanceNotFoundException, ServiceNotFoundException {
    if (server == null) {
        throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
    }
    // First remove the reference on the old adaptor server.
    // 
    if (adaptor != null) {
        adaptor.removeMib(this);
    }
    // Then update the reference to the new adaptor server.
    // 
    Object[] params = { this, oids };
    String[] signature = { "com.sun.jmx.snmp.agent.SnmpMibAgent", oids.getClreplaced().getName() };
    try {
        adaptor = (SnmpMibHandler) (server.invoke(name, "addMib", params, signature));
    } catch (InstanceNotFoundException e) {
        throw new InstanceNotFoundException(name.toString());
    } catch (ReflectionException e) {
        throw new ServiceNotFoundException(name.toString());
    } catch (MBeanException e) {
    // Should never occur...
    }
    adaptorName = name;
}

19 Source : SnmpMibAgent.java
with MIT License
from wupeixuan

/**
 * Sets the reference to the SNMP protocol adaptor through which the MIB
 * will be SNMP accessible and add this new MIB in the SNMP MIB handler.
 * This method is to be called to set a specific agent to a specific OID. This can be useful when dealing with MIB overlapping.
 * Some OID can be implemented in more than one MIB. In this case, the OID nearest the agent will be used on SNMP operations.
 * @param stack The SNMP MIB handler.
 * @param oids The set of OIDs this agent implements.
 *
 * @since 1.5
 */
@Override
public void setSnmpAdaptor(SnmpMibHandler stack, SnmpOid[] oids) {
    if (adaptor != null) {
        adaptor.removeMib(this);
    }
    adaptor = stack;
    if (adaptor != null) {
        adaptor.addMib(this, oids);
    }
}

19 Source : SnmpMibAgent.java
with MIT License
from wupeixuan

/**
 * Sets the reference to the SNMP protocol adaptor through which the MIB
 * will be SNMP accessible and adds this new MIB in the SNMP MIB handler.
 * Adds a new contextualized MIB in the SNMP MIB handler.
 *
 * @param stack The SNMP MIB handler.
 * @param contextName The MIB context name. If null is preplaceded, will be registered in the default context.
 * @param oids The set of OIDs this agent implements.
 * @exception IllegalArgumentException If the parameter is null.
 *
 * @since 1.5
 */
@Override
public void setSnmpAdaptor(SnmpMibHandler stack, String contextName, SnmpOid[] oids) {
    if (adaptor != null) {
        adaptor.removeMib(this, contextName);
    }
    adaptor = stack;
    if (adaptor != null) {
        adaptor.addMib(this, contextName, oids);
    }
}

19 Source : SnmpMibAgent.java
with MIT License
from wupeixuan

/**
 * Sets the reference to the SNMP protocol adaptor through which the MIB
 * will be SNMP accessible and add this new MIB in the SNMP MIB handler
 * replacedociated to the specified <CODE>name</CODE>.
 *
 * @param name The name of the SNMP protocol adaptor.
 * @param contextName The MIB context name. If null is preplaceded, will be registered in the default context.
 * @param oids The set of OIDs this agent implements.
 * @exception InstanceNotFoundException The SNMP protocol adaptor does
 *     not exist in the MBean server.
 *
 * @exception ServiceNotFoundException This SNMP MIB is not registered
 *     in the MBean server or the requested service is not supported.
 *
 * @since 1.5
 */
@Override
public void setSnmpAdaptorName(ObjectName name, String contextName, SnmpOid[] oids) throws InstanceNotFoundException, ServiceNotFoundException {
    if (server == null) {
        throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
    }
    // First remove the reference on the old adaptor server.
    // 
    if (adaptor != null) {
        adaptor.removeMib(this, contextName);
    }
    // Then update the reference to the new adaptor server.
    // 
    Object[] params = { this, contextName, oids };
    String[] signature = { "com.sun.jmx.snmp.agent.SnmpMibAgent", "java.lang.String", oids.getClreplaced().getName() };
    try {
        adaptor = (SnmpMibHandler) (server.invoke(name, "addMib", params, signature));
    } catch (InstanceNotFoundException e) {
        throw new InstanceNotFoundException(name.toString());
    } catch (ReflectionException e) {
        throw new ServiceNotFoundException(name.toString());
    } catch (MBeanException e) {
    // Should never occur...
    }
    adaptorName = name;
}

19 Source : SnmpNamedListTableCache.java
with GNU General Public License v2.0
from Tencent

/**
 * Find a new index for the entry corresponding to the
 * given <var>item</var>.
 * <br>This method is called by {@link #getIndex(Object,List,int,Object)}
 * when a new index needs to be allocated for an <var>item</var>. The
 * index returned must not be already in used.
 * @param context The context preplaceded to
 *        {@link #updateCachedDatas(Object,List)}.
 * @param rawDatas Raw table datas preplaceded to
 *        {@link #updateCachedDatas(Object,List)}.
 * @param rank Rank of the given <var>item</var> in the
 *        <var>rawDatas</var> list iterator.
 * @param item The raw data object for which an index must be determined.
 */
protected SnmpOid makeIndex(Object context, List<?> rawDatas, int rank, Object item) {
    // check we are in the limits of an unsigned32.
    if (++last > 0x00000000FFFFFFFFL) {
        // we just wrapped.
        log.debug("makeIndex", "Index wrapping...");
        last = 0;
        wrapped = true;
    }
    // If we never wrapped, we can safely return last as new index.
    if (!wrapped)
        return new SnmpOid(last);
    // We wrapped. We must look for an unused index.
    for (int i = 1; i < 0x00000000FFFFFFFFL; i++) {
        if (++last > 0x00000000FFFFFFFFL)
            last = 1;
        final SnmpOid testOid = new SnmpOid(last);
        // Was this index already in use?
        if (names == null)
            return testOid;
        if (names.containsValue(testOid))
            continue;
        // Have we just used it in a previous iteration?
        if (context == null)
            return testOid;
        if (((Map) context).containsValue(testOid))
            continue;
        // Ok, not in use.
        return testOid;
    }
    // all indexes are in use! we're stuck.
    // // throw new IndexOutOfBoundsException("No index available.");
    // better to return null and log an error.
    return null;
}

19 Source : SnmpLoadedClassData.java
with GNU General Public License v2.0
from Tencent

// SnmpTableHandler.contains()
public final boolean contains(SnmpOid index) {
    int pos = 0;
    try {
        pos = (int) index.getOidArc(0);
    } catch (SnmpStatusException e) {
        return false;
    }
    return (pos < datas.length);
}

19 Source : SnmpLoadedClassData.java
with GNU General Public License v2.0
from Tencent

// SnmpTableHandler.getNext()
public final SnmpOid getNext(SnmpOid index) {
    int pos = 0;
    if (index == null) {
        if ((datas != null) && (datas.length >= 1))
            return new SnmpOid(0);
    }
    try {
        pos = (int) index.getOidArc(0);
    } catch (SnmpStatusException e) {
        return null;
    }
    if (pos < (datas.length - 1))
        return new SnmpOid(pos + 1);
    else
        return null;
}

19 Source : SnmpLoadedClassData.java
with GNU General Public License v2.0
from Tencent

// SnmpTableHandler.getData()
public final Object getData(SnmpOid index) {
    int pos = 0;
    try {
        pos = (int) index.getOidArc(0);
    } catch (SnmpStatusException e) {
        return null;
    }
    if (pos >= datas.length)
        return null;
    return datas[pos];
}

19 Source : SnmpCachedData.java
with GNU General Public License v2.0
from Tencent

/**
 * This clreplaced is used to cache table data.
 */
public clreplaced SnmpCachedData implements SnmpTableHandler {

    /**
     * Compares two SnmpOid.
     */
    public static final Comparator<SnmpOid> oidComparator = new Comparator<SnmpOid>() {

        public int compare(SnmpOid o1, SnmpOid o2) {
            return o1.compareTo(o2);
        }

        public boolean equals(Object o1, Object o2) {
            if (o1 == o2)
                return true;
            else
                return o1.equals(o2);
        }
    };

    /**
     * Constructs a new instance of SnmpCachedData. Instances are
     * immutable.
     * @param lastUpdated Time stamp as returned by
     *        {@link System#currentTimeMillis System.currentTimeMillis()}
     * @param indexes The table entry indexes, sorted in ascending order.
     * @param datas   The table datas, sorted according to the
     *                order in <code>indexes</code>: <code>datas[i]</code>
     *                is the data that corresponds to
     *                <code>indexes[i]</code>
     */
    public SnmpCachedData(long lastUpdated, SnmpOid[] indexes, Object[] datas) {
        this.lastUpdated = lastUpdated;
        this.indexes = indexes;
        this.datas = datas;
    }

    /**
     * Constructs a new instance of SnmpCachedData. Instances are
     * immutable.
     * @param lastUpdated Time stamp as returned by
     *        {@link System#currentTimeMillis System.currentTimeMillis()}
     * @param indexMap The table indexed table data, sorted in ascending
     *                 order by {@link #oidComparator}. The keys must be
     *                 instances of {@link SnmpOid}.
     */
    public SnmpCachedData(long lastUpdated, TreeMap<SnmpOid, Object> indexMap) {
        this(lastUpdated, indexMap, true);
    }

    /**
     * Constructs a new instance of SnmpCachedData. Instances are
     * immutable.
     * @param lastUpdated Time stamp as returned by
     *        {@link System#currentTimeMillis System.currentTimeMillis()}
     * @param indexMap The table indexed table data, sorted in ascending
     *                 order by {@link #oidComparator}. The keys must be
     *                 instances of {@link SnmpOid}.
     */
    public SnmpCachedData(long lastUpdated, TreeMap<SnmpOid, Object> indexMap, boolean b) {
        final int size = indexMap.size();
        this.lastUpdated = lastUpdated;
        this.indexes = new SnmpOid[size];
        this.datas = new Object[size];
        if (b) {
            indexMap.keySet().toArray(this.indexes);
            indexMap.values().toArray(this.datas);
        } else
            indexMap.values().toArray(this.datas);
    }

    /**
     * Time stamp as returned by
     * {@link System#currentTimeMillis System.currentTimeMillis()}
     */
    public final long lastUpdated;

    /**
     * The table entry indexes, sorted in ascending order.
     */
    public final SnmpOid[] indexes;

    /**
     * The table datas, sorted according to the
     * order in <code>indexes</code>: <code>datas[i]</code>
     * is the data that corresponds to <code>indexes[i]</code>
     */
    public final Object[] datas;

    /**
     * The position of the given <var>index</var>, as returned by
     * <code>java.util.Arrays.binarySearch()</code>
     */
    public final int find(SnmpOid index) {
        return Arrays.binarySearch(indexes, index, oidComparator);
    }

    // SnmpTableHandler.getData()
    public Object getData(SnmpOid index) {
        final int pos = find(index);
        if ((pos < 0) || (pos >= datas.length))
            return null;
        return datas[pos];
    }

    // SnmpTableHandler.getNext()
    public SnmpOid getNext(SnmpOid index) {
        if (index == null) {
            if (indexes.length > 0)
                return indexes[0];
            else
                return null;
        }
        final int pos = find(index);
        if (pos > -1) {
            if (pos < (indexes.length - 1))
                return indexes[pos + 1];
            else
                return null;
        }
        final int insertion = -pos - 1;
        if ((insertion > -1) && (insertion < indexes.length))
            return indexes[insertion];
        else
            return null;
    }

    // SnmpTableHandler.contains()
    public boolean contains(SnmpOid index) {
        final int pos = find(index);
        return ((pos > -1) && (pos < indexes.length));
    }
}

19 Source : SnmpCachedData.java
with GNU General Public License v2.0
from Tencent

// SnmpTableHandler.getData()
public Object getData(SnmpOid index) {
    final int pos = find(index);
    if ((pos < 0) || (pos >= datas.length))
        return null;
    return datas[pos];
}

19 Source : SnmpCachedData.java
with GNU General Public License v2.0
from Tencent

// SnmpTableHandler.contains()
public boolean contains(SnmpOid index) {
    final int pos = find(index);
    return ((pos > -1) && (pos < indexes.length));
}

19 Source : SnmpCachedData.java
with GNU General Public License v2.0
from Tencent

/**
 * The position of the given <var>index</var>, as returned by
 * <code>java.util.Arrays.binarySearch()</code>
 */
public final int find(SnmpOid index) {
    return Arrays.binarySearch(indexes, index, oidComparator);
}

19 Source : SnmpCachedData.java
with GNU General Public License v2.0
from Tencent

// SnmpTableHandler.getNext()
public SnmpOid getNext(SnmpOid index) {
    if (index == null) {
        if (indexes.length > 0)
            return indexes[0];
        else
            return null;
    }
    final int pos = find(index);
    if (pos > -1) {
        if (pos < (indexes.length - 1))
            return indexes[pos + 1];
        else
            return null;
    }
    final int insertion = -pos - 1;
    if ((insertion > -1) && (insertion < indexes.length))
        return indexes[insertion];
    else
        return null;
}

19 Source : JvmThreadInstanceTableMeta.java
with GNU General Public License v2.0
from Tencent

/**
 * check that the given "var" identifies a columnar object.
 */
public void validateVarEntryId(SnmpOid rowOid, long var, Object data) throws SnmpStatusException {
    node.validateVarId(var, data);
}

19 Source : JvmThreadInstanceTableMeta.java
with GNU General Public License v2.0
from Tencent

/**
 * Returns true if "var" identifies a readable scalar object.
 */
public boolean isReadableEntryId(SnmpOid rowOid, long var, Object data) throws SnmpStatusException {
    return node.isReadable(var);
}

19 Source : JvmThreadInstanceTableMeta.java
with GNU General Public License v2.0
from Tencent

/**
 * Returns the arc of the next columnar object following "var".
 */
public long getNextVarEntryId(SnmpOid rowOid, long var, Object data) throws SnmpStatusException {
    long nextvar = node.getNextVarId(var, data);
    while (!isReadableEntryId(rowOid, nextvar, data)) nextvar = node.getNextVarId(nextvar, data);
    return nextvar;
}

19 Source : JvmThreadInstanceTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmThreadInstanceEntryMBean entry = (JvmThreadInstanceEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmThreadInstanceTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmThreadInstanceEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmThreadInstanceTable" + "\" must implement the \"" + "JvmThreadInstanceEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmRTLibraryPathTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmRTLibraryPathTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmRTLibraryPathEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmRTLibraryPathTable" + "\" must implement the \"" + "JvmRTLibraryPathEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmRTInputArgsTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmRTInputArgsTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmRTInputArgsEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmRTInputArgsTable" + "\" must implement the \"" + "JvmRTInputArgsEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmRTClassPathTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmRTClreplacedPathEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmRTClreplacedPathTable" + "\" must implement the \"" + "JvmRTClreplacedPathEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmRTClassPathTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmRTClreplacedPathEntryMBean entry = (JvmRTClreplacedPathEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmRTBootClassPathTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmRTBootClreplacedPathEntryMBean entry = (JvmRTBootClreplacedPathEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmRTBootClassPathTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmRTBootClreplacedPathEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmRTBootClreplacedPathTable" + "\" must implement the \"" + "JvmRTBootClreplacedPathEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmMemPoolTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmMemPoolTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmMemPoolEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmMemPoolTable" + "\" must implement the \"" + "JvmMemPoolEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmMemMgrPoolRelTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmMemMgrPoolRelEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmMemMgrPoolRelTable" + "\" must implement the \"" + "JvmMemMgrPoolRelEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmMemMgrPoolRelTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmMemMgrPoolRelEntryMBean entry = (JvmMemMgrPoolRelEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmMemManagerTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmMemManagerEntryMBean entry = (JvmMemManagerEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmMemManagerTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmMemManagerEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmMemManagerTable" + "\" must implement the \"" + "JvmMemManagerEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmMemGCTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public boolean skipEntryVariable(SnmpOid rowOid, long var, Object data, int pduVersion) {
    try {
        JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) getEntry(rowOid);
        synchronized (this) {
            node.setInstance(entry);
            return node.skipVariable(var, data, pduVersion);
        }
    } catch (SnmpStatusException x) {
        return false;
    }
}

19 Source : JvmMemGCTableMeta.java
with GNU General Public License v2.0
from Tencent

// ------------------------------------------------------------
// 
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
// 
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname, Object entry) throws SnmpStatusException {
    if (!(entry instanceof JvmMemGCEntryMBean))
        throw new ClreplacedCastException("Entries for Table \"" + "JvmMemGCTable" + "\" must implement the \"" + "JvmMemGCEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}

19 Source : JvmThreadInstanceTableMetaImpl.java
with GNU General Public License v2.0
from Tencent

private ThreadInfo getThreadInfo(SnmpOid oid) {
    return getThreadInfo(makeId(oid));
}

19 Source : JvmThreadInstanceTableMetaImpl.java
with GNU General Public License v2.0
from Tencent

/**
 * Translate an Oid to a thread id. Arc follow the long big-endian order.
 * @param oid The oid to make the id from
 * @return The thread id.
 */
static long makeId(SnmpOid oid) {
    long id = 0;
    long[] arcs = oid.longValue(false);
    id |= arcs[0] << 56;
    id |= arcs[1] << 48;
    id |= arcs[2] << 40;
    id |= arcs[3] << 32;
    id |= arcs[4] << 24;
    id |= arcs[5] << 16;
    id |= arcs[6] << 8;
    id |= arcs[7];
    return id;
}

19 Source : JvmThreadInstanceEntryImpl.java
with GNU General Public License v2.0
from Tencent

/**
 * Getter for the "JvmThreadInstLockedOwnerId" variable.
 */
public String getJvmThreadInstLockOwnerPtr() throws SnmpStatusException {
    long id = info.getLockOwnerId();
    if (id == -1)
        return new String("0.0");
    SnmpOid oid = JvmThreadInstanceTableMetaImpl.makeOid(id);
    return getJvmThreadInstIndexOid() + "." + oid.toString();
}

18 Source : SnmpMibTree.java
with MIT License
from wupeixuan

public void unregister(SnmpMibAgent agent, SnmpOid[] oids) {
    for (int i = 0; i < oids.length; i++) {
        long[] oid = oids[i].longValue();
        TreeNode node = root.retrieveMatchingBranch(oid, 0);
        if (node == null)
            continue;
        node.removeAgent(agent);
    }
}

18 Source : SnmpMibTree.java
with MIT License
from wupeixuan

public SnmpMibAgent getAgentMib(SnmpOid oid) {
    TreeNode node = root.retrieveMatchingBranch(oid.longValue(), 0);
    if (node == null)
        return defaultAgent;
    else if (node.getAgentMib() == null)
        return defaultAgent;
    else
        return node.getAgentMib();
}

18 Source : SnmpTableSupport.java
with MIT License
from wupeixuan

/**
 * Builds an entry SnmpIndex from its row OID.
 *
 * This method is generated by mibgen and used internally.
 *
 * @param rowOid The SnmpOid object identifying a table entry.
 *
 * @return The SnmpIndex of the entry identified by <code>rowOid</code>.
 *
 * @exception SnmpStatusException if the index cannot be built from the
 *            given OID.
 */
public SnmpIndex buildSnmpIndex(SnmpOid rowOid) throws SnmpStatusException {
    return buildSnmpIndex(rowOid.longValue(false), 0);
}

18 Source : SnmpRequestTree.java
with MIT License
from wupeixuan

// -------------------------------------------------------------------
// adds an entry varbind to a handler node sublist - specifying the
// varbind which holds the row status
// -------------------------------------------------------------------
public void add(SnmpMibNode meta, int depth, SnmpOid entryoid, SnmpVarBind varbind, boolean isnew, SnmpVarBind statusvb) throws SnmpStatusException {
    registerNode(meta, depth, entryoid, varbind, isnew, statusvb);
}

18 Source : SnmpRequestTree.java
with MIT License
from wupeixuan

// -------------------------------------------------------------------
// 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;
}

18 Source : SnmpRequestTree.java
with MIT License
from wupeixuan

// -------------------------------------------------------------------
// adds an entry varbind to a handler node sublist
// -------------------------------------------------------------------
public void add(SnmpMibNode meta, int depth, SnmpOid entryoid, SnmpVarBind varbind, boolean isnew) throws SnmpStatusException {
    registerNode(meta, depth, entryoid, varbind, isnew, null);
}

See More Examples