src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


 119     // OID arc leads to a subgroup. This implementation can be changed if
 120     // needed...
 121     // For instance, the subclass could provide a generated isNestedArc()
 122     // method in which the subgroup OID arcs would be hardcoded.
 123     // However, the generic approach was preferred because at this time
 124     // groups and subgroups are dynamically registered in the MIB.
 125     //
 126     /**
 127      * Tell whether the given OID arc identifies a sub-tree
 128      * leading to a nested SNMP sub-group. This method is used internally.
 129      * You shouldn't need to call it directly.
 130      *
 131      * @param arc An OID arc.
 132      *
 133      * @return <CODE>true</CODE> if the given OID arc identifies a subtree
 134      * leading to a nested SNMP sub-group.
 135      *
 136      */
 137     public boolean isNestedArc(long arc) {
 138         if (subgroups == null) return false;
 139         Object obj = subgroups.get(new Long(arc));
 140         // if the arc is registered in the hashtable,
 141         // it leads to a subgroup.
 142         return (obj != null);
 143     }
 144 
 145     /**
 146      * Generic handling of the <CODE>get</CODE> operation.
 147      * <p>The actual implementation of this method will be generated
 148      * by mibgen. Usually, this implementation only delegates the
 149      * job to some other provided runtime class, which knows how to
 150      * access the MBean. The current toolkit thus provides two
 151      * implementations:
 152      * <ul><li>The standard implementation will directly access the
 153      *         MBean through a java reference,</li>
 154      *     <li>The generic implementation will access the MBean through
 155      *         the MBean server.</li>
 156      * </ul>
 157      * <p>Both implementations rely upon specific - and distinct, set of
 158      * mibgen generated methods.
 159      * <p> You can override this method if you need to implement some


 243     }
 244 
 245     // -------------------------------------------------------------------
 246     // PACKAGE METHODS
 247     // -------------------------------------------------------------------
 248 
 249     // -------------------------------------------------------------------
 250     // This method can also be overriden in a subclass to provide a
 251     // different implementation of the isNestedArc() method.
 252     // => if isNestedArc() is hardcoded, then registerSubArc() becomes
 253     //    useless and can become empty.
 254     /**
 255      * Register an OID arc that identifies a sub-tree
 256      * leading to a nested SNMP sub-group. This method is used internally.
 257      * You shouldn't ever call it directly.
 258      *
 259      * @param arc An OID arc.
 260      *
 261      */
 262     void registerNestedArc(long arc) {
 263         Long obj = new Long(arc);
 264         if (subgroups == null) subgroups = new Hashtable<>();
 265         // registers the arc in the hashtable.
 266         subgroups.put(obj,obj);
 267     }
 268 
 269     // -------------------------------------------------------------------
 270     // The SnmpMibOid algorithm relies on the fact that for every arc
 271     // registered in varList, there is a corresponding node at the same
 272     // position in children.
 273     // So the trick is to register a null node in children for each variable
 274     // in varList, so that the real subgroup nodes can be inserted at the
 275     // correct location.
 276     // registerObject() should be called for each scalar object and each
 277     // table arc by the generated subclass.
 278     /**
 279      * Register an OID arc that identifies a scalar object or a table.
 280      * This method is used internally. You shouldn't ever call it directly.
 281      *
 282      * @param arc An OID arc.
 283      *




 119     // OID arc leads to a subgroup. This implementation can be changed if
 120     // needed...
 121     // For instance, the subclass could provide a generated isNestedArc()
 122     // method in which the subgroup OID arcs would be hardcoded.
 123     // However, the generic approach was preferred because at this time
 124     // groups and subgroups are dynamically registered in the MIB.
 125     //
 126     /**
 127      * Tell whether the given OID arc identifies a sub-tree
 128      * leading to a nested SNMP sub-group. This method is used internally.
 129      * You shouldn't need to call it directly.
 130      *
 131      * @param arc An OID arc.
 132      *
 133      * @return <CODE>true</CODE> if the given OID arc identifies a subtree
 134      * leading to a nested SNMP sub-group.
 135      *
 136      */
 137     public boolean isNestedArc(long arc) {
 138         if (subgroups == null) return false;
 139         Object obj = subgroups.get(arc);
 140         // if the arc is registered in the hashtable,
 141         // it leads to a subgroup.
 142         return (obj != null);
 143     }
 144 
 145     /**
 146      * Generic handling of the <CODE>get</CODE> operation.
 147      * <p>The actual implementation of this method will be generated
 148      * by mibgen. Usually, this implementation only delegates the
 149      * job to some other provided runtime class, which knows how to
 150      * access the MBean. The current toolkit thus provides two
 151      * implementations:
 152      * <ul><li>The standard implementation will directly access the
 153      *         MBean through a java reference,</li>
 154      *     <li>The generic implementation will access the MBean through
 155      *         the MBean server.</li>
 156      * </ul>
 157      * <p>Both implementations rely upon specific - and distinct, set of
 158      * mibgen generated methods.
 159      * <p> You can override this method if you need to implement some


 243     }
 244 
 245     // -------------------------------------------------------------------
 246     // PACKAGE METHODS
 247     // -------------------------------------------------------------------
 248 
 249     // -------------------------------------------------------------------
 250     // This method can also be overriden in a subclass to provide a
 251     // different implementation of the isNestedArc() method.
 252     // => if isNestedArc() is hardcoded, then registerSubArc() becomes
 253     //    useless and can become empty.
 254     /**
 255      * Register an OID arc that identifies a sub-tree
 256      * leading to a nested SNMP sub-group. This method is used internally.
 257      * You shouldn't ever call it directly.
 258      *
 259      * @param arc An OID arc.
 260      *
 261      */
 262     void registerNestedArc(long arc) {
 263         Long obj = arc;
 264         if (subgroups == null) subgroups = new Hashtable<>();
 265         // registers the arc in the hashtable.
 266         subgroups.put(obj,obj);
 267     }
 268 
 269     // -------------------------------------------------------------------
 270     // The SnmpMibOid algorithm relies on the fact that for every arc
 271     // registered in varList, there is a corresponding node at the same
 272     // position in children.
 273     // So the trick is to register a null node in children for each variable
 274     // in varList, so that the real subgroup nodes can be inserted at the
 275     // correct location.
 276     // registerObject() should be called for each scalar object and each
 277     // table arc by the generated subclass.
 278     /**
 279      * Register an OID arc that identifies a scalar object or a table.
 280      * This method is used internally. You shouldn't ever call it directly.
 281      *
 282      * @param arc An OID arc.
 283      *