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.
# | 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 | SnmpMibNode.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 | SnmpMibNode.java | Wed Sep 12 16:26:56 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 810 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
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 |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 199 7, 2007, 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.Has htable; | |
36 | import jav a.util.Enu meration; | |
37 | ||
38 | // jmx imp orts | |
39 | // | |
40 | import com .sun.jmx.s nmp.SnmpOi d; | |
41 | import com .sun.jmx.s nmp.SnmpVa lue; | |
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 | * The <CO DE>SnmpMib Node</CODE > class re presents a node in a n SNMP MIB . | |
48 | * <P> | |
49 | * This cl ass is use d internal ly and by the class generated by | |
50 | * <CODE>m ibgen</COD E>. | |
51 | * You sho uld not ne ed to use this class directly. | |
52 | * | |
53 | * <p><b>T his API is a Sun Mic rosystems internal A PI and is subject | |
54 | * to chan ge without notice.</ b></p> | |
55 | */ | |
56 | ||
57 | public abs tract clas s SnmpMibN ode implem ents Seria lizable { | |
58 | ||
59 | // --- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
60 | // PUB LIC METHOD S | |
61 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
62 | ||
63 | /** | |
64 | * Get the next OID arc co rrespondin g to a rea dable scal ar variabl e, | |
65 | * a b ranch lead ing to a s ubgroub, o r a table. | |
66 | * | |
67 | * @pa ram id Id we start f rom lookin g for the next. | |
68 | * @pa ram userDa ta A conte xtual obje ct contain ing user-d ata. | |
69 | * This o bject is a llocated t hrough the <code> | |
70 | * {@link com.sun.j mx.snmp.ag ent.SnmpUs erDataFact ory}</code > | |
71 | * for ea ch incomin g SNMP req uest. | |
72 | * | |
73 | * @re turn The n ext id in this group . | |
74 | * | |
75 | * @ex ception Sn mpStatusEx ception If no id is found afte r the give n id. | |
76 | */ | |
77 | public long getN extVarId(l ong id, Ob ject userD ata) | |
78 | th rows SnmpS tatusExcep tion { | |
79 | re turn getNe xtIdentifi er(varList ,id); | |
80 | } | |
81 | ||
82 | /** | |
83 | * Get the next OID arc co rrespondin g to a rea dable scal ar variabl e, | |
84 | * a b ranch lead ing to a s ubgroub, o r a table, possibly skipping o ver | |
85 | * tho se arcs th at must no t or canno t be retur ned. | |
86 | * | |
87 | * Cal ls {@link #getNextVa rId(long,j ava.lang.O bject)} un til | |
88 | * {@l ink #skipV ariable(lo ng,java.la ng.Object, int)} retu rns false. | |
89 | * | |
90 | * @pa ram id Id we start f rom lookin g for the next. | |
91 | * @pa ram userDa ta A conte xtual obje ct contain ing user-d ata. | |
92 | * This o bject is a llocated t hrough the <code> | |
93 | * {@link com.sun.j mx.snmp.ag ent.SnmpUs erDataFact ory}</code > | |
94 | * for ea ch incomin g SNMP req uest. | |
95 | * @pa ram pduVer sion Proto col versio n of the o riginal re quest PDU. | |
96 | * | |
97 | * @re turn The n ext id in this group which can be return ed using | |
98 | * the g iven PDU's protocol version. | |
99 | * | |
100 | * @ex ception Sn mpStatusEx ception If no id is found afte r the give n id. | |
101 | */ | |
102 | public long getN extVarId(l ong id, Ob ject userD ata, int p duVersion) | |
103 | th rows SnmpS tatusExcep tion { | |
104 | lo ng varid=i d; | |
105 | do { | |
106 | varid = getNextVar Id(varid,u serData); | |
107 | } while (ski pVariable( varid,user Data,pduVe rsion)); | |
108 | ||
109 | re turn varid ; | |
110 | } | |
111 | ||
112 | /** | |
113 | * Hoo k for subc lasses. | |
114 | * The default i mplementat ion of thi s method i s to alway s return | |
115 | * fal se. Subcla sses shoul d redefine this meth od so that it return s | |
116 | * tru e when: | |
117 | * <ul ><li>the v ariable is a leaf th at is not instantiat ed,</li> | |
118 | * <li >or the va riable is a leaf who se type ca nnot be re turned by that | |
119 | * version o f the prot ocol (e.g. an Counte r64 with S NMPv1).</l i> | |
120 | * </u l> | |
121 | * | |
122 | * @pa ram id Id we start f rom lookin g for the next. | |
123 | * @pa ram userDa ta A conte xtual obje ct contain ing user-d ata. | |
124 | * This o bject is a llocated t hrough the <code> | |
125 | * {@link com.sun.j mx.snmp.ag ent.SnmpUs erDataFact ory}</code > | |
126 | * for ea ch incomin g SNMP req uest. | |
127 | * @pa ram pduVer sion Proto col versio n of the o riginal re quest PDU. | |
128 | * | |
129 | * @re turn true if the var iable must be skippe d by the g et-next | |
130 | * algor ithm. | |
131 | */ | |
132 | protec ted boolea n skipVari able(long id, Object userData, int pduVe rsion) { | |
133 | re turn false ; | |
134 | } | |
135 | ||
136 | /** | |
137 | * Fin d the node which han dles a var bind, and register i t in the | |
138 | * Snm pRequestTr ee. This m ethod is a pure inte rnal metho d. You sho uld | |
139 | * nev er try to call it di rectly. | |
140 | * | |
141 | * @pa ram varbin d The var bind to be handled | |
142 | * | |
143 | * @pa ram oid The OID array ext racted fro m the varb ind | |
144 | * | |
145 | * @pa ram depth The dep th reached in the OI D at this step of th e | |
146 | * process ing. | |
147 | * | |
148 | * @pa ram handle rs The Has htable in which the varbind wi ll be regi stered | |
149 | * with it s handling node. Thi s hashtabl e contains | |
150 | * <CODE>S nmpRequest Tree.Handl er</CODE> items. | |
151 | * | |
152 | * @ex ception Sn mpStatusEx ception No handling node was f ound. | |
153 | **/ | |
154 | void f indHandlin gNode(Snmp VarBind va rbind, | |
155 | long [] oid, in t depth, | |
156 | Snmp RequestTre e handlers ) | |
157 | th rows SnmpS tatusExcep tion { | |
158 | th row new Sn mpStatusEx ception(Sn mpStatusEx ception.no SuchObject ); | |
159 | } | |
160 | ||
161 | /** | |
162 | * Fin d the node which han dles the l eaf that i mmediately follows t he | |
163 | * giv en varbind OID, and register t he it in t he SnmpReq uestTree. | |
164 | * Thi s method i s a pure i nternal me thod. You should nev er try to call | |
165 | * it directly. | |
166 | * | |
167 | * @pa ram varbin d The var bind to be handled | |
168 | * | |
169 | * @pa ram oid The OID array ext racted fro m the varb ind | |
170 | * | |
171 | * @pa ram depth The dep th reached in the OI D at this step of th e | |
172 | * process ing. | |
173 | * | |
174 | * @pa ram handle rs The Has htable in which the varbind wi ll be regi stered | |
175 | * with it s handling node. Thi s hashtabl e contains | |
176 | * SnmpReq uestTree.H andler ite ms. | |
177 | * | |
178 | * @re turn The S nmpOid of the next l eaf. | |
179 | * | |
180 | * @ex ception Sn mpStatusEx ception No handling node was f ound. | |
181 | **/ | |
182 | long[] findNextH andlingNod e(SnmpVarB ind varbin d, | |
183 | long[] oid, int p os, int de pth, | |
184 | SnmpReq uestTree h andlers, A cmChecker checker) | |
185 | th rows SnmpS tatusExcep tion { | |
186 | th row new Sn mpStatusEx ception(Sn mpStatusEx ception.no SuchObject ); | |
187 | } | |
188 | ||
189 | /** | |
190 | * Gen eric handl ing of the <CODE>get </CODE> op eration. | |
191 | * | |
192 | * <p> You can o verride th is method if you nee d to imple ment some | |
193 | * spe cific poli cies for m inimizing the access es made to some remo te | |
194 | * und erlying re sources. | |
195 | * <p> | |
196 | * | |
197 | * @pa ram req The sub-re quest that must be h andled by this node. | |
198 | * | |
199 | * @pa ram depth The depth reached in the OID t ree. | |
200 | * | |
201 | * @ex ception Sn mpStatusEx ception An error occ urred whil e accessin g | |
202 | * th e MIB node . | |
203 | */ | |
204 | public abstract void get(S nmpMibSubR equest req , int dept h) | |
205 | th rows SnmpS tatusExcep tion; | |
206 | ||
207 | /** | |
208 | * Gen eric handl ing of the <CODE>set </CODE> op eration. | |
209 | * <p> You can o verride th is method if you nee d to imple ment some | |
210 | * spe cific poli cies for m inimizing the access es made to some remo te | |
211 | * und erlying re sources. | |
212 | * <p> | |
213 | * | |
214 | * @pa ram req The sub-re quest that must be h andled by this node. | |
215 | * | |
216 | * @pa ram depth The depth reached in the OID t ree. | |
217 | * | |
218 | * @ex ception Sn mpStatusEx ception An error occ urred whil e accessin g | |
219 | * th e MIB node . | |
220 | */ | |
221 | public abstract void set(S nmpMibSubR equest req , int dept h) | |
222 | th rows SnmpS tatusExcep tion; | |
223 | ||
224 | /** | |
225 | * Gen eric handl ing of the <CODE>che ck</CODE> operation. | |
226 | * <p> You can o verride th is method if you nee d to imple ment some | |
227 | * spe cific poli cies for m inimizing the access es made to some remo te | |
228 | * und erlying re sources, o r if you n eed to imp lement som e consiste ncy | |
229 | * che cks betwee n the diff erent valu es provide d in the v arbind lis t. | |
230 | * <p> | |
231 | * | |
232 | * @pa ram req The sub-re quest that must be h andled by this node. | |
233 | * | |
234 | * @pa ram depth The depth reached in the OID t ree. | |
235 | * | |
236 | * @ex ception Sn mpStatusEx ception An error occ urred whil e accessin g | |
237 | * th e MIB node . | |
238 | */ | |
239 | public abstract void check (SnmpMibSu bRequest r eq, int de pth) | |
240 | th rows SnmpS tatusExcep tion; | |
241 | ||
242 | /** | |
243 | * Sor ts the spe cified int eger array . | |
244 | * | |
245 | * @pa ram array An integer array. | |
246 | */ | |
247 | static public vo id sort(in t array[]) { | |
248 | Qu ickSort(ar ray, 0, ar ray.length - 1); | |
249 | } | |
250 | ||
251 | /** | |
252 | * Com putes the root OID o f the MIB. | |
253 | */ | |
254 | public void getR ootOid(Vec tor<Intege r> result) { | |
255 | re turn; | |
256 | } | |
257 | ||
258 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
259 | // PAC KAGE METHO DS | |
260 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
261 | ||
262 | /** | |
263 | * Thi s is a gen eric versi on of C.A. R Hoare's Quick Sort | |
264 | * alg orithm. T his will h andle arra ys that ar e already | |
265 | * sor ted, and a rrays with duplicate keys. | |
266 | * | |
267 | * If you think of a one d imensional array as going from | |
268 | * the lowest in dex on the left to t he highest index on the right | |
269 | * the n the para meters to this funct ion are lo west index or | |
270 | * lef t and high est index or right. The first time you call | |
271 | * thi s function it will b e with the parameter s 0, a.len gth - 1. | |
272 | * | |
273 | * @pa ram a An i nteger arr ay. | |
274 | * @pa ram lo0 Le ft boundar y of array partition . | |
275 | * @pa ram hi0 Ri ght bounda ry of arra y partitio n. | |
276 | */ | |
277 | static void Quic kSort(int a[], int l o0, int hi 0) { | |
278 | in t lo = lo0 ; | |
279 | in t hi = hi0 ; | |
280 | in t mid; | |
281 | ||
282 | if ( hi0 > l o0) { | |
283 | ||
284 | /* Arbit rarily est ablishing partition element as the midpo int of | |
285 | * the a rray. | |
286 | */ | |
287 | mid = a[ ( lo0 + h i0 ) / 2 ] ; | |
288 | ||
289 | // loop through th e array un til indice s cross | |
290 | while( l o <= hi ) { | |
291 | /* f ind the fi rst elemen t that is greater th an or equa l to | |
292 | * t he partiti on element starting from the l eft Index. | |
293 | */ | |
294 | whil e( ( lo < hi0 ) && ( a[lo] < mid )) | |
295 | ++lo; | |
296 | ||
297 | /* f ind an ele ment that is smaller than or e qual to | |
298 | * t he partiti on element starting from the r ight Index . | |
299 | */ | |
300 | whil e( ( hi > lo0 ) && ( a[hi] > m id )) | |
301 | --hi; | |
302 | ||
303 | // i f the inde xes have n ot crossed , swap | |
304 | if( lo <= hi ) { | |
305 | swap(a, lo , hi); | |
306 | ++lo; | |
307 | --hi; | |
308 | } | |
309 | } | |
310 | ||
311 | /* If th e right in dex has no t reached the left s ide of arr ay | |
312 | * must now sort t he left pa rtition. | |
313 | */ | |
314 | if( lo0 < hi ) | |
315 | Quic kSort( a, lo0, hi ); | |
316 | ||
317 | /* If th e left ind ex has not reached t he right s ide of arr ay | |
318 | * must now sort t he right p artition. | |
319 | */ | |
320 | if( lo < hi0 ) | |
321 | Quic kSort( a, lo, hi0 ); | |
322 | ||
323 | } | |
324 | } | |
325 | ||
326 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
327 | // PRO TECTED MET HODS | |
328 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
329 | ||
330 | /** | |
331 | * Thi s will giv e the firs t element greater th an <CODE>v alue</CODE > | |
332 | * in a sorted a rray. | |
333 | * If there is n o element of the arr ay greater than <COD E>value</C ODE>, | |
334 | * the method wi ll throw a <CODE>Snm pStatusExc eption</CO DE>. | |
335 | * | |
336 | * @pa ram table A sorted i nteger arr ay. | |
337 | * | |
338 | * @pa ram value The greate st value. | |
339 | * | |
340 | * @ex ception Sn mpStatusEx ception If there is no element greater t han | |
341 | * <CODE>val ue</CODE>. | |
342 | */ | |
343 | final static pro tected int getNextId entifier(i nt table[] , long val ue) | |
344 | th rows SnmpS tatusExcep tion { | |
345 | ||
346 | fi nal int[] a = table; | |
347 | fi nal int va l= (int) v alue; | |
348 | ||
349 | if (a == nul l) { | |
350 | throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject); | |
351 | } | |
352 | ||
353 | in t low= 0; | |
354 | in t max= a.l ength; | |
355 | in t curr= lo w + (max-l ow)/2; | |
356 | in t elmt= 0; | |
357 | ||
358 | // Basic che ck | |
359 | // | |
360 | if (max < 1) { | |
361 | throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject); | |
362 | } | |
363 | ||
364 | if (a[max-1] <= val) { | |
365 | throw ne w SnmpStat usExceptio n(SnmpStat usExceptio n.noSuchOb ject); | |
366 | } | |
367 | ||
368 | wh ile (low < = max) { | |
369 | elmt= a[ curr]; | |
370 | if (val == elmt) { | |
371 | // W e ned to g et the nex t index .. . | |
372 | // | |
373 | curr ++; | |
374 | retu rn a[curr] ; | |
375 | } | |
376 | if (elmt < val) { | |
377 | low= curr +1; | |
378 | } else { | |
379 | max= curr -1; | |
380 | } | |
381 | curr= lo w + (max-l ow)/2; | |
382 | } | |
383 | re turn a[cur r]; | |
384 | } | |
385 | ||
386 | ||
387 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
388 | // PRI D A N E S M T ODS | |
389 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
390 | ||
391 | final static pri vate void swap(int a [], int i, int j) { | |
392 | in t T; | |
393 | T = a[i]; | |
394 | a[ i] = a[j]; | |
395 | a[ j] = T; | |
396 | } | |
397 | ||
398 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
399 | // PRO TECTED VAR IABLES | |
400 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
401 | ||
402 | /** | |
403 | * Con tains the list of va riable ide ntifiers. | |
404 | */ | |
405 | protec ted int[] varList; | |
406 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.