/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// java imports
//
// jmx imports
//
/**
* Represents a node in an SNMP MIB which is neither a group nor a variable.
* This class defines a list of sub-nodes and the methods that allow to
* manipulate the sub-nodes.
* <P>
* This class is used internally and by the class generated by
* <CODE>mibgen</CODE>.
* You should not need to use this class directly.
*
* <p><b>This API is a Sun Microsystems internal API and is subject
* to change without notice.</b></p>
*/
/**
* Default constructor.
*/
public SnmpMibOid() {
}
// PUBLIC METHODS
//---------------
/**
* Generic handling of the <CODE>get</CODE> operation.
*
* <p> This method should be overridden in subclasses.
* <p>
*
* @param req The sub-request that must be handled by this node.
*
* @param depth The depth reached in the OID tree.
*
* @exception SnmpStatusException The default implementation (if not
* overridden) is to generate a SnmpStatusException.
*/
throws SnmpStatusException {
}
}
/**
* Generic handling of the <CODE>set</CODE> operation.
*
* <p> This method should be overridden in subclasses.
* <p>
*
* @param req The sub-request that must be handled by this node.
*
* @param depth The depth reached in the OID tree.
*
* @exception SnmpStatusException The default implementation (if not
* overridden) is to generate a SnmpStatusException.
*/
throws SnmpStatusException {
}
}
/**
* Generic handling of the <CODE>check</CODE> operation.
*
* <p> This method should be overridden in subclasses.
* <p>
*
* @param req The sub-request that must be handled by this node.
*
* @param depth The depth reached in the OID tree.
*
* @exception SnmpStatusException The default implementation (if not
* overriden) is to generate a SnmpStatusException.
*/
throws SnmpStatusException {
}
}
// ---------------------------------------------------------------------
//
// Implements the method defined in SnmpMibNode.
//
// ---------------------------------------------------------------------
//
throws SnmpStatusException {
// Nothing is left... the oid is not valid
throw noSuchObjectException;
// The oid is not complete...
throw noSuchInstanceException;
} else {
// Some children variable or subobject is being querried
// getChild() will raise an exception if no child is found.
//
// XXXX zzzz : what about null children?
// (variables for nested groups)
// if child==null, then we're dealing with a variable or
// a table: we register this node.
// This behaviour should be overriden in subclasses,
// in particular in group meta classes: the group
// meta classes that hold tables should take care
// of forwarding this call to all the tables involved.
//
else
}
}
// ---------------------------------------------------------------------
//
// Implements the method defined in SnmpMibNode.
//
// ---------------------------------------------------------------------
//
throws SnmpStatusException {
// This should be considered as a genErr, but we do not want to
// abort the whole request, so we're going to throw
// a noSuchObject...
//
throw noSuchObjectException;
long[] newOid= new long[1];
checker);
return result;
}
// search the element specified in the oid
//
long[] newOid= new long[1];
while (true) {
try {
// SnmpOid result = null;
// shouldn't happen
throw noSuchObjectException;
// validateVarId(index);
// handlers.add(this,varbind,depth);
// result = new SnmpOid(0);
} else {
try {
checker);
} finally {
}
}
// Build up the leaf OID
return result;
} catch(SnmpStatusException e) {
// If there is no such element go one level up ...
//
// There is no need to carry the original oid ...
pos= 1;
}
}
}
/**
* Computes the root OID of the MIB.
*/
// If a node has several children, let assume that we are one step to
// far in order to get the MIB root.
//
if (nbChildren != 1)
return;
// Now query our child.
//
}
/**
* Registers a specific node in the tree.
*/
throws IllegalAccessException {
}
// PROTECTED METHODS
//------------------
/**
* Registers a specific node in the tree.
*/
throws IllegalAccessException {
throw new IllegalAccessException();
// Check if the node is already defined
//
//System.out.println("entering registration for val="
// + String.valueOf(var) + " position= " + cursor);
if (pos == nbChildren) {
nbChildren++;
varList= new int[nbChildren];
pos =0;
// That 's the end of the trip.
// Do not forward the registration
//System.out.println("End of trip for val="
// + String.valueOf(var) + " position= " + cursor);
return;
}
//System.out.println("Create node for val="
// + String.valueOf(var) + " position= " + cursor);
return;
}
if (pos == -1) {
// The node is not yet registered
//
nbChildren++;
// That 's the end of the trip.
// Do not forward the registration
//System.out.println("End of trip for val="
// + String.valueOf(var) + " position= " + cursor);
return;
}
// System.out.println("Create node for val=" +
// String.valueOf(var) + " position= " + cursor);
return;
}
else {
// The node is already registered
//
//System.out.println("Node already registered val=" +
// String.valueOf(var) + " position= " + cursor);
// Now we're going to patch the tree the following way:
// if a subgroup has been registered before its father,
// we're going to replace the father OID node with
// the actual group-node and export the children from
// the temporary OID node to the actual group node.
//
if (node instanceof SnmpMibGroup) {
// `node' is a group => replace `child' with `node'
// export the child's subtree to `node'.
//
return;
} else if ((node instanceof SnmpMibOid) &&
(child instanceof SnmpMibGroup)) {
// `node' is a temporary node, and `child' is a
// group => keep child and export the node's
// subtree to `child'.
//
return;
} else if (node instanceof SnmpMibOid) {
// `node' and `child' are both temporary OID nodes
// => replace `child' with `node' and export child's
// subtree to `node'.
//
return;
}
}
return;
} else {
throw new IllegalAccessException();
}
}
}
/**
* Export this node's children to a brother node that will replace
* this node in the OID tree.
* This method is a patch that fixes the problem of registering
* a subnode before its father node.
*
**/
throws IllegalAccessException {
final long[] oid = new long[1];
for (int i=0; i<nbChildren; i++) {
}
}
// PRIVATE METHODS
//----------------
// first we need to retrieve the identifier in the list of children
//
if (pos >= nbChildren)
throw noSuchObjectException;
throw noSuchObjectException;
// Access the node
//
try {
} catch(ArrayIndexOutOfBoundsException e) {
throw noSuchObjectException;
}
throw noSuchInstanceException;
return child;
}
int low= 0;
return nbChildren;
int elmt= 0;
// We need to get the next index ...
//
return curr;
}
} else {
}
}
return -1;
}
int low= 0;
return -1;
int elmt=0;
//final int[] v = varList;
//if (index > a[max])
//return max +1;
// never know ...we might find something ...
//
return curr;
} else {
}
}
return curr;
}
// PRIVATE VARIABLES
//------------------
/**
* Contains the list of sub nodes.
*/
/**
* The number of sub nodes.
*/
// All the methods of the Vector class are synchronized.
// Synchronization is a very expensive operation. In our case it is
// not always required...
//
super(size);
}
}
return (E) elementData[index];
}
}
}