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