2362N/A * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 * 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 * 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. 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 0N/A * This list is used in order to construct the OID during the getnext. 0N/A * The constructed oid is checked by the checker AcmChecker. 0N/A * The list content. Any access to this variable must be protected 0N/A * by a synchronized block on the LongList object. 0N/A * Only read-only action should be performed on this object. 0N/A * Same behaviour than size() in {@link java.util.List}. 0N/A * Same behaviour than add(long o) in {@link java.util.List}. 0N/A * Any access to this method should be protected in a synchronized 0N/A * block on the LongList object. 0N/A public final boolean add(
final long o) {
0N/A * Same behaviour than add(int index, long o) in 0N/A * {@link java.util.List}. 0N/A * Any access to this method should be protected in a synchronized 0N/A * block on the LongList object. 0N/A * Adds <var>count</var> elements to the list. 0N/A * @param at index at which the elements must be inserted. The 0N/A * first element will be inserted at this index. 0N/A * @param src An array containing the elements we want to insert. 0N/A * @param from Index of the first element from <var>src</var> that 0N/A * @param count number of elements to insert. 0N/A * Any access to this method should be protected in a synchronized 0N/A * block on the LongList object. 0N/A * Any access to this method should be protected in a synchronized 0N/A * block on the LongList object. 0N/A * Same behaviour than remove(int index) in {@link java.util.List}. 0N/A * Any access to this method should be protected in a synchronized 0N/A * block on the LongList object. 0N/A * Same behaviour than the toArray(long[] a) method in 0N/A * {@link java.util.List}. 0N/A * Any access to this method should be protected in a synchronized 0N/A * block on the LongList object. 0N/A * Same behaviour than the toArray() method in 0N/A * {@link java.util.List}. 0N/A * Any access to this method should be protected in a synchronized 0N/A * block on the LongList object. 0N/A * Resize the list. Increase its capacity by DELTA elements. 0N/A * Any call to this method must be protected by a synchronized 0N/A * block on this LongList. 0N/A * Resize the list. Insure that the new length will be at 0N/A * least equal to <var>length</var>. 0N/A * @param length new minimal length requested. 0N/A * Any call to this method must be protected by a synchronized 0N/A * block on this LongList. 0N/A * Allocate a new array of object of specified length. 0N/A * Oid Checker makes use of ACM to check each OID during the getnext process. 0N/A //We are in V3 architecture, ACM is in the picture. 0N/A "AcmChecker(SnmpMibRequest)",
0N/A "SNMP V3 Access Control to be done");
0N/A "AcmChecker(SnmpMibRequest)",
0N/A "Unknown Model, no ACM check.");
0N/A "checkCurrentOid",
"Checking access for : " +
oid);
0N/A * Abstract class for representing an SNMP MIB. 0N/A * When compiling a SNMP MIB, among all the classes generated by 0N/A * <CODE>mibgen</CODE>, there is one which extends <CODE>SnmpMib</CODE> 0N/A * for representing a whole MIB. 0N/A * <BR>The class is used by the SNMP protocol adaptor as the entry point in 0N/A * <p>This generated class can be subclassed in your code in order to 0N/A * plug in your own specific behaviour. 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 * Default constructor. 0N/A * Initializes the OID tree. 0N/A // -------------------------------------------------------------------- 0N/A // POLYMORHIC METHODS 0N/A // -------------------------------------------------------------------- 0N/A * This callback should return the OID associated to the group 0N/A * identified by the given <code>groupName</code>. 0N/A * This method is provided as a hook to plug-in some custom 0N/A * specific behavior. Although doing so is discouraged you might 0N/A * want to subclass this method in order to store & provide more metadata 0N/A * information (mapping OID <-> symbolic name) within the agent, 0N/A * or to "change" the root of the MIB OID by prefixing the 0N/A * defaultOid by an application dependant OID string, for instance. 0N/A * The default implementation of this method is to return the given 0N/A * <code>defaultOid</code> 0N/A * @param groupName The java-ized name of the SNMP group. 0N/A * @param defaultOid The OID defined in the MIB for that group 0N/A * (in dot notation). 0N/A * @return The OID of the group identified by <code>groupName</code>, 0N/A * This callback should return the ObjectName associated to the 0N/A * group identified by the given <code>groupName</code>. 0N/A * This method is provided as a hook to plug-in some custom 0N/A * specific behavior. You might want to override this method 0N/A * in order to provide a different object naming scheme than 0N/A * that proposed by default by <code>mibgen</code>. 0N/A * This method is only meaningful if the MIB is registered 0N/A * in the MBeanServer, otherwise, it will not be called. 0N/A * The default implementation of this method is to return an ObjectName 0N/A * built from the given <code>defaultName</code>. 0N/A * @param name The java-ized name of the SNMP group. 0N/A * @param oid The OID returned by getGroupOid() - in dot notation. 0N/A * @param defaultName The name by default generated by <code> 0N/A * @return The ObjectName of the group identified by <code>name</code> 0N/A * Register an SNMP group and its metadata node in the MIB. 0N/A * This method is provided as a hook to plug-in some custom 0N/A * specific behavior. You might want to override this method 0N/A * if you want to set special links between the MBean, its metadata 0N/A * node, its OID or ObjectName etc.. 0N/A * If the MIB is not registered in the MBeanServer, the <code> 0N/A * server</code> and <code>groupObjName</code> parameters will be 0N/A * <code>null</code>.<br> 0N/A * If the given group MBean is not <code>null</code>, and if the 0N/A * <code>server</code> and <code>groupObjName</code> parameters are 0N/A * not null, then this method will also automatically register the 0N/A * group MBean with the given MBeanServer <code>server</code>. 0N/A * @param groupName The java-ized name of the SNMP group. 0N/A * @param groupOid The OID as returned by getGroupOid() - in dot 0N/A * @param groupObjName The ObjectName as returned by getGroupObjectName(). 0N/A * This parameter may be <code>null</code> if the 0N/A * MIB is not registered in the MBeanServer. 0N/A * @param node The metadata node, as returned by the metadata 0N/A * factory method for this group. 0N/A * @param group The MBean for this group, as returned by the 0N/A * MBean factory method for this group. 0N/A * @param server The MBeanServer in which the groups are to be 0N/A * registered. This parameter will be <code>null</code> 0N/A * if the MIB is not registered, otherwise it is a 0N/A * reference to the MBeanServer in which the MIB is 0N/A * Register an SNMP Table metadata node in the MIB. 0N/A * This method is used internally and you should never need to 0N/A * call it directly.</i></b><br> It is used to establish the link 0N/A * between an SNMP table metadata node and its bean-like counterpart. 0N/A * The group metadata nodes will create and register their 0N/A * underlying table metadata nodes in the MIB using this 0N/A * The metadata nodes will be later retrieved from the MIB by the 0N/A * bean-like table objects using the getRegisterTableMeta() method. 0N/A * @param name The java-ized name of the SNMP table. 0N/A * @param table The SNMP table metadata node - usually this 0N/A * corresponds to a <code>mibgen</code> generated 0N/A * Returns a registered SNMP Table metadata node. 0N/A * This method is used internally and you should never need to 0N/A // -------------------------------------------------------------------- 0N/A // -------------------------------------------------------------------- 0N/A * Processes a <CODE>get</CODE> operation. 0N/A // Implements the method defined in SnmpMibAgent. See SnmpMibAgent 0N/A // Builds the request tree: creation is not allowed, operation 0N/A "get",
"Processing handlers for GET... ");
0N/A // For each sub-request stored in the request-tree, invoke the 0N/A // Gets the Meta node. It can be either a Group Meta or a 0N/A // Gets the depth of the Meta node in the OID tree 0N/A // Invoke the get() operation. 0N/A * Processes a <CODE>set</CODE> operation. 0N/A // Implements the method defined in SnmpMibAgent. See SnmpMibAgent 0N/A // Optimization: we're going to get the whole SnmpRequestTree 0N/A // built in the "check" method, so that we don't have to rebuild 0N/A // Optimization didn't work: we have to rebuild the tree. 0N/A // Builds the request tree: creation is not allowed, operation 0N/A "set",
"Processing handlers for SET... ");
0N/A // For each sub-request stored in the request-tree, invoke the 0N/A // Gets the Meta node. It can be either a Group Meta or a 0N/A // Gets the depth of the Meta node in the OID tree 0N/A // Invoke the set() operation 0N/A * Checks if a <CODE>set</CODE> operation can be performed. 0N/A * If the operation cannot be performed, the method will raise a 0N/A * <CODE>SnmpStatusException</CODE>. 0N/A // Implements the method defined in SnmpMibAgent. See SnmpMibAgent 0N/A // Builds the request tree: creation is allowed, operation 0N/A "check",
"Processing handlers for CHECK... ");
0N/A // For each sub-request stored in the request-tree, invoke the 0N/A // Gets the Meta node. It can be either a Group Meta or a 0N/A // Gets the depth of the Meta node in the OID tree 0N/A // Invoke the check() operation 0N/A // Optimization: we're going to pass the whole SnmpRequestTree 0N/A // to the "set" method, so that we don't have to rebuild it there. 0N/A * Processes a <CODE>getNext</CODE> operation. 0N/A // Implements the method defined in SnmpMibAgent. See SnmpMibAgent 0N/A // Build the request tree for the operation 0N/A // The subrequest stored in the request tree are valid GET requests 0N/A "getNext",
"Processing handlers for GET-NEXT... ");
0N/A // Now invoke get() for each subrequest of the request tree. 0N/A // Gets the Meta node. It can be either a Group Meta or a 0N/A // Gets the depth of the Meta node in the OID tree 0N/A // Invoke the get() operation 0N/A * Processes a <CODE>getBulk</CODE> operation. 0N/A * The method implements the <CODE>getBulk</CODE> operation by calling 0N/A * appropriately the <CODE>getNext</CODE> method. 0N/A // Implements the method defined in SnmpMibAgent. See SnmpMibAgent 0N/A * Gets the root object identifier of the MIB. 0N/A * <P>In order to be accurate, the method should be called once the 0N/A * MIB is fully initialized (that is, after a call to <CODE>init</CODE> 0N/A * or <CODE>preRegister</CODE>). 0N/A * @return The root object identifier. 0N/A // Ask the tree to do the job ! 0N/A // Now format the result 0N/A // -------------------------------------------------------------------- 0N/A //--------------------------------------------------------------------- 0N/A * This method builds the temporary request-tree that will be used to 0N/A * perform the SNMP request associated with the given vector of varbinds 0N/A * @param req The SnmpMibRequest object holding the varbind list 0N/A * concerning this MIB. 0N/A * @param createflag Indicates whether the operation allow for creation 0N/A * of new instances (ie: it is a SET). 0N/A * @param atomic Indicates whether the operation is atomic or not. 0N/A * @param type Request type (from SnmpDefinitions). 0N/A * @return The request-tree where the original varbind list has been 0N/A * dispatched to the appropriate nodes. 0N/A // Build an empty request tree 0N/A // For each varbind in the list finds its handling node. 0N/A // Find the handling node for this varbind. 0N/A "Couldn't find a handling node for " +
0N/A // If the operation is atomic (Check/Set) or the version 0N/A // is V1 we must generate an exception. 0N/A "getHandlers",
"\tV1: Throwing exception");
0N/A // The index in the exception must correspond to the 0N/A "getHandlers",
"\tSET: Throwing exception");
0N/A // Should never come here... 0N/A "getHandlers",
"\tATOMIC: Throwing exception");
0N/A "\tGET: Registering noSuchInstance");
0N/A "\tGET: Registering noSuchObject");
0N/A "\tGET: Registering global error: " +
status);
0N/A * This method builds the temporary request-tree that will be used to 0N/A * perform the SNMP GET-NEXT request associated with the given vector 0N/A * of varbinds `list'. 0N/A * @param req The SnmpMibRequest object holding the varbind list 0N/A * concerning this MIB. 0N/A * @return The request-tree where the original varbind list has been 0N/A * dispatched to the appropriate nodes, and where the original 0N/A * OIDs have been replaced with the correct "next" OID. 0N/A // Creates an empty request tree, no entry creation is allowed (false) 0N/A // Sets the getNext flag: if version=V2, status exception are 0N/A // transformed in endOfMibView 0N/A "getGetNextHandlers",
"Received MIB request : " +
req);
0N/A // For each varbind, finds the handling node. 0N/A // This function has the side effect of transforming a GET-NEXT 0N/A // request into a valid GET request, replacing the OIDs in the 0N/A // original GET-NEXT request with the OID of the first leaf that 0N/A // Find the node handling the OID that follows the varbind 0N/A // OID. `result' contains this next leaf OID. 0N/A "getGetNextHandlers",
" Next OID of : " +
var.
oid);
0N/A // We replace the varbind original OID with the OID of the 0N/A // leaf object we have to return. 0N/A // debug("getGetNextHandlers", 0N/A // "Couldn't find a handling node for " 0N/A // + var.oid.toString()); 0N/A "getGetNextHandlers",
0N/A // The index in the exception must correspond to the 0N/A "getGetNextHandlers",
0N/A // -------------------------------------------------------------------- 0N/A // PROTECTED VARIABLES 0N/A // -------------------------------------------------------------------- 0N/A * The top element in the Mib tree. 0N/A // -------------------------------------------------------------------- 0N/A // PRIVATE VARIABLES 0N/A // -------------------------------------------------------------------- 0N/A * The root object identifier of the MIB.