109. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/25/2018 2:13:02 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

109.1 Files compared

# Location File Last Modified
1 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\jmx\snmp\agent SnmpMib.java Mon Jan 22 14:46:50 2018 UTC
2 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\jmx\snmp\agent SnmpMib.java Wed Sep 12 16:26:53 2018 UTC

109.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1472
Changed 1 2
Inserted 0 0
Removed 0 0

109.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

109.4 Active regular expressions

No regular expressions were active.

109.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 199 7, 2013, O racle and/ or its aff iliates. A ll rights  reserved.
  3    * DO NOT  ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER.
  4    *
  5    * This co de is free  software;  you can r edistribut e it and/o r modify i t
  6    * under t he terms o f the GNU  General Pu blic Licen se version  2 only, a s
  7    * publish ed by the  Free Softw are Founda tion.  Ora cle design ates this
  8    * particu lar file a s subject  to the "Cl asspath" e xception a s provided
  9    * by Orac le in the  LICENSE fi le that ac companied  this code.
  10    *
  11    * This co de is dist ributed in  the hope  that it wi ll be usef ul, but WI THOUT
  12    * ANY WAR RANTY; wit hout even  the implie d warranty  of MERCHA NTABILITY  or
  13    * FITNESS  FOR A PAR TICULAR PU RPOSE.  Se e the GNU  General Pu blic Licen se
  14    * version  2 for mor e details  (a copy is  included  in the LIC ENSE file  that
  15    * accompa nied this  code).
  16    *
  17    * You sho uld have r eceived a  copy of th e GNU Gene ral Public  License v ersion
  18    * 2 along  with this  work; if  not, write  to the Fr ee Softwar e Foundati on,
  19    * Inc., 5 1 Franklin  St, Fifth  Floor, Bo ston, MA 0 2110-1301  USA.
  20    *
  21    * Please  contact Or acle, 500  Oracle Par kway, Redw ood Shores , CA 94065  USA
  22    * or visi t www.orac le.com if  you need a dditional  informatio n or have  any
  23    * questio ns.
  24    */
  25  
  26   package co m.sun.jmx. snmp.agent ;
  27  
  28   import jav a.io.Seria lizable;
  29   import jav a.util.Enu meration;
  30   import jav a.util.log ging.Level ;
  31   import jav a.util.Vec tor;
  32  
  33   import jav ax.managem ent.Object Name;
  34   import jav ax.managem ent.MBeanS erver;
  35   import jav ax.managem ent.Malfor medObjectN ameExcepti on;
  36   import jav ax.managem ent.Instan ceAlreadyE xistsExcep tion;
  37   import jav ax.managem ent.MBeanR egistratio nException ;
  38   import jav ax.managem ent.NotCom pliantMBea nException ;
  39  
  40   import sta tic com.su n.jmx.defa ults.JmxPr operties.S NMP_ADAPTO R_LOGGER;
  41   import com .sun.jmx.s nmp.SnmpOi d;
  42   import com .sun.jmx.s nmp.SnmpVa rBind;
  43   import com .sun.jmx.s nmp.SnmpDe finitions;
  44   import com .sun.jmx.s nmp.SnmpSt atusExcept ion;
  45  
  46   /**
  47    * Abstrac t class fo r represen ting an SN MP MIB.
  48    * <P>
  49    * When co mpiling a  SNMP MIB,  among all  the classe s generate d by
  50    * <CODE>m ibgen</COD E>, there  is one whi ch extends  <CODE>Snm pMib</CODE >
  51    * for rep resenting  a whole MI B.
  52    * <BR>The  class is  used by th e SNMP pro tocol adap tor as the  entry poi nt in
  53    * the MIB .
  54    *
  55    * <p>This  generated  class can  be subcla ssed in yo ur code in  order to
  56    * plug in  your own  specific b ehaviour.
  57    * </p>
  58    *
  59    * <p><b>T his API is  a Sun Mic rosystems  internal A PI  and is  subject
  60    * to chan ge without  notice.</ b></p>
  61    */
  62   public abs tract clas s SnmpMib  extends Sn mpMibAgent  implement s Serializ able {
  63  
  64       /**
  65        * Def ault const ructor.
  66        * Ini tializes t he OID tre e.
  67        */
  68       public  SnmpMib()  {
  69           ro ot= new Sn mpMibOid() ;
  70       }
  71  
  72  
  73       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  74       // POL YMORHIC ME THODS
  75       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  76  
  77       /**
  78        * <p>
  79        * Thi s callback  should re turn the O ID associa ted to the  group
  80        * ide ntified by  the given  <code>gro upName</co de>.
  81        * </p >
  82        *
  83        * <p>
  84        * Thi s method i s provided  as a hook  to plug-i n some cus tom
  85        * spe cific beha vior. Alth ough doing  so is dis couraged y ou might
  86        * wan t to subcl ass this m ethod in o rder to st ore & prov ide more m etadata
  87        * inf ormation ( mapping OI D <-> symb olic name)  within th e agent,
  88        * or  to "change " the root  of the MI B OID by p refixing t he
  89        * def aultOid by  an applic ation depe ndant OID  string, fo r instance .
  90        * </p >
  91        *
  92        * <p>
  93        * The  default i mplementat ion of thi s method i s to retur n the give n
  94        * <co de>default Oid</code>
  95        * </p >
  96        *
  97        * @pa ram groupN ame   The  java-ized  name of th e SNMP gro up.
  98        * @pa ram defaul tOid  The  OID define d in the M IB for tha t group
  99        *                      (in  dot notati on).
  100        *
  101        * @re turn The O ID of the  group iden tified by  <code>grou pName</cod e>,
  102        *          in do t-notation .
  103        */
  104       protec ted String  getGroupO id(String  groupName,  String de faultOid)  {
  105           re turn defau ltOid;
  106       }
  107  
  108       /**
  109        * <p>
  110        * Thi s callback  should re turn the O bjectName  associated  to the
  111        * gro up identif ied by the  given <co de>groupNa me</code>.
  112        * </p >
  113        *
  114        * <p>
  115        * Thi s method i s provided  as a hook  to plug-i n some cus tom
  116        * spe cific beha vior. You  might want  to overri de this me thod
  117        * in  order to p rovide a d ifferent o bject nami ng scheme  than
  118        * tha t proposed  by defaul t by <code >mibgen</c ode>.
  119        * </p >
  120        *
  121        * <p>
  122        * Thi s method i s only mea ningful if  the MIB i s register ed
  123        * in  the MBeanS erver, oth erwise, it  will not  be called.
  124        * </p >
  125        *
  126        * <p>
  127        * The  default i mplementat ion of thi s method i s to retur n an Objec tName
  128        * bui lt from th e given <c ode>defaul tName</cod e>.
  129        * </p >
  130        *
  131        * @pa ram name   The java-i zed name o f the SNMP  group.
  132        * @pa ram oid    The OID re turned by  getGroupOi d() - in d ot notatio n.
  133        * @pa ram defaul tName The  name by de fault gene rated by < code>
  134        *                      mibg en</code>
  135        *
  136        * @re turn The O bjectName  of the gro up identif ied by <co de>name</c ode>
  137        */
  138       protec ted Object Name getGr oupObjectN ame(String  name, Str ing oid,
  139                                                   String  defaultNa me)
  140           th rows Malfo rmedObject NameExcept ion {
  141           re turn new O bjectName( defaultNam e);
  142       }
  143  
  144       /**
  145        * <p>
  146        * Reg ister an S NMP group  and its me tadata nod e in the M IB.
  147        * </p >
  148        *
  149        * <p>
  150        * Thi s method i s provided  as a hook  to plug-i n some cus tom
  151        * spe cific beha vior. You  might want  to overri de this me thod
  152        * if  you want t o set spec ial links  between th e MBean, i ts metadat a
  153        * nod e, its OID  or Object Name etc..
  154        * </p >
  155        *
  156        * <p>
  157        * If  the MIB is  not regis tered in t he MBeanSe rver, the  <code>
  158        * ser ver</code>  and <code >groupObjN ame</code>  parameter s will be
  159        * <co de>null</c ode>.<br>
  160        * If  the given  group MBea n is not < code>null< /code>, an d if the
  161        * <co de>server< /code> and  <code>gro upObjName< /code> par ameters ar e
  162        * not  null, the n this met hod will a lso automa tically re gister the
  163        * gro up MBean w ith the gi ven MBeanS erver <cod e>server</ code>.
  164        * </p >
  165        *
  166        * @pa ram groupN ame  The j ava-ized n ame of the  SNMP grou p.
  167        * @pa ram groupO id   The O ID as retu rned by ge tGroupOid( ) - in dot
  168        *                     notat ion.
  169        * @pa ram groupO bjName The  ObjectNam e as retur ned by get GroupObjec tName().
  170        *                     This  parameter  may be <co de>null</c ode> if th e
  171        *                     MIB i s not regi stered in  the MBeanS erver.
  172        * @pa ram node        The m etadata no de, as ret urned by t he metadat a
  173        *                     facto ry method  for this g roup.
  174        * @pa ram group       The M Bean for t his group,  as return ed by the
  175        *                     MBean  factory m ethod for  this group .
  176        * @pa ram server      The M BeanServer  in which  the groups  are to be
  177        *                     regis tered. Thi s paramete r will be  <code>null </code>
  178        *                     if th e MIB is n ot registe red, other wise it is  a
  179        *                     refer ence to th e MBeanSer ver in whi ch the MIB  is
  180        *                     regis tered.
  181        *
  182        */
  183       protec ted void r egisterGro upNode(Str ing groupN ame,   Str ing groupO id,
  184                                           Obj ectName gr oupObjName , SnmpMibN ode node,
  185                                           Obj ect group,  MBeanServ er server)
  186           th rows NotCo mpliantMBe anExceptio n, MBeanRe gistration Exception,
  187           In stanceAlre adyExistsE xception,  IllegalAcc essExcepti on {
  188           ro ot.registe rNode(grou pOid,node) ;
  189           if  (server ! = null &&  groupObjNa me != null  && group  != null)
  190                server.r egisterMBe an(group,g roupObjNam e);
  191       }
  192  
  193       /**
  194        * <p>
  195        * Reg ister an S NMP Table  metadata n ode in the  MIB.
  196        * </p >
  197        *
  198        * <p>
  199        * <b> <i>
  200        * Thi s method i s used int ernally an d you shou ld never n eed to
  201        * cal l it direc tly.</i></ b><br> It  is used to  establish  the link
  202        * bet ween an SN MP table m etadata no de and its  bean-like  counterpa rt.
  203        * <br >
  204        * The  group met adata node s will cre ate and re gister the ir
  205        * und erlying ta ble metada ta nodes i n the MIB  using this
  206        * met hod. <br>
  207        * The  metadata  nodes will  be later  retrieved  from the M IB by the
  208        * bea n-like tab le objects  using the  getRegist erTableMet a() method .
  209        * </p >
  210        *
  211        * @pa ram name       The ja va-ized na me of the  SNMP table .
  212        * @pa ram table      The SN MP table m etadata no de - usual ly this
  213        *                    corres ponds to a  <code>mib gen</code>  generated
  214        *                    object .
  215        */
  216       public  abstract  void regis terTableMe ta(String  name, Snmp MibTable t able);
  217  
  218       /**
  219        * Ret urns a reg istered SN MP Table m etadata no de.
  220        *
  221        * <p> <b><i>
  222        * Thi s method i s used int ernally an d you shou ld never n eed to
  223        * cal l it direc tly.
  224        * </i ></b></p>
  225        *
  226        */
  227       public  abstract  SnmpMibTab le getRegi steredTabl eMeta(Stri ng name);
  228  
  229       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  230       // PUB LIC METHOD S
  231       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  232  
  233       /**
  234        * Pro cesses a < CODE>get</ CODE> oper ation.
  235        *
  236        **/
  237       // Imp lements th e method d efined in  SnmpMibAge nt. See Sn mpMibAgent
  238       // for  java-doc
  239       //
  240       @Overr ide
  241       public  void get( SnmpMibReq uest req)  throws Snm pStatusExc eption {
  242  
  243           //  Builds th e request  tree: crea tion is no t allowed,  operation
  244           //  is not at omic.
  245  
  246           fi nal int re qType = Sn mpDefiniti ons.pduGet RequestPdu ;
  247           Sn mpRequestT ree handle rs = getHa ndlers(req ,false,fal se,reqType );
  248  
  249           Sn mpRequestT ree.Handle r h = null ;
  250           Sn mpMibNode  meta = nul l;
  251  
  252           if  (SNMP_ADA PTOR_LOGGE R.isLoggab le(Level.F INEST)) {
  253                SNMP_ADA PTOR_LOGGE R.logp(Lev el.FINEST,  SnmpMib.c lass.getNa me(),
  254                         "get", "Pr ocessing h andlers fo r GET... " );
  255           }
  256  
  257           //  For each  sub-reques t stored i n the requ est-tree,  invoke the
  258           //  get() met hod.
  259           fo r (Enumera tion<SnmpR equestTree .Handler>  eh=handler s.getHandl ers();eh.h asMoreElem ents();) {
  260                h = eh.n extElement ();
  261  
  262                // Gets  the Meta n ode. It ca n be eithe r a Group  Meta or a
  263                // Table  Meta.
  264                //
  265                meta = h andlers.ge tMetaNode( h);
  266  
  267                // Gets  the depth  of the Met a node in  the OID tr ee
  268                final in t depth =  handlers.g etOidDepth (h);
  269  
  270                for (Enu meration<S nmpMibSubR equest> rq s=handlers .getSubReq uests(h);
  271                     rqs .hasMoreEl ements();)  {
  272  
  273                    // I nvoke the  get() oper ation.
  274                    meta .get(rqs.n extElement (),depth);
  275                }
  276           }
  277       }
  278  
  279       /**
  280        * Pro cesses a < CODE>set</ CODE> oper ation.
  281        *
  282        */
  283       // Imp lements th e method d efined in  SnmpMibAge nt. See Sn mpMibAgent
  284       // for  java-doc
  285       //
  286       @Overr ide
  287       public  void set( SnmpMibReq uest req)  throws Snm pStatusExc eption {
  288  
  289           Sn mpRequestT ree handle rs = null;
  290  
  291           //  Optimizat ion: we're  going to  get the wh ole SnmpRe questTree
  292           //  built in  the "check " method,  so that we  don't hav e to rebui ld
  293           //  it here.
  294           //
  295           if  (req inst anceof Snm pMibReques tImpl)
  296                handlers  = ((SnmpM ibRequestI mpl)req).g etRequestT ree();
  297  
  298           //  Optimizat ion didn't  work: we  have to re build the  tree.
  299           //
  300           //  Builds th e request  tree: crea tion is no t allowed,  operation
  301           //  is atomic .
  302           //
  303           fi nal int re qType = Sn mpDefiniti ons.pduSet RequestPdu ;
  304           if  (handlers  == null)  handlers =  getHandle rs(req,fal se,true,re qType);
  305           ha ndlers.swi tchCreatio nFlag(fals e);
  306           ha ndlers.set PduType(re qType);
  307  
  308           Sn mpRequestT ree.Handle r h;
  309           Sn mpMibNode  meta;
  310  
  311           if  (SNMP_ADA PTOR_LOGGE R.isLoggab le(Level.F INEST)) {
  312                SNMP_ADA PTOR_LOGGE R.logp(Lev el.FINEST,  SnmpMib.c lass.getNa me(),
  313                         "set", "Pr ocessing h andlers fo r SET... " );
  314           }
  315  
  316           //  For each  sub-reques t stored i n the requ est-tree,  invoke the
  317           //  get() met hod.
  318           fo r (Enumera tion<SnmpR equestTree .Handler>  eh=handler s.getHandl ers();eh.h asMoreElem ents();) {
  319                h = eh.n extElement ();
  320  
  321                // Gets  the Meta n ode. It ca n be eithe r a Group  Meta or a
  322                // Table  Meta.
  323                //
  324                meta = h andlers.ge tMetaNode( h);
  325  
  326                // Gets  the depth  of the Met a node in  the OID tr ee
  327                final in t depth =  handlers.g etOidDepth (h);
  328  
  329                for (Enu meration<S nmpMibSubR equest> rq s=handlers .getSubReq uests(h);
  330                     rqs .hasMoreEl ements();)  {
  331  
  332                    // I nvoke the  set() oper ation
  333                    meta .set(rqs.n extElement (),depth);
  334                }
  335           }
  336       }
  337  
  338       /**
  339        * Che cks if a < CODE>set</ CODE> oper ation can  be perform ed.
  340        * If  the operat ion cannot  be perfor med, the m ethod will  raise a
  341        * <CO DE>SnmpSta tusExcepti on</CODE>.
  342        *
  343        */
  344       // Imp lements th e method d efined in  SnmpMibAge nt. See Sn mpMibAgent
  345       // for  java-doc
  346       //
  347       @Overr ide
  348       public  void chec k(SnmpMibR equest req ) throws S nmpStatusE xception {
  349  
  350           fi nal int re qType = Sn mpDefiniti ons.pduWal kRequest;
  351           //  Builds th e request  tree: crea tion is al lowed, ope ration
  352           //  is atomic .
  353           Sn mpRequestT ree handle rs = getHa ndlers(req ,true,true ,reqType);
  354  
  355           Sn mpRequestT ree.Handle r h;
  356           Sn mpMibNode  meta;
  357  
  358           if  (SNMP_ADA PTOR_LOGGE R.isLoggab le(Level.F INEST)) {
  359                SNMP_ADA PTOR_LOGGE R.logp(Lev el.FINEST,  SnmpMib.c lass.getNa me(),
  360                         "check", " Processing  handlers  for CHECK. .. ");
  361           }
  362  
  363           //  For each  sub-reques t stored i n the requ est-tree,  invoke the
  364           //  check() m ethod.
  365           fo r (Enumera tion<SnmpR equestTree .Handler>  eh=handler s.getHandl ers();eh.h asMoreElem ents();) {
  366                h = eh.n extElement ();
  367  
  368                // Gets  the Meta n ode. It ca n be eithe r a Group  Meta or a
  369                // Table  Meta.
  370                //
  371                meta = h andlers.ge tMetaNode( h);
  372  
  373                // Gets  the depth  of the Met a node in  the OID tr ee
  374                final in t depth =  handlers.g etOidDepth (h);
  375  
  376                for (Enu meration<S nmpMibSubR equest> rq s=handlers .getSubReq uests(h);
  377                     rqs .hasMoreEl ements();)  {
  378  
  379                    // I nvoke the  check() op eration
  380                    meta .check(rqs .nextEleme nt(),depth );
  381                }
  382           }
  383  
  384           //  Optimizat ion: we're  going to  pass the w hole SnmpR equestTree
  385           //  to the "s et" method , so that  we don't h ave to reb uild it th ere.
  386           //
  387           if  (req inst anceof Snm pMibReques tImpl) {
  388                ((SnmpMi bRequestIm pl)req).se tRequestTr ee(handler s);
  389           }
  390  
  391       }
  392  
  393       /**
  394        * Pro cesses a < CODE>getNe xt</CODE>  operation.
  395        *
  396        */
  397       // Imp lements th e method d efined in  SnmpMibAge nt. See Sn mpMibAgent
  398       // for  java-doc
  399       //
  400       @Overr ide
  401       public  void getN ext(SnmpMi bRequest r eq) throws  SnmpStatu sException  {
  402           //  Build the  request t ree for th e operatio n
  403           //  The subre quest stor ed in the  request tr ee are val id GET req uests
  404           Sn mpRequestT ree handle rs = getGe tNextHandl ers(req);
  405  
  406           Sn mpRequestT ree.Handle r h;
  407           Sn mpMibNode  meta;
  408  
  409           if  (SNMP_ADA PTOR_LOGGE R.isLoggab le(Level.F INEST)) {
  410                SNMP_ADA PTOR_LOGGE R.logp(Lev el.FINEST,  SnmpMib.c lass.getNa me(),
  411                         "getNext",  "Processi ng handler s for GET- NEXT... ") ;
  412           }
  413  
  414           //  Now invok e get() fo r each sub request of  the reque st tree.
  415           fo r (Enumera tion<SnmpR equestTree .Handler>  eh=handler s.getHandl ers();eh.h asMoreElem ents();) {
  416                h = eh.n extElement ();
  417  
  418                // Gets  the Meta n ode. It ca n be eithe r a Group  Meta or a
  419                // Table  Meta.
  420                //
  421                meta = h andlers.ge tMetaNode( h);
  422  
  423                // Gets  the depth  of the Met a node in  the OID tr ee
  424                int dept h = handle rs.getOidD epth(h);
  425  
  426                for (Enu meration<S nmpMibSubR equest> rq s=handlers .getSubReq uests(h);
  427                     rqs .hasMoreEl ements();)  {
  428  
  429                    // I nvoke the  get() oper ation
  430                    meta .get(rqs.n extElement (),depth);
  431                }
  432           }
  433       }
  434  
  435  
  436       /**
  437        * Pro cesses a < CODE>getBu lk</CODE>  operation.
  438        * The  method im plements t he <CODE>g etBulk</CO DE> operat ion by cal ling
  439        * app ropriately  the <CODE >getNext</ CODE> meth od.
  440        *
  441        */
  442       // Imp lements th e method d efined in  SnmpMibAge nt. See Sn mpMibAgent
  443       // for  java-doc
  444       //
  445       @Overr ide
  446       public  void getB ulk(SnmpMi bRequest r eq, int no nRepeat, i nt maxRepe at)
  447           th rows SnmpS tatusExcep tion {
  448  
  449           ge tBulkWithG etNext(req , nonRepea t, maxRepe at);
  450       }
  451  
  452       /**
  453        * Get s the root  object id entifier o f the MIB.
  454        * <P> In order t o be accur ate, the m ethod shou ld be call ed once th e
  455        * MIB  is fully  initialize d (that is , after a  call to <C ODE>init</ CODE>
  456        * or  <CODE>preR egister</C ODE>).
  457        *
  458        * @re turn The r oot object  identifie r.
  459        */
  460       @Overr ide
  461       public  long[] ge tRootOid()  {
  462  
  463           if ( rootOid  == null) {
  464                Vector<I nteger> li st= new Ve ctor<>(10) ;
  465  
  466                // Ask t he tree to  do the jo b !
  467                //
  468                root.get RootOid(li st);
  469  
  470                // Now f ormat the  result
  471                //
  472                rootOid=  new long[ list.size( )];
  473                int i=0;
  474                for(Enum eration<In teger> e=  list.eleme nts(); e.h asMoreElem ents(); )  {
  475                    Inte ger val= e .nextEleme nt();
  476                    root Oid[i++]=  val.longVa lue();
  477                }
  478           }
  479           re turn rootO id.clone() ;
  480       }
  481  
  482       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  483         // PRI D A N E S M   T   ODS
  484       //---- ---------- ---------- ---------- ---------- ---------- ---------- -----
  485  
  486       /**
  487        * Thi s method b uilds the  temporary  request-tr ee that wi ll be used  to
  488        * per form the S NMP reques t associat ed with th e given ve ctor of va rbinds
  489        * `li st'.
  490        *
  491        * @pa ram req Th e SnmpMibR equest obj ect holdin g the varb ind list
  492        *              c oncerning  this MIB.
  493        * @pa ram create flag Indic ates wheth er the ope ration all ow for cre ation
  494        *         of new  instances  (ie: it i s a SET).
  495        * @pa ram atomic  Indicates  whether t he operati on is atom ic or not.
  496        * @pa ram type R equest typ e (from Sn mpDefiniti ons).
  497        *
  498        * @re turn The r equest-tre e where th e original  varbind l ist has be en
  499        *          dispa tched to t he appropr iate nodes .
  500        */
  501       privat e SnmpRequ estTree ge tHandlers( SnmpMibReq uest req,
  502                                               boolean cr eateflag,  boolean at omic,
  503                                               int type)
  504           th rows SnmpS tatusExcep tion {
  505  
  506           //  Build an  empty requ est tree
  507           Sn mpRequestT ree handle rs =
  508                new Snmp RequestTre e(req,crea teflag,typ e);
  509  
  510           in t index=0;
  511           Sn mpVarBind  var;
  512           fi nal int ve r= req.get Version();
  513  
  514           //  For each  varbind in  the list  finds its  handling n ode.
  515           fo r (Enumera tion<SnmpV arBind> e=  req.getEl ements();  e.hasMoreE lements();  index++)  {
  516  
  517                var= e.n extElement ();
  518  
  519                try {
  520                    // F ind the ha ndling nod e for this  varbind.
  521                    root .findHandl ingNode(va r,var.oid. longValue( false),
  522                                            0, handlers);
  523                } catch( SnmpStatus Exception  x) {
  524  
  525                    if ( SNMP_ADAPT OR_LOGGER. isLoggable (Level.FIN EST)) {
  526                         SNMP_ADAPT OR_LOGGER. logp(Level .FINEST,
  527                                 Sn mpMib.clas s.getName( ),
  528                                 "g etHandlers ",
  529                                 "C ouldn't fi nd a handl ing node f or " +
  530                                 va r.oid.toSt ring());
  531                    }
  532  
  533                    // I f the oper ation is a tomic (Che ck/Set) or  the versi on
  534                    // i s V1 we mu st generat e an excep tion.
  535                    //
  536                    if ( ver == Snm pDefinitio ns.snmpVer sionOne) {
  537  
  538                         if (SNMP_A DAPTOR_LOG GER.isLogg able(Level .FINEST))  {
  539                             SNMP_A DAPTOR_LOG GER.logp(L evel.FINES T,
  540                                      SnmpMib. class.getN ame(),
  541                                      "getHand lers", "\t V1: Throwi ng excepti on");
  542                         }
  543  
  544                         // The ind ex in the  exception  must corre spond to t he
  545                         // SNMP in dex ...
  546                         //
  547                         final Snmp StatusExce ption sse  =
  548                             new Sn mpStatusEx ception(x,  index + 1 );
  549                         sse.initCa use(x);
  550                         throw sse;
  551                    } el se if ((ty pe == Snmp Definition s.pduWalkR equest)    ||
  552                                (ty pe == Snmp Definition s.pduSetRe questPdu))  {
  553                         final int  status =
  554                             SnmpRe questTree. mapSetExce ption(x.ge tStatus(), ver);
  555  
  556                         if (SNMP_A DAPTOR_LOG GER.isLogg able(Level .FINEST))  {
  557                             SNMP_A DAPTOR_LOG GER.logp(L evel.FINES T,
  558                                      SnmpMib. class.getN ame(),
  559                                      "getHand lers", "\t SET: Throw ing except ion");
  560                         }
  561  
  562                         final Snmp StatusExce ption sse  =
  563                             new Sn mpStatusEx ception(st atus, inde x + 1);
  564                         sse.initCa use(x);
  565                         throw sse;
  566                    } el se if (ato mic) {
  567  
  568                         // Should  never come  here...
  569                         if (SNMP_A DAPTOR_LOG GER.isLogg able(Level .FINEST))  {
  570                             SNMP_A DAPTOR_LOG GER.logp(L evel.FINES T,
  571                                      SnmpMib. class.getN ame(),
  572                                      "getHand lers", "\t ATOMIC: Th rowing exc eption");
  573                         }
  574  
  575                         final Snmp StatusExce ption sse  =
  576                             new Sn mpStatusEx ception(x,  index + 1 );
  577                         sse.initCa use(x);
  578                         throw sse;
  579                    }
  580  
  581                    fina l int stat us =
  582                         SnmpReques tTree.mapG etExceptio n(x.getSta tus(),ver) ;
  583  
  584                    if ( status ==  SnmpStatus Exception. noSuchInst ance) {
  585  
  586                         if (SNMP_A DAPTOR_LOG GER.isLogg able(Level .FINEST))  {
  587                             SNMP_A DAPTOR_LOG GER.logp(L evel.FINES T,
  588                                      SnmpMib. class.getN ame(),
  589                                      "getHand lers",
  590                                      "\tGET:  Registerin g noSuchIn stance");
  591                         }
  592  
  593                         var.value=  SnmpVarBi nd.noSuchI nstance;
  594  
  595                    } el se if (sta tus == Snm pStatusExc eption.noS uchObject)  {
  596                         if (SNMP_A DAPTOR_LOG GER.isLogg able(Level .FINEST))  {
  597                             SNMP_A DAPTOR_LOG GER.logp(L evel.FINES T,
  598                                      SnmpMib. class.getN ame(),
  599                                      "getHand lers",
  600                                      "\tGET:  Registerin g noSuchOb ject");
  601                         }
  602  
  603                             var.va lue= SnmpV arBind.noS uchObject;
  604  
  605                    } el se {
  606  
  607                         if (SNMP_A DAPTOR_LOG GER.isLogg able(Level .FINEST))  {
  608                             SNMP_A DAPTOR_LOG GER.logp(L evel.FINES T,
  609                                      SnmpMib. class.getN ame(),
  610                                      "getHand lers",
  611                                      "\tGET:  Registerin g global e rror: " +  status);
  612                         }
  613  
  614                         final Snmp StatusExce ption sse  =
  615                             new Sn mpStatusEx ception(st atus, inde x + 1);
  616                         sse.initCa use(x);
  617                         throw sse;
  618                    }
  619                }
  620           }
  621           re turn handl ers;
  622       }
  623  
  624       /**
  625        * Thi s method b uilds the  temporary  request-tr ee that wi ll be used  to
  626        * per form the S NMP GET-NE XT request  associate d with the  given vec tor
  627        * of  varbinds ` list'.
  628        *
  629        * @pa ram req Th e SnmpMibR equest obj ect holdin g the varb ind list
  630        *              c oncerning  this MIB.
  631        *
  632        * @re turn The r equest-tre e where th e original  varbind l ist has be en
  633        *          dispa tched to t he appropr iate nodes , and wher e the orig inal
  634        *          OIDs  have been  replaced w ith the co rrect "nex t" OID.
  635        */
  636       privat e SnmpRequ estTree ge tGetNextHa ndlers(Snm pMibReques t req)
  637           th rows SnmpS tatusExcep tion {
  638  
  639           //  Creates a n empty re quest tree , no entry  creation  is allowed  (false)
  640           Sn mpRequestT ree handle rs = new
  641                SnmpRequ estTree(re q,false,Sn mpDefiniti ons.pduGet NextReques tPdu);
  642  
  643           //  Sets the  getNext fl ag: if ver sion=V2, s tatus exce ption are
  644           //  transform ed in  end OfMibView
  645           ha ndlers.set GetNextFla g();
  646  
  647           if  (SNMP_ADA PTOR_LOGGE R.isLoggab le(Level.F INEST)) {
  648                SNMP_ADA PTOR_LOGGE R.logp(Lev el.FINEST,  SnmpMib.c lass.getNa me(),
  649                         "getGetNex tHandlers" , "Receive d MIB requ est : " +  req);
  650           }
  651           Ac mChecker c hecker = n ew AcmChec ker(req);
  652           in t index=0;
  653           Sn mpVarBind  var = null ;
  654           fi nal int ve r= req.get Version();
  655           Sn mpOid orig inal = nul l;
  656           //  For each  varbind, f inds the h andling no de.
  657           //  This func tion has t he side ef fect of tr ansforming  a GET-NEX T
  658           //  request i nto a vali d GET requ est, repla cing the O IDs in the
  659           //  original  GET-NEXT r equest wit h the OID  of the fir st leaf th at
  660           //  follows.
  661           fo r (Enumera tion<SnmpV arBind> e=  req.getEl ements();  e.hasMoreE lements();  index++)  {
  662  
  663                var = e. nextElemen t();
  664                SnmpOid  result;
  665                try {
  666                    // F ind the no de handlin g the OID  that follo ws the var bind
  667                    // O ID. `resul t' contain s this nex t leaf OID .
  668                    //AC M loop.
  669                    if ( SNMP_ADAPT OR_LOGGER. isLoggable (Level.FIN EST)) {
  670                         SNMP_ADAPT OR_LOGGER. logp(Level .FINEST,
  671                                 Sn mpMib.clas s.getName( ),
  672                                 "g etGetNextH andlers",  " Next OID  of : " +  var.oid);
  673                    }
  674                    resu lt = new S nmpOid(roo t.findNext HandlingNo de
  675                                           (va r,var.oid. longValue( false),0,
  676                                            0, handlers,  checker));
  677  
  678                    if ( SNMP_ADAPT OR_LOGGER. isLoggable (Level.FIN EST)) {
  679                         SNMP_ADAPT OR_LOGGER. logp(Level .FINEST,
  680                                 Sn mpMib.clas s.getName( ),
  681                                 "g etGetNextH andlers",  " is : " +  result);
  682                    }
  683                    // W e replace  the varbin d original  OID with  the OID of  the
  684                    // l eaf object  we have t o return.
  685                    var. oid = resu lt;
  686                } catch( SnmpStatus Exception  x) {
  687  
  688                    // i f (isDebug On())
  689                    //     debug("g etGetNextH andlers",
  690                    //         "Cou ldn't find  a handlin g node for  "
  691                    //         + va r.oid.toSt ring());
  692  
  693                    if ( ver == Snm pDefinitio ns.snmpVer sionOne) {
  694                         if (SNMP_A DAPTOR_LOG GER.isLogg able(Level .FINEST))  {
  695                             SNMP_A DAPTOR_LOG GER.logp(L evel.FINES T,
  696                                      SnmpMib. class.getN ame(),
  697                                      "getGetN extHandler s",
  698                                      "\tThrow ing except ion " + x. toString() );
  699                         }
  700                         // The ind ex in the  exception  must corre spond to t he
  701                         // SNMP in dex ...
  702                         //
  703                         throw new  SnmpStatus Exception( x, index +  1);
  704                    }
  705                    if ( SNMP_ADAPT OR_LOGGER. isLoggable (Level.FIN EST)) {
  706                         SNMP_ADAPT OR_LOGGER. logp(Level .FINEST,
  707                                 Sn mpMib.clas s.getName( ),
  708                                 "g etGetNextH andlers",
  709                                 "E xception :  " + x.get Status());
  710                    }
  711  
  712                    var. setSnmpVal ue(SnmpVar Bind.endOf MibView);
  713                }
  714           }
  715           re turn handl ers;
  716       }
  717  
  718       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  719       // PRO TECTED VAR IABLES
  720       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  721  
  722       /**
  723        * The  top eleme nt in the  Mib tree.
  724        * @se rial
  725        */
  726       protec ted SnmpMi bOid root;
  727  
  728  
  729       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  730       // PRI VATE VARIA BLES
  731       // --- ---------- ---------- ---------- ---------- ---------- ---------- -----
  732  
  733       /**
  734        * The  root obje ct identif ier of the  MIB.
  735        */
  736       privat e transien t long[] r ootOid= nu ll;
  737   }