blob: 80d6ccf5dc8529a2cc8abbd1cc8ea0e7cfab2184 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package sun.management.snmp.jvmmib;
27
28//
29// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
30//
31
32// java imports
33//
34import java.io.Serializable;
35
36// jmx imports
37//
38import javax.management.MBeanServer;
39import com.sun.jmx.snmp.SnmpCounter;
40import com.sun.jmx.snmp.SnmpCounter64;
41import com.sun.jmx.snmp.SnmpGauge;
42import com.sun.jmx.snmp.SnmpInt;
43import com.sun.jmx.snmp.SnmpUnsignedInt;
44import com.sun.jmx.snmp.SnmpIpAddress;
45import com.sun.jmx.snmp.SnmpTimeticks;
46import com.sun.jmx.snmp.SnmpOpaque;
47import com.sun.jmx.snmp.SnmpString;
48import com.sun.jmx.snmp.SnmpStringFixed;
49import com.sun.jmx.snmp.SnmpOid;
50import com.sun.jmx.snmp.SnmpNull;
51import com.sun.jmx.snmp.SnmpValue;
52import com.sun.jmx.snmp.SnmpVarBind;
53import com.sun.jmx.snmp.SnmpStatusException;
54
55// jdmk imports
56//
57import com.sun.jmx.snmp.agent.SnmpMib;
58import com.sun.jmx.snmp.agent.SnmpMibGroup;
59import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
60import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
61import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
62import com.sun.jmx.snmp.agent.SnmpMibTable;
63import com.sun.jmx.snmp.EnumRowStatus;
64import com.sun.jmx.snmp.SnmpDefinitions;
65
66/**
67 * The class is used for representing SNMP metadata for the "JvmRuntime" group.
68 * The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.
69 */
70public class JvmRuntimeMeta extends SnmpMibGroup
71 implements Serializable, SnmpStandardMetaServer {
72
73 /**
74 * Constructor for the metadata associated to "JvmRuntime".
75 */
76 public JvmRuntimeMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
77 objectserver = objserv;
78 try {
79 registerObject(23);
80 registerObject(22);
81 registerObject(21);
82 registerObject(9);
83 registerObject(20);
84 registerObject(8);
85 registerObject(7);
86 registerObject(6);
87 registerObject(5);
88 registerObject(4);
89 registerObject(3);
90 registerObject(12);
91 registerObject(11);
92 registerObject(2);
93 registerObject(1);
94 registerObject(10);
95 } catch (IllegalAccessException e) {
96 throw new RuntimeException(e.getMessage());
97 }
98 }
99
100 /**
101 * Get the value of a scalar variable
102 */
103 public SnmpValue get(long var, Object data)
104 throws SnmpStatusException {
105 switch((int)var) {
106 case 23: {
107 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
108 }
109
110 case 22: {
111 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
112 }
113
114 case 21: {
115 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
116 }
117
118 case 9:
119 return new SnmpInt(node.getJvmRTBootClassPathSupport());
120
121 case 20: {
122 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
123 }
124
125 case 8:
126 return new SnmpString(node.getJvmRTManagementSpecVersion());
127
128 case 7:
129 return new SnmpString(node.getJvmRTSpecVersion());
130
131 case 6:
132 return new SnmpString(node.getJvmRTSpecVendor());
133
134 case 5:
135 return new SnmpString(node.getJvmRTSpecName());
136
137 case 4:
138 return new SnmpString(node.getJvmRTVMVersion());
139
140 case 3:
141 return new SnmpString(node.getJvmRTVMVendor());
142
143 case 12:
144 return new SnmpCounter64(node.getJvmRTStartTimeMs());
145
146 case 11:
147 return new SnmpCounter64(node.getJvmRTUptimeMs());
148
149 case 2:
150 return new SnmpString(node.getJvmRTVMName());
151
152 case 1:
153 return new SnmpString(node.getJvmRTName());
154
155 case 10:
156 return new SnmpInt(node.getJvmRTInputArgsCount());
157
158 default:
159 break;
160 }
161 throw new SnmpStatusException(SnmpStatusException.noSuchObject);
162 }
163
164 /**
165 * Set the value of a scalar variable
166 */
167 public SnmpValue set(SnmpValue x, long var, Object data)
168 throws SnmpStatusException {
169 switch((int)var) {
170 case 23: {
171 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
172 }
173
174 case 22: {
175 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
176 }
177
178 case 21: {
179 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
180 }
181
182 case 9:
183 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
184
185 case 20: {
186 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
187 }
188
189 case 8:
190 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
191
192 case 7:
193 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
194
195 case 6:
196 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
197
198 case 5:
199 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
200
201 case 4:
202 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
203
204 case 3:
205 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
206
207 case 12:
208 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
209
210 case 11:
211 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
212
213 case 2:
214 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
215
216 case 1:
217 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
218
219 case 10:
220 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
221
222 default:
223 break;
224 }
225 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
226 }
227
228 /**
229 * Check the value of a scalar variable
230 */
231 public void check(SnmpValue x, long var, Object data)
232 throws SnmpStatusException {
233 switch((int) var) {
234 case 23: {
235 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
236 }
237
238 case 22: {
239 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
240 }
241
242 case 21: {
243 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
244 }
245
246 case 9:
247 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
248
249 case 20: {
250 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
251 }
252
253 case 8:
254 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
255
256 case 7:
257 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
258
259 case 6:
260 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
261
262 case 5:
263 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
264
265 case 4:
266 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
267
268 case 3:
269 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
270
271 case 12:
272 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
273
274 case 11:
275 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
276
277 case 2:
278 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
279
280 case 1:
281 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
282
283 case 10:
284 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
285
286 default:
287 throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
288 }
289 }
290
291 /**
292 * Allow to bind the metadata description to a specific object.
293 */
294 protected void setInstance(JvmRuntimeMBean var) {
295 node = var;
296 }
297
298
299 // ------------------------------------------------------------
300 //
301 // Implements the "get" method defined in "SnmpMibGroup".
302 // See the "SnmpMibGroup" Javadoc API for more details.
303 //
304 // ------------------------------------------------------------
305
306 public void get(SnmpMibSubRequest req, int depth)
307 throws SnmpStatusException {
308 objectserver.get(this,req,depth);
309 }
310
311
312 // ------------------------------------------------------------
313 //
314 // Implements the "set" method defined in "SnmpMibGroup".
315 // See the "SnmpMibGroup" Javadoc API for more details.
316 //
317 // ------------------------------------------------------------
318
319 public void set(SnmpMibSubRequest req, int depth)
320 throws SnmpStatusException {
321 objectserver.set(this,req,depth);
322 }
323
324
325 // ------------------------------------------------------------
326 //
327 // Implements the "check" method defined in "SnmpMibGroup".
328 // See the "SnmpMibGroup" Javadoc API for more details.
329 //
330 // ------------------------------------------------------------
331
332 public void check(SnmpMibSubRequest req, int depth)
333 throws SnmpStatusException {
334 objectserver.check(this,req,depth);
335 }
336
337 /**
338 * Returns true if "arc" identifies a scalar object.
339 */
340 public boolean isVariable(long arc) {
341
342 switch((int)arc) {
343 case 9:
344 case 8:
345 case 7:
346 case 6:
347 case 5:
348 case 4:
349 case 3:
350 case 12:
351 case 11:
352 case 2:
353 case 1:
354 case 10:
355 return true;
356 default:
357 break;
358 }
359 return false;
360 }
361
362 /**
363 * Returns true if "arc" identifies a readable scalar object.
364 */
365 public boolean isReadable(long arc) {
366
367 switch((int)arc) {
368 case 9:
369 case 8:
370 case 7:
371 case 6:
372 case 5:
373 case 4:
374 case 3:
375 case 12:
376 case 11:
377 case 2:
378 case 1:
379 case 10:
380 return true;
381 default:
382 break;
383 }
384 return false;
385 }
386
387
388 // ------------------------------------------------------------
389 //
390 // Implements the "skipVariable" method defined in "SnmpMibGroup".
391 // See the "SnmpMibGroup" Javadoc API for more details.
392 //
393 // ------------------------------------------------------------
394
395 public boolean skipVariable(long var, Object data, int pduVersion) {
396 switch((int)var) {
397 case 12:
398 case 11:
399 if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
400 break;
401 default:
402 break;
403 }
404 return super.skipVariable(var,data,pduVersion);
405 }
406
407 /**
408 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
409 */
410 public String getAttributeName(long id)
411 throws SnmpStatusException {
412 switch((int)id) {
413 case 23: {
414 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
415 }
416
417 case 22: {
418 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
419 }
420
421 case 21: {
422 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
423 }
424
425 case 9:
426 return "JvmRTBootClassPathSupport";
427
428 case 20: {
429 throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
430 }
431
432 case 8:
433 return "JvmRTManagementSpecVersion";
434
435 case 7:
436 return "JvmRTSpecVersion";
437
438 case 6:
439 return "JvmRTSpecVendor";
440
441 case 5:
442 return "JvmRTSpecName";
443
444 case 4:
445 return "JvmRTVMVersion";
446
447 case 3:
448 return "JvmRTVMVendor";
449
450 case 12:
451 return "JvmRTStartTimeMs";
452
453 case 11:
454 return "JvmRTUptimeMs";
455
456 case 2:
457 return "JvmRTVMName";
458
459 case 1:
460 return "JvmRTName";
461
462 case 10:
463 return "JvmRTInputArgsCount";
464
465 default:
466 break;
467 }
468 throw new SnmpStatusException(SnmpStatusException.noSuchObject);
469 }
470
471 /**
472 * Returns true if "arc" identifies a table object.
473 */
474 public boolean isTable(long arc) {
475
476 switch((int)arc) {
477 case 23:
478 return true;
479 case 22:
480 return true;
481 case 21:
482 return true;
483 case 20:
484 return true;
485 default:
486 break;
487 }
488 return false;
489 }
490
491 /**
492 * Returns the table object identified by "arc".
493 */
494 public SnmpMibTable getTable(long arc) {
495
496 switch((int)arc) {
497 case 23:
498 return tableJvmRTLibraryPathTable;
499 case 22:
500 return tableJvmRTClassPathTable;
501 case 21:
502 return tableJvmRTBootClassPathTable;
503 case 20:
504 return tableJvmRTInputArgsTable;
505 default:
506 break;
507 }
508 return null;
509 }
510
511 /**
512 * Register the group's SnmpMibTable objects with the meta-data.
513 */
514 public void registerTableNodes(SnmpMib mib, MBeanServer server) {
515 tableJvmRTLibraryPathTable = createJvmRTLibraryPathTableMetaNode("JvmRTLibraryPathTable", "JvmRuntime", mib, server);
516 if ( tableJvmRTLibraryPathTable != null) {
517 tableJvmRTLibraryPathTable.registerEntryNode(mib,server);
518 mib.registerTableMeta("JvmRTLibraryPathTable", tableJvmRTLibraryPathTable);
519 }
520
521 tableJvmRTClassPathTable = createJvmRTClassPathTableMetaNode("JvmRTClassPathTable", "JvmRuntime", mib, server);
522 if ( tableJvmRTClassPathTable != null) {
523 tableJvmRTClassPathTable.registerEntryNode(mib,server);
524 mib.registerTableMeta("JvmRTClassPathTable", tableJvmRTClassPathTable);
525 }
526
527 tableJvmRTBootClassPathTable = createJvmRTBootClassPathTableMetaNode("JvmRTBootClassPathTable", "JvmRuntime", mib, server);
528 if ( tableJvmRTBootClassPathTable != null) {
529 tableJvmRTBootClassPathTable.registerEntryNode(mib,server);
530 mib.registerTableMeta("JvmRTBootClassPathTable", tableJvmRTBootClassPathTable);
531 }
532
533 tableJvmRTInputArgsTable = createJvmRTInputArgsTableMetaNode("JvmRTInputArgsTable", "JvmRuntime", mib, server);
534 if ( tableJvmRTInputArgsTable != null) {
535 tableJvmRTInputArgsTable.registerEntryNode(mib,server);
536 mib.registerTableMeta("JvmRTInputArgsTable", tableJvmRTInputArgsTable);
537 }
538
539 }
540
541
542 /**
543 * Factory method for "JvmRTLibraryPathTable" table metadata class.
544 *
545 * You can redefine this method if you need to replace the default
546 * generated metadata class with your own customized class.
547 *
548 * @param tableName Name of the table object ("JvmRTLibraryPathTable")
549 * @param groupName Name of the group to which this table belong ("JvmRuntime")
550 * @param mib The SnmpMib object in which this table is registered
551 * @param server MBeanServer for this table entries (may be null)
552 *
553 * @return An instance of the metadata class generated for the
554 * "JvmRTLibraryPathTable" table (JvmRTLibraryPathTableMeta)
555 *
556 **/
557 protected JvmRTLibraryPathTableMeta createJvmRTLibraryPathTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
558 return new JvmRTLibraryPathTableMeta(mib, objectserver);
559 }
560
561
562 /**
563 * Factory method for "JvmRTClassPathTable" table metadata class.
564 *
565 * You can redefine this method if you need to replace the default
566 * generated metadata class with your own customized class.
567 *
568 * @param tableName Name of the table object ("JvmRTClassPathTable")
569 * @param groupName Name of the group to which this table belong ("JvmRuntime")
570 * @param mib The SnmpMib object in which this table is registered
571 * @param server MBeanServer for this table entries (may be null)
572 *
573 * @return An instance of the metadata class generated for the
574 * "JvmRTClassPathTable" table (JvmRTClassPathTableMeta)
575 *
576 **/
577 protected JvmRTClassPathTableMeta createJvmRTClassPathTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
578 return new JvmRTClassPathTableMeta(mib, objectserver);
579 }
580
581
582 /**
583 * Factory method for "JvmRTBootClassPathTable" table metadata class.
584 *
585 * You can redefine this method if you need to replace the default
586 * generated metadata class with your own customized class.
587 *
588 * @param tableName Name of the table object ("JvmRTBootClassPathTable")
589 * @param groupName Name of the group to which this table belong ("JvmRuntime")
590 * @param mib The SnmpMib object in which this table is registered
591 * @param server MBeanServer for this table entries (may be null)
592 *
593 * @return An instance of the metadata class generated for the
594 * "JvmRTBootClassPathTable" table (JvmRTBootClassPathTableMeta)
595 *
596 **/
597 protected JvmRTBootClassPathTableMeta createJvmRTBootClassPathTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
598 return new JvmRTBootClassPathTableMeta(mib, objectserver);
599 }
600
601
602 /**
603 * Factory method for "JvmRTInputArgsTable" table metadata class.
604 *
605 * You can redefine this method if you need to replace the default
606 * generated metadata class with your own customized class.
607 *
608 * @param tableName Name of the table object ("JvmRTInputArgsTable")
609 * @param groupName Name of the group to which this table belong ("JvmRuntime")
610 * @param mib The SnmpMib object in which this table is registered
611 * @param server MBeanServer for this table entries (may be null)
612 *
613 * @return An instance of the metadata class generated for the
614 * "JvmRTInputArgsTable" table (JvmRTInputArgsTableMeta)
615 *
616 **/
617 protected JvmRTInputArgsTableMeta createJvmRTInputArgsTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
618 return new JvmRTInputArgsTableMeta(mib, objectserver);
619 }
620
621 protected JvmRuntimeMBean node;
622 protected SnmpStandardObjectServer objectserver = null;
623 protected JvmRTLibraryPathTableMeta tableJvmRTLibraryPathTable = null;
624 protected JvmRTClassPathTableMeta tableJvmRTClassPathTable = null;
625 protected JvmRTBootClassPathTableMeta tableJvmRTBootClassPathTable = null;
626 protected JvmRTInputArgsTableMeta tableJvmRTInputArgsTable = null;
627}