112. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/25/2018 2:13:03 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.

112.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 SnmpMibOid.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 SnmpMibOid.java Wed Sep 12 16:26:57 2018 UTC

112.2 Comparison summary

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

112.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

112.4 Active regular expressions

No regular expressions were active.

112.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 199 7, 2012, 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  
  27   package co m.sun.jmx. snmp.agent ;
  28  
  29  
  30  
  31   // java im ports
  32   //
  33   import jav a.io.Seria lizable;
  34   import jav a.util.Vec tor;
  35   import jav a.util.Enu meration;
  36  
  37   // jmx imp orts
  38   //
  39   import com .sun.jmx.s nmp.SnmpOi d;
  40   import com .sun.jmx.s nmp.SnmpVa rBind;
  41   import com .sun.jmx.s nmp.SnmpSt atusExcept ion;
  42  
  43   /**
  44    * Represe nts a node  in an SNM P MIB whic h is neith er a group  nor a var iable.
  45    * This cl ass define s a list o f sub-node s and the  methods th at allow t o
  46    * manipul ate the su b-nodes.
  47    * <P>
  48    * This cl ass is use d internal ly and by  the class  generated  by
  49    * <CODE>m ibgen</COD E>.
  50    * You sho uld not ne ed to use  this class  directly.
  51    *
  52    * <p><b>T his API is  a Sun Mic rosystems  internal A PI  and is  subject
  53    * to chan ge without  notice.</ b></p>
  54    */
  55  
  56   public cla ss SnmpMib Oid extend s SnmpMibN ode implem ents Seria lizable {
  57       privat e static f inal long  serialVers ionUID = 5 0122547711 07446812L;
  58  
  59       /**
  60        * Def ault const ructor.
  61        */
  62       public  SnmpMibOi d() {
  63       }
  64  
  65       // PUB LIC METHOD S
  66       //---- ---------- -
  67  
  68       /**
  69        * Gen eric handl ing of the  <CODE>get </CODE> op eration.
  70        *
  71        * <p>  This meth od should  be overrid den in sub classes.
  72        * <p>
  73        *
  74        * @pa ram req    The sub-re quest that  must be h andled by  this node.
  75        *
  76        * @pa ram depth  The depth  reached in  the OID t ree.
  77        *
  78        * @ex ception Sn mpStatusEx ception Th e default  implementa tion (if n ot
  79        *             ov erridden)  is to gene rate a Snm pStatusExc eption.
  80        */
  81       @Overr ide
  82       public  void get( SnmpMibSub Request re q, int dep th)
  83           th rows SnmpS tatusExcep tion {
  84           fo r (Enumera tion<SnmpV arBind> e=  req.getEl ements();  e.hasMoreE lements(); ) {
  85                SnmpVarB ind var= e .nextEleme nt();
  86                SnmpStat usExceptio n x =
  87                    new  SnmpStatus Exception( SnmpStatus Exception. noSuchObje ct);
  88                req.regi sterGetExc eption(var ,x);
  89           }
  90       }
  91  
  92       /**
  93        * Gen eric handl ing of the  <CODE>set </CODE> op eration.
  94        *
  95        * <p>  This meth od should  be overrid den in sub classes.
  96        * <p>
  97        *
  98        * @pa ram req    The sub-re quest that  must be h andled by  this node.
  99        *
  100        * @pa ram depth  The depth  reached in  the OID t ree.
  101        *
  102        * @ex ception Sn mpStatusEx ception Th e default  implementa tion (if n ot
  103        *             ov erridden)  is to gene rate a Snm pStatusExc eption.
  104        */
  105       @Overr ide
  106       public  void set( SnmpMibSub Request re q, int dep th)
  107           th rows SnmpS tatusExcep tion {
  108           fo r (Enumera tion<SnmpV arBind> e=  req.getEl ements();  e.hasMoreE lements(); ) {
  109                SnmpVarB ind var= e .nextEleme nt();
  110                SnmpStat usExceptio n x =
  111                    new  SnmpStatus Exception( SnmpStatus Exception. noAccess);
  112                req.regi sterSetExc eption(var ,x);
  113           }
  114       }
  115  
  116       /**
  117        * Gen eric handl ing of the  <CODE>che ck</CODE>  operation.
  118        *
  119        * <p>  This meth od should  be overrid den in sub classes.
  120        * <p>
  121        *
  122        * @pa ram req    The sub-re quest that  must be h andled by  this node.
  123        *
  124        * @pa ram depth  The depth  reached in  the OID t ree.
  125        *
  126        * @ex ception Sn mpStatusEx ception Th e default  implementa tion (if n ot
  127        *             ov erridden)  is to gene rate a Snm pStatusExc eption.
  128        */
  129       @Overr ide
  130       public  void chec k(SnmpMibS ubRequest  req, int d epth)
  131           th rows SnmpS tatusExcep tion {
  132           fo r (Enumera tion<SnmpV arBind> e=  req.getEl ements();  e.hasMoreE lements(); ) {
  133                SnmpVarB ind var= e .nextEleme nt();
  134                SnmpStat usExceptio n x =
  135                    new  SnmpStatus Exception( SnmpStatus Exception. noAccess);
  136                req.regi sterCheckE xception(v ar,x);
  137           }
  138       }
  139  
  140  
  141  
  142       // --- ---------- ---------- ---------- ---------- ---------- ---------- ------
  143       //
  144       // Imp lements th e method d efined in  SnmpMibNod e.
  145       //
  146       // --- ---------- ---------- ---------- ---------- ---------- ---------- ------
  147       //
  148       @Overr ide
  149       void f indHandlin gNode(Snmp VarBind va rbind,
  150                               long [] oid, in t depth,
  151                               Snmp RequestTre e handlers )
  152           th rows SnmpS tatusExcep tion {
  153  
  154  
  155           fi nal int le ngth = oid .length;
  156           Sn mpMibNode  node = nul l;
  157  
  158           if  (handlers  == null)
  159                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.snmpRspG enErr);
  160  
  161           if  (depth >  length) {
  162                // Nothi ng is left ... the oi d is not v alid
  163                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject);
  164           }  else if (d epth == le ngth) {
  165                // The o id is not  complete.. .
  166                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchIn stance);
  167           }  else {
  168                // Some  children v ariable or  subobject  is being  querried
  169                // getCh ild() will  raise an  exception  if no chil d is found .
  170                //
  171                final Sn mpMibNode  child= get Child(oid[ depth]);
  172  
  173                // XXXX  zzzz : wha t about nu ll childre n?
  174                //              (va riables fo r nested g roups)
  175                // if ch ild==null,  then we'r e dealing  with a var iable or
  176                // a tab le: we reg ister this  node.
  177                // This  behaviour  should be  overriden  in subclas ses,
  178                // in pa rticular i n group me ta classes : the grou p
  179                // meta  classes th at hold ta bles shoul d take car e
  180                // of fo rwarding t his call t o all the  tables inv olved.
  181                //
  182                if (chil d == null)
  183                    hand lers.add(t his,depth, varbind);
  184                else
  185                    chil d.findHand lingNode(v arbind,oid ,depth+1,h andlers);
  186           }
  187       }
  188  
  189       // --- ---------- ---------- ---------- ---------- ---------- ---------- ------
  190       //
  191       // Imp lements th e method d efined in  SnmpMibNod e.
  192       //
  193       // --- ---------- ---------- ---------- ---------- ---------- ---------- ------
  194       //
  195       @Overr ide
  196       long[]  findNextH andlingNod e(SnmpVarB ind varbin d,
  197                                      long[] o id, int po s, int dep th,
  198                                      SnmpRequ estTree ha ndlers,
  199                                      AcmCheck er checker )
  200           th rows SnmpS tatusExcep tion {
  201  
  202  
  203           fi nal int le ngth = oid .length;
  204           Sn mpMibNode  node = nul l;
  205           lo ng[] resul t = null;
  206           if  (handlers  == null)  {
  207                // This  should be  considered  as a genE rr, but we  do not wa nt to
  208                // abort  the whole  request,  so we're g oing to th row
  209                // a noS uchObject. ..
  210                //
  211                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject);
  212           }
  213  
  214           fi nal Object  data = ha ndlers.get UserData() ;
  215           fi nal int pd uVersion =  handlers. getRequest PduVersion ();
  216  
  217           if  (pos >= l ength) {
  218                long[] n ewOid= new  long[1];
  219                newOid[0 ]=  getNex tVarId(-1, data,pduVe rsion);
  220                result =  findNextH andlingNod e(varbind, newOid,0,d epth,handl ers,
  221                                                 checker) ;
  222                return r esult;
  223           }
  224  
  225           //  search th e element  specified  in the oid
  226           //
  227           lo ng[] newOi d= new lon g[1];
  228           lo ng index=  oid[pos];
  229  
  230           wh ile (true)  {
  231  
  232                try {
  233                    fina l SnmpMibN ode child  = getChild (index);
  234                    // S nmpOid res ult = null ;
  235                    if ( child == n ull) {
  236                         // shouldn 't happen
  237                         throw new  SnmpStatus Exception( SnmpStatus Exception. noSuchObje ct);
  238                         // validat eVarId(ind ex);
  239                         // handler s.add(this ,varbind,d epth);
  240                         // result  = new Snmp Oid(0);
  241                    } el se {
  242                         checker.ad d(depth, i ndex);
  243                         try {
  244                             result  = child.f indNextHan dlingNode( varbind,oi d,pos+1,
  245                                                                     depth+1,ha ndlers,
  246                                                                     checker);
  247                         } finally  {
  248                             checke r.remove(d epth);
  249                         }
  250                    }
  251  
  252                    // B uild up th e leaf OID
  253                    resu lt[depth]  = index;
  254                    retu rn result;
  255  
  256                } catch( SnmpStatus Exception  e) {
  257                    // I f there is  no such e lement go  one level  up ...
  258                    //
  259                    inde x= getNext VarId(inde x,data,pdu Version);
  260  
  261                    // T here is no  need to c arry the o riginal oi d ...
  262                    newO id[0]=inde x;
  263                    pos=  1;
  264                    oid= newOid;
  265                }
  266           }
  267       }
  268  
  269  
  270       /**
  271        * Com putes the  root OID o f the MIB.
  272        */
  273       @Overr ide
  274       public  void getR ootOid(Vec tor<Intege r> result)  {
  275  
  276           //  If a node  has sever al childre n, let ass ume that w e are one  step to
  277           //  far in or der to get  the MIB r oot.
  278           //
  279           if  (nbChildr en != 1)
  280                return;
  281  
  282           re sult.addEl ement(varL ist[0]);
  283  
  284           //  Now query  our child .
  285           //
  286           ch ildren.fir stElement( ).getRootO id(result) ;
  287  
  288       }
  289  
  290       /**
  291        * Reg isters a s pecific no de in the  tree.
  292        */
  293       public  void regi sterNode(S tring oidS tring ,Snm pMibNode n ode)
  294           th rows Illeg alAccessEx ception {
  295           Sn mpOid oid=  new SnmpO id(oidStri ng);
  296           re gisterNode (oid.longV alue(), 0,  node);
  297       }
  298  
  299       // PRO TECTED MET HODS
  300       //---- ---------- ----
  301  
  302       /**
  303        * Reg isters a s pecific no de in the  tree.
  304        */
  305       void r egisterNod e(long[] o id, int cu rsor ,Snmp MibNode no de)
  306           th rows Illeg alAccessEx ception {
  307  
  308           if  (cursor > = oid.leng th)
  309                throw ne w IllegalA ccessExcep tion();
  310  
  311           //  Check if  the node i s already  defined
  312           //
  313           lo ng var= oi d[cursor];
  314  
  315           // System.out .println(" entering r egistratio n for val= "
  316           //  + String. valueOf(va r) + " pos ition= " +  cursor);
  317  
  318           in t pos = re trieveInde x(var);
  319           if  (pos  ==  nbChildren ) {
  320                nbChildr en++;
  321                varList=  new int[n bChildren] ;
  322                varList[ 0]= (int)  var;
  323                pos =0;
  324                if ( (cu rsor + 1)  == oid.len gth) {
  325                    // T hat 's the  end of th e trip.
  326                    // D o not forw ard the re gistration
  327  
  328                    //Sy stem.out.p rintln("En d of trip  for val="
  329                    //       + Stri ng.valueOf (var) + "  position=  " + cursor );
  330                    chil dren.inser tElementAt (node,pos) ;
  331                    retu rn;
  332                }
  333  
  334                //System .out.print ln("Create  node for  val="
  335                //        + String. valueOf(va r) + " pos ition= " +  cursor);
  336                SnmpMibO id child=  new SnmpMi bOid();
  337                children .insertEle mentAt(chi ld, pos);
  338                child.re gisterNode (oid, curs or + 1, no de);
  339                return;
  340           }
  341           if  (pos == - 1) {
  342                // The n ode is not  yet regis tered
  343                //
  344                int[] tm p= new int [nbChildre n + 1];
  345                tmp[nbCh ildren]= ( int) var;
  346                System.a rraycopy(v arList, 0,  tmp, 0, n bChildren) ;
  347                varList=  tmp;
  348                nbChildr en++;
  349                SnmpMibN ode.sort(v arList);
  350                int newP os = retri eveIndex(v ar);
  351                varList[ newPos]= ( int) var;
  352                if ( (cu rsor + 1)  == oid.len gth) {
  353                    // T hat 's the  end of th e trip.
  354                    // D o not forw ard the re gistration
  355  
  356                    //Sy stem.out.p rintln("En d of trip  for val="
  357                    //      + Strin g.valueOf( var) + " p osition= "  + cursor) ;
  358                    chil dren.inser tElementAt (node, new Pos);
  359                    retu rn;
  360                }
  361                SnmpMibO id child=  new SnmpMi bOid();
  362                // Syste m.out.prin tln("Creat e node for  val=" +
  363                //     S tring.valu eOf(var) +  " positio n= " + cur sor);
  364                children .insertEle mentAt(chi ld, newPos );
  365                child.re gisterNode (oid, curs or + 1, no de);
  366           }
  367           el se {
  368                // The n ode is alr eady regis tered
  369                //
  370                SnmpMibN ode child=  children. elementAt( pos);
  371                if ( (cu rsor + 1)  == oid.len gth ) {
  372                    //Sy stem.out.p rintln("No de already  registere d val=" +
  373                    //           St ring.value Of(var) +  " position = " + curs or);
  374                    if ( child == n ode) retur n;
  375                    if ( child != n ull && nod e != null)  {
  376                         // Now we' re going t o patch th e tree the  following  way:
  377                         //   if a  subgroup h as been re gistered b efore its  father,
  378                         //   we're  going to  replace th e father O ID node wi th
  379                         //   the a ctual grou p-node and  export th e children  from
  380                         //   the t emporary O ID node to  the actua l group no de.
  381                         //
  382  
  383                         if (node i nstanceof  SnmpMibGro up) {
  384                             // `no de' is a g roup => re place `chi ld' with ` node'
  385                             // exp ort the ch ild's subt ree to `no de'.
  386                             //
  387                             ((Snmp MibOid)chi ld).export Children(( SnmpMibOid )node);
  388                             childr en.setElem entAt(node ,pos);
  389                             return ;
  390  
  391                         } else if  ((node ins tanceof Sn mpMibOid)  &&
  392                                  ( child inst anceof Snm pMibGroup) ) {
  393                             // `no de' is a t emporary n ode, and ` child' is  a
  394                             //  gr oup => kee p child an d export t he node's
  395                             //  su btree to ` child'.
  396                             //
  397                             ((Snmp MibOid)nod e).exportC hildren((S nmpMibOid) child);
  398                             return ;
  399                         } else if  (node inst anceof Snm pMibOid) {
  400                             // `no de' and `c hild' are  both tempo rary OID n odes
  401                             // =>  replace `c hild' with  `node' an d export c hild's
  402                             // sub tree to `n ode'.
  403                             //
  404                             ((Snmp MibOid)chi ld).export Children(( SnmpMibOid )node);
  405                             childr en.setElem entAt(node ,pos);
  406                             return ;
  407                         }
  408                    }
  409                    chil dren.setEl ementAt(no de,pos);
  410                } else {
  411                    if ( child == n ull)
  412                         throw new  IllegalAcc essExcepti on();
  413                    ((Sn mpMibOid)c hild).regi sterNode(o id, cursor  + 1, node );
  414                }
  415           }
  416       }
  417  
  418       /**
  419        * Exp ort this n ode's chil dren to a  brother no de that wi ll replace
  420        * thi s node in  the OID tr ee.
  421        * Thi s method i s a patch  that fixes  the probl em of regi stering
  422        * a s ubnode bef ore its fa ther node.
  423        *
  424        **/
  425       void e xportChild ren(SnmpMi bOid broth er)
  426           th rows Illeg alAccessEx ception {
  427  
  428           if  (brother  == null) r eturn;
  429           fi nal long[]  oid = new  long[1];
  430           fo r (int i=0 ; i<nbChil dren; i++)  {
  431                final Sn mpMibNode  child = ch ildren.ele mentAt(i);
  432                if (chil d == null)  continue;
  433                oid[0] =  varList[i ];
  434                brother. registerNo de(oid,0,c hild);
  435           }
  436       }
  437  
  438         // PRI D A N E S M   T   ODS
  439       //---- ---------- --
  440  
  441       SnmpMi bNode getC hild(long  id) throws  SnmpStatu sException  {
  442  
  443           //  first we  need to re trieve the  identifie r in the l ist of chi ldren
  444           //
  445           fi nal int po s= getInse rtAt(id);
  446           if  (pos >= n bChildren)  {
  447                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject);
  448           }
  449  
  450           if  (varList[ pos] != (i nt) id) {
  451                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject);
  452           }
  453  
  454           //  Access th e node
  455           //
  456           Sn mpMibNode  child = nu ll;
  457           tr y {
  458                child =  children.e lementAtNo nSync(pos) ;
  459           }  catch(Arra yIndexOutO fBoundsExc eption e)  {
  460                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject);
  461           }
  462           if  (child ==  null) {
  463                throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchIn stance);
  464           }
  465           re turn child ;
  466       }
  467  
  468       privat e int retr ieveIndex( long val)  {
  469  
  470           in t low= 0;
  471           in t cursor=  (int) val;
  472           if  (varList  == null ||  varList.l ength < 1)
  473                return n bChildren;
  474  
  475           in t max= var List.lengt h -1 ;
  476           in t curr= lo w + (max-l ow)/2;
  477           in t elmt;
  478           wh ile (low < = max) {
  479                elmt= va rList[curr ];
  480                if (curs or == elmt ) {
  481                    // W e need to  get the ne xt index . ..
  482                    //
  483                    retu rn curr;
  484                }
  485                if (elmt  < cursor)  {
  486                    low=  curr +1;
  487                } else {
  488                    max=  curr -1;
  489                }
  490                curr= lo w + (max-l ow)/2;
  491           }
  492           re turn -1;
  493       }
  494  
  495       privat e int getI nsertAt(lo ng val) {
  496  
  497           in t low= 0;
  498           fi nal int in dex= (int)  val;
  499           if  (varList  == null)
  500                return - 1;
  501           in t max= var List.lengt h -1 ;
  502           in t elmt;
  503           // final int[ ] v = varL ist;
  504  
  505           // if (index  > a[max])
  506           // return max  +1;
  507  
  508  
  509           in t curr= lo w + (max-l ow)/2;
  510           wh ile (low < = max) {
  511  
  512                elmt= va rList[curr ];
  513  
  514                // never  know ...w e might fi nd somethi ng ...
  515                //
  516                if (inde x == elmt)
  517                    retu rn curr;
  518  
  519                if (elmt  < index)  {
  520                    low=  curr +1;
  521                } else {
  522                    max=  curr -1;
  523                }
  524                curr= lo w + (max-l ow)/2;
  525           }
  526  
  527           re turn curr;
  528       }
  529  
  530       // PRI VATE VARIA BLES
  531       //---- ---------- ----
  532  
  533       /**
  534        * Con tains the  list of su b nodes.
  535        */
  536       privat e NonSyncV ector<Snmp MibNode> c hildren =  new NonSyn cVector<>( 1);
  537  
  538       /**
  539        * The  number of  sub nodes .
  540        */
  541       privat e int nbCh ildren= 0;
  542  
  543  
  544       // All  the metho ds of the  Vector cla ss are syn chronized.
  545       // Syn chronizati on is a ve ry expensi ve operati on. In our  case it i s
  546       // not  always re quired...
  547       //
  548       @Suppr essWarning s("serial" )  // We w ill never  serialize  this
  549       class  NonSyncVec tor<E> ext ends Vecto r<E> {
  550  
  551           pu blic NonSy ncVector(i nt size) {
  552                super(si ze);
  553           }
  554  
  555           fi nal void a ddNonSyncE lement(E o bj) {
  556                ensureCa pacity(ele mentCount  + 1);
  557                elementD ata[elemen tCount++]  = obj;
  558           }
  559  
  560           @S uppressWar nings("unc hecked")   // cast to  E
  561           fi nal E elem entAtNonSy nc(int ind ex) {
  562                return ( E) element Data[index ];
  563           }
  564  
  565       }
  566   }