0N/A/*
2362N/A * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.jmx.snmp.agent;
0N/A
0N/A// java imports
0N/A//
0N/Aimport java.io.Serializable;
0N/Aimport java.util.Hashtable;
0N/Aimport java.util.Enumeration;
0N/A
0N/A// jmx imports
0N/A//
0N/Aimport com.sun.jmx.snmp.SnmpValue;
0N/Aimport com.sun.jmx.snmp.SnmpVarBind;
0N/Aimport com.sun.jmx.snmp.SnmpStatusException;
0N/Aimport com.sun.jmx.snmp.agent.SnmpMibOid;
0N/Aimport com.sun.jmx.snmp.agent.SnmpMibNode;
0N/A
0N/A/**
0N/A * Represents a node in an SNMP MIB which corresponds to a table entry
0N/A * meta node.
0N/A * <P>
0N/A * This class is used by the class generated by <CODE>mibgen</CODE>.
0N/A * You should not need to use this class directly.
0N/A *
0N/A * <p><b>This API is a Sun Microsystems internal API and is subject
0N/A * to change without notice.</b></p>
0N/A */
0N/A
0N/Apublic abstract class SnmpMibEntry extends SnmpMibNode
0N/A implements Serializable {
0N/A
0N/A /**
0N/A * Tells whether the given arc identifies a variable (scalar object) in
0N/A * this entry.
0N/A *
0N/A * @param arc An OID arc.
0N/A *
0N/A * @return <CODE>true</CODE> if `arc' leads to a variable.
0N/A */
0N/A public abstract boolean isVariable(long arc);
0N/A
0N/A /**
0N/A * Tells whether the given arc identifies a readable scalar object in
0N/A * this entry.
0N/A *
0N/A * @param arc An OID arc.
0N/A *
0N/A * @return <CODE>true</CODE> if `arc' leads to a readable variable.
0N/A */
0N/A public abstract boolean isReadable(long arc);
0N/A
0N/A /**
0N/A * Get the next OID arc corresponding to a readable scalar variable.
0N/A *
0N/A */
0N/A public long getNextVarId(long id, Object userData)
0N/A throws SnmpStatusException {
0N/A long nextvar = super.getNextVarId(id,userData);
0N/A while (!isReadable(nextvar))
0N/A nextvar = super.getNextVarId(nextvar,userData);
0N/A return nextvar;
0N/A }
0N/A
0N/A /**
0N/A * Checks whether the given OID arc identifies a variable (columnar
0N/A * object).
0N/A *
0N/A * @param userData A contextual object containing user-data.
0N/A * This object is allocated through the <code>
0N/A * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}</code>
0N/A * for each incoming SNMP request.
0N/A *
0N/A * @exception If the given `arc' does not identify any variable in this
0N/A * group, throws an SnmpStatusException.
0N/A */
0N/A public void validateVarId(long arc, Object userData)
0N/A throws SnmpStatusException {
0N/A if (isVariable(arc) == false) throw noSuchNameException;
0N/A }
0N/A
0N/A /**
0N/A * Generic handling of the <CODE>get</CODE> operation.
0N/A * <p>The actual implementation of this method will be generated
0N/A * by mibgen. Usually, this implementation only delegates the
0N/A * job to some other provided runtime class, which knows how to
0N/A * access the MBean. The current toolkit thus provides two
0N/A * implementations:
0N/A * <ul><li>The standard implementation will directly access the
0N/A * MBean through a java reference,</li>
0N/A * <li>The generic implementation will access the MBean through
0N/A * the MBean server.</li>
0N/A * </ul>
0N/A * <p>Both implementations rely upon specific - and distinct, set of
0N/A * mibgen generated methods.
0N/A * <p> You can override this method if you need to implement some
0N/A * specific policies for minimizing the accesses made to some remote
0N/A * underlying resources.
0N/A * <p>
0N/A *
0N/A * @param req The sub-request that must be handled by this node.
0N/A *
0N/A * @param depth The depth reached in the OID tree.
0N/A *
0N/A * @exception SnmpStatusException An error occurred while accessing
0N/A * the MIB node.
0N/A */
0N/A abstract public void get(SnmpMibSubRequest req, int depth)
0N/A throws SnmpStatusException;
0N/A
0N/A /**
0N/A * Generic handling of the <CODE>set</CODE> operation.
0N/A * <p>The actual implementation of this method will be generated
0N/A * by mibgen. Usually, this implementation only delegates the
0N/A * job to some other provided runtime class, which knows how to
0N/A * access the MBean. The current toolkit thus provides two
0N/A * implementations:
0N/A * <ul><li>The standard implementation will directly access the
0N/A * MBean through a java reference,</li>
0N/A * <li>The generic implementation will access the MBean through
0N/A * the MBean server.</li>
0N/A * </ul>
0N/A * <p>Both implementations rely upon specific - and distinct, set of
0N/A * mibgen generated methods.
0N/A * <p> You can override this method if you need to implement some
0N/A * specific policies for minimizing the accesses made to some remote
0N/A * underlying resources.
0N/A * <p>
0N/A *
0N/A * @param req The sub-request that must be handled by this node.
0N/A *
0N/A * @param depth The depth reached in the OID tree.
0N/A *
0N/A * @exception SnmpStatusException An error occurred while accessing
0N/A * the MIB node.
0N/A */
0N/A abstract public void set(SnmpMibSubRequest req, int depth)
0N/A throws SnmpStatusException;
0N/A
0N/A /**
0N/A * Generic handling of the <CODE>check</CODE> operation.
0N/A *
0N/A * <p>The actual implementation of this method will be generated
0N/A * by mibgen. Usually, this implementation only delegates the
0N/A * job to some other provided runtime class, which knows how to
0N/A * access the MBean. The current toolkit thus provides two
0N/A * implementations:
0N/A * <ul><li>The standard implementation will directly access the
0N/A * MBean through a java reference,</li>
0N/A * <li>The generic implementation will access the MBean through
0N/A * the MBean server.</li>
0N/A * </ul>
0N/A * <p>Both implementations rely upon specific - and distinct, set of
0N/A * mibgen generated methods.
0N/A * <p> You can override this method if you need to implement some
0N/A * specific policies for minimizing the accesses made to some remote
0N/A * underlying resources, or if you need to implement some consistency
0N/A * checks between the different values provided in the varbind list.
0N/A * <p>
0N/A *
0N/A * @param req The sub-request that must be handled by this node.
0N/A *
0N/A * @param depth The depth reached in the OID tree.
0N/A *
0N/A * @exception SnmpStatusException An error occurred while accessing
0N/A * the MIB node.
0N/A */
0N/A abstract public void check(SnmpMibSubRequest req, int depth)
0N/A throws SnmpStatusException;
0N/A
0N/A}