1 22 23 package org.snmp4j.agent.agentx.subagent.test; 24 25 28 import org.snmp4j.smi.*; 29 import org.snmp4j.mp.SnmpConstants; 30 import org.snmp4j.agent.*; 31 import org.snmp4j.agent.mo.*; 32 import org.snmp4j.agent.mo.snmp.*; 33 import org.snmp4j.agent.mo.snmp.smi.*; 34 import org.snmp4j.agent.request.*; 35 import org.snmp4j.log.LogFactory; 36 import org.snmp4j.log.LogAdapter; 37 import org.snmp4j.agent.agentx.subagent.DefaultAgentXSharedMOTable; 38 import org.snmp4j.agent.agentx.subagent.AgentXSharedMOTableSupport; 39 import org.snmp4j.agent.agentx.subagent.index.AnyNewIndexOID; 40 import java.util.GregorianCalendar ; 41 42 45 public class AgentppTestMib 46 implements MOGroup 49 { 52 53 private static final LogAdapter LOGGER = 54 LogFactory.getLogger(AgentppTestMib.class); 55 56 59 private MOFactory moFactory = 61 DefaultMOFactory.getInstance(); 62 63 public static final OID oidAgentppTestTimeout = 65 new OID(new int[] { 1,3,6,1,4,1,4976,6,3,1,1,0 }); 66 67 private MOScalar agentppTestTimeout; 69 70 public static final OID oidAgentppTestSharedEntry = 72 new OID(new int[] { 1,3,6,1,4,1,4976,6,3,1,3,1 }); 73 74 public static final OID oidAgentppTestSharedTableIndex = 76 new OID(new int[] { 1,3,6,1,4,1,4976,6,3,1,3,1,1 }); 77 78 public static final String tcModuleSNMPv2Tc = "SNMPv2-TC"; 80 public static final String tcDefDateAndTime = "DateAndTime"; 81 public static final String tcDefRowStatus = "RowStatus"; 82 83 public static final int colAgentppTestSharedTableCreationTime = 2; 85 public static final int colAgentppTestSharedTableDelay = 3; 86 public static final int colAgentppTestSharedTableSession = 4; 87 public static final int colAgentppTestSharedTableRowStatus = 5; 88 89 public static final int idxAgentppTestSharedTableCreationTime = 0; 91 public static final int idxAgentppTestSharedTableDelay = 1; 92 public static final int idxAgentppTestSharedTableSession = 2; 93 public static final int idxAgentppTestSharedTableRowStatus = 3; 94 95 private MOTableSubIndex[] agentppTestSharedEntryIndexes; 96 private MOTableIndex agentppTestSharedEntryIndex; 97 98 private MOTable agentppTestSharedEntry; 99 private MOTableModel agentppTestSharedEntryModel; 100 public static final OID oidAgentppTestSessionsEntry = 101 new OID(new int[] { 1,3,6,1,4,1,4976,6,3,1,4,1 }); 102 103 public static final OID oidAgentppTestSessionIndex = 105 new OID(new int[] { 1,3,6,1,4,1,4976,6,3,1,4,1,1 }); 106 107 109 public static final int colAgentppTestRowCreation = 2; 111 112 public static final int idxAgentppTestRowCreation = 0; 114 115 private MOTableSubIndex[] agentppTestSessionsEntryIndexes; 116 private MOTableIndex agentppTestSessionsEntryIndex; 117 118 private MOTable agentppTestSessionsEntry; 119 private MOTableModel agentppTestSessionsEntryModel; 120 public static final OID oidAgentppTestSparseEntry = 121 new OID(new int[] { 1,3,6,1,4,1,4976,6,3,1,5,1 }); 122 123 public static final OID oidAgentppTestSparseIndex = 125 new OID(new int[] { 1,3,6,1,4,1,4976,6,3,1,5,1,1 }); 126 127 129 public static final int colAgentppTestSparseCol1 = 2; 131 public static final int colAgentppTestSparseCol2 = 3; 132 public static final int colAgentppTestSparseCol3 = 4; 133 public static final int colAgentppTestSparseRowStatus = 5; 134 135 public static final int idxAgentppTestSparseCol1 = 0; 137 public static final int idxAgentppTestSparseCol2 = 1; 138 public static final int idxAgentppTestSparseCol3 = 2; 139 public static final int idxAgentppTestSparseRowStatus = 3; 140 141 private MOTableSubIndex[] agentppTestSparseEntryIndexes; 142 private MOTableIndex agentppTestSparseEntryIndex; 143 144 private MOTable agentppTestSparseEntry; 145 private MOTableModel agentppTestSparseEntryModel; 146 147 148 151 157 protected AgentppTestMib() { 158 } 161 162 171 public AgentppTestMib(MOFactory moFactory) { 172 createMO(moFactory); 173 } 176 177 180 187 protected void createMO(MOFactory moFactory) { 188 agentppTestTimeout = 189 new AgentppTestTimeout(oidAgentppTestTimeout, 190 moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE)); 191 agentppTestTimeout.addMOValueValidationListener(new AgentppTestTimeoutValidator()); 192 createAgentppTestSharedEntry(moFactory); 193 createAgentppTestSessionsEntry(moFactory); 194 createAgentppTestSparseEntry(moFactory); 195 } 196 197 198 public MOTable getAgentppTestSharedEntry() { 199 return agentppTestSharedEntry; 200 } 201 202 203 private void createAgentppTestSharedEntry(MOFactory moFactory) { 204 agentppTestSharedEntryIndexes = 206 new MOTableSubIndex[] { 207 moFactory.createSubIndex(oidAgentppTestSharedTableIndex, 208 SMIConstants.SYNTAX_INTEGER, 1, 1) }; 209 210 agentppTestSharedEntryIndex = 211 moFactory.createIndex(agentppTestSharedEntryIndexes, 212 false, 213 new MOTableIndexValidator() { 214 public boolean isValidIndex(OID index) { 215 boolean isValidIndex = true; 216 return isValidIndex; 219 } 220 }); 221 222 MOColumn[] agentppTestSharedEntryColumns = new MOColumn[4]; 224 agentppTestSharedEntryColumns[idxAgentppTestSharedTableCreationTime] = 225 moFactory.createColumn(colAgentppTestSharedTableCreationTime, 226 SMIConstants.SYNTAX_OCTET_STRING, 227 moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_ONLY), 228 tcModuleSNMPv2Tc, 229 tcDefDateAndTime); 230 agentppTestSharedEntryColumns[idxAgentppTestSharedTableDelay] = 231 moFactory.createColumn(colAgentppTestSharedTableDelay, 232 SMIConstants.SYNTAX_INTEGER32, 233 moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE), 234 new Integer32(0), 235 true); 236 ValueConstraint agentppTestSharedTableDelayVC = new ConstraintsImpl(); 237 ((ConstraintsImpl)agentppTestSharedTableDelayVC).add(new Constraint(0L, 6000L)); 238 ((MOMutableColumn)agentppTestSharedEntryColumns[idxAgentppTestSharedTableDelay]). 239 addMOValueValidationListener(new ValueConstraintValidator(agentppTestSharedTableDelayVC)); 240 ((MOMutableColumn)agentppTestSharedEntryColumns[idxAgentppTestSharedTableDelay]). 241 addMOValueValidationListener(new AgentppTestSharedTableDelayValidator()); 242 agentppTestSharedEntryColumns[idxAgentppTestSharedTableSession] = 243 moFactory.createColumn(colAgentppTestSharedTableSession, 244 SMIConstants.SYNTAX_GAUGE32, 245 moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_ONLY)); 246 agentppTestSharedEntryColumns[idxAgentppTestSharedTableRowStatus] = 247 moFactory.createColumn(colAgentppTestSharedTableRowStatus, 248 SMIConstants.SYNTAX_INTEGER, 249 moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE), 250 tcModuleSNMPv2Tc, 251 tcDefRowStatus); 252 ((MOMutableColumn)agentppTestSharedEntryColumns[idxAgentppTestSharedTableRowStatus]). 253 addMOValueValidationListener(new AgentppTestSharedTableRowStatusValidator()); 254 agentppTestSharedEntryModel = 256 moFactory.createTableModel(oidAgentppTestSharedEntry, 257 agentppTestSharedEntryIndex, 258 agentppTestSharedEntryColumns); 259 ((MOMutableTableModel)agentppTestSharedEntryModel).setRowFactory( 260 new AgentppTestSharedEntryRowFactory()); 261 agentppTestSharedEntry = 262 moFactory.createTable(oidAgentppTestSharedEntry, 263 agentppTestSharedEntryIndex, 264 agentppTestSharedEntryColumns, 265 agentppTestSharedEntryModel); 266 } 267 268 public MOTable getAgentppTestSessionsEntry() { 269 return agentppTestSessionsEntry; 270 } 271 272 273 private void createAgentppTestSessionsEntry(MOFactory moFactory) { 274 agentppTestSessionsEntryIndexes = 276 new MOTableSubIndex[] { 277 moFactory.createSubIndex(oidAgentppTestSessionIndex, 278 SMIConstants.SYNTAX_INTEGER, 1, 1) }; 279 280 agentppTestSessionsEntryIndex = 281 moFactory.createIndex(agentppTestSessionsEntryIndexes, 282 false, 283 new MOTableIndexValidator() { 284 public boolean isValidIndex(OID index) { 285 boolean isValidIndex = true; 286 return isValidIndex; 289 } 290 }); 291 292 MOColumn[] agentppTestSessionsEntryColumns = new MOColumn[1]; 294 agentppTestSessionsEntryColumns[idxAgentppTestRowCreation] = 295 moFactory.createColumn(colAgentppTestRowCreation, 296 SMIConstants.SYNTAX_GAUGE32, 297 moFactory.createAccess( 298 MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE), 299 new UnsignedInteger32(0), 300 true); 301 ((MOMutableColumn)agentppTestSessionsEntryColumns[idxAgentppTestRowCreation]). 302 addMOValueValidationListener(new AgentppTestRowCreationValidator()); 303 agentppTestSessionsEntryModel = 305 moFactory.createTableModel(oidAgentppTestSessionsEntry, 306 agentppTestSessionsEntryIndex, 307 agentppTestSessionsEntryColumns); 308 ((MOMutableTableModel)agentppTestSessionsEntryModel).setRowFactory( 309 new AgentppTestSessionsEntryRowFactory()); 310 agentppTestSessionsEntry = 311 moFactory.createTable(oidAgentppTestSessionsEntry, 312 agentppTestSessionsEntryIndex, 313 agentppTestSessionsEntryColumns, 314 agentppTestSessionsEntryModel); 315 } 316 317 public MOTable getAgentppTestSparseEntry() { 318 return agentppTestSparseEntry; 319 } 320 321 322 private void createAgentppTestSparseEntry(MOFactory moFactory) { 323 agentppTestSparseEntryIndexes = 325 new MOTableSubIndex[] { 326 moFactory.createSubIndex(oidAgentppTestSparseIndex, 327 SMIConstants.SYNTAX_OCTET_STRING, 0, 255) 328 }; 329 330 agentppTestSparseEntryIndex = 331 moFactory.createIndex(agentppTestSparseEntryIndexes, 332 false, 333 new MOTableIndexValidator() { 334 public boolean isValidIndex(OID index) { 335 boolean isValidIndex = true; 336 return isValidIndex; 339 } 340 }); 341 342 MOColumn[] agentppTestSparseEntryColumns = new MOColumn[4]; 344 agentppTestSparseEntryColumns[idxAgentppTestSparseCol1] = 345 moFactory.createColumn(colAgentppTestSparseCol1, 346 SMIConstants.SYNTAX_INTEGER32, 347 moFactory.createAccess( 348 MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE), 349 new Integer32(1), 350 true); 351 ((MOMutableColumn)agentppTestSparseEntryColumns[idxAgentppTestSparseCol1]). 352 addMOValueValidationListener(new AgentppTestSparseCol1Validator()); 353 agentppTestSparseEntryColumns[idxAgentppTestSparseCol2] = 354 moFactory.createColumn(colAgentppTestSparseCol2, 355 SMIConstants.SYNTAX_GAUGE32, 356 moFactory.createAccess( 357 MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE), 358 new Gauge32(2), 359 true); 360 ((MOMutableColumn)agentppTestSparseEntryColumns[idxAgentppTestSparseCol2]). 361 addMOValueValidationListener(new AgentppTestSparseCol2Validator()); 362 agentppTestSparseEntryColumns[idxAgentppTestSparseCol3] = 363 moFactory.createColumn(colAgentppTestSparseCol3, 364 SMIConstants.SYNTAX_OCTET_STRING, 365 moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE), 366 new OctetString(new byte[] { (byte)51 }), 367 true); 368 ValueConstraint agentppTestSparseCol3VC = new ConstraintsImpl(); 369 ((ConstraintsImpl)agentppTestSparseCol3VC).add(new Constraint(0L, 255L)); 370 ((MOMutableColumn)agentppTestSparseEntryColumns[idxAgentppTestSparseCol3]). 371 addMOValueValidationListener(new ValueConstraintValidator(agentppTestSparseCol3VC)); 372 ((MOMutableColumn)agentppTestSparseEntryColumns[idxAgentppTestSparseCol3]). 373 addMOValueValidationListener(new AgentppTestSparseCol3Validator()); 374 agentppTestSparseEntryColumns[idxAgentppTestSparseRowStatus] = 375 moFactory.createColumn(colAgentppTestSparseRowStatus, 376 SMIConstants.SYNTAX_INTEGER, 377 moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE), 378 tcModuleSNMPv2Tc, 379 tcDefRowStatus); 380 ((MOMutableColumn)agentppTestSparseEntryColumns[idxAgentppTestSparseRowStatus]). 381 addMOValueValidationListener(new AgentppTestSparseRowStatusValidator()); 382 agentppTestSparseEntryModel = 384 moFactory.createTableModel(oidAgentppTestSparseEntry, 385 agentppTestSparseEntryIndex, 386 agentppTestSparseEntryColumns); 387 ((MOMutableTableModel)agentppTestSparseEntryModel).setRowFactory( 388 new AgentppTestSparseEntryRowFactory()); 389 agentppTestSparseEntry = 390 moFactory.createTable(oidAgentppTestSparseEntry, 391 agentppTestSparseEntryIndex, 392 agentppTestSparseEntryColumns, 393 agentppTestSparseEntryModel); 394 } 395 396 397 398 public void registerMOs(MOServer server, OctetString context) 399 throws DuplicateRegistrationException 400 { 401 server.register(this.agentppTestTimeout, context); 403 server.register(this.agentppTestSharedEntry, context); 404 server.register(this.agentppTestSessionsEntry, context); 405 server.register(this.agentppTestSparseEntry, context); 406 for (int i=0; i<10; i++) { 408 Variable[] vbs = agentppTestSparseEntry.getDefaultValues(); 409 vbs[idxAgentppTestSparseRowStatus] = new Integer32(RowStatus.active); 410 MOTableRow row = 411 agentppTestSparseEntry.createRow(new AnyNewIndexOID( 412 new int[] { 1, i }), vbs); 413 agentppTestSparseEntry.addRow(row); 414 } 415 } 417 418 public void unregisterMOs(MOServer server, OctetString context) { 419 server.unregister(this.agentppTestTimeout, context); 421 server.unregister(this.agentppTestSharedEntry, context); 422 server.unregister(this.agentppTestSessionsEntry, context); 423 server.unregister(this.agentppTestSparseEntry, context); 424 } 427 428 430 public class AgentppTestTimeout extends MOScalar { 432 AgentppTestTimeout(OID oid, MOAccess access) { 433 super(oid, access, new UnsignedInteger32()); 434 } 437 438 public int isValueOK(SubRequest request) { 439 Variable newValue = 440 request.getVariableBinding().getVariable(); 441 int valueOK = super.isValueOK(request); 442 if (valueOK != SnmpConstants.SNMP_ERROR_SUCCESS) { 443 return valueOK; 444 } 445 long v = ((UnsignedInteger32)newValue).getValue(); 446 if (!(((v >= 0L) && (v <= 1000000L)))) { 447 valueOK = SnmpConstants.SNMP_ERROR_WRONG_VALUE; 448 } 449 return valueOK; 452 } 453 454 public Variable getValue() { 455 return super.getValue(); 458 } 459 460 public int setValue(Variable newValue) { 461 return super.setValue(newValue); 464 } 465 466 469 } 470 471 472 477 static class AgentppTestTimeoutValidator implements MOValueValidationListener { 478 479 public void validate(MOValueValidationEvent validationEvent) { 480 Variable newValue = validationEvent.getNewValue(); 481 long v = ((UnsignedInteger32)newValue).getValue(); 482 if (!(((v >= 0L) && (v <= 1000000L)))) { 483 validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_VALUE); 484 return; 485 } 486 } 489 } 490 491 495 static class AgentppTestSharedTableDelayValidator implements MOValueValidationListener { 496 497 public void validate(MOValueValidationEvent validationEvent) { 498 Variable newValue = validationEvent.getNewValue(); 499 long v = ((Integer32)newValue).getValue(); 500 if (!(((v >= 0L) && (v <= 6000L)))) { 501 validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_VALUE); 502 return; 503 } 504 } 507 } 508 512 static class AgentppTestSharedTableRowStatusValidator implements MOValueValidationListener { 513 514 public void validate(MOValueValidationEvent validationEvent) { 515 Variable newValue = validationEvent.getNewValue(); 516 } 519 } 520 524 static class AgentppTestRowCreationValidator implements MOValueValidationListener { 525 526 public void validate(MOValueValidationEvent validationEvent) { 527 Variable newValue = validationEvent.getNewValue(); 528 } 531 } 532 536 static class AgentppTestSparseCol1Validator implements MOValueValidationListener { 537 538 public void validate(MOValueValidationEvent validationEvent) { 539 Variable newValue = validationEvent.getNewValue(); 540 } 543 } 544 548 static class AgentppTestSparseCol2Validator implements MOValueValidationListener { 549 550 public void validate(MOValueValidationEvent validationEvent) { 551 Variable newValue = validationEvent.getNewValue(); 552 } 555 } 556 560 static class AgentppTestSparseCol3Validator implements MOValueValidationListener { 561 562 public void validate(MOValueValidationEvent validationEvent) { 563 Variable newValue = validationEvent.getNewValue(); 564 OctetString os = (OctetString)newValue; 565 if (!(((os.length() >= 0) && (os.length() <= 255)))) { 566 validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH); 567 return; 568 } 569 } 572 } 573 577 static class AgentppTestSparseRowStatusValidator implements MOValueValidationListener { 578 579 public void validate(MOValueValidationEvent validationEvent) { 580 Variable newValue = validationEvent.getNewValue(); 581 } 584 } 585 586 public class AgentppTestSharedEntryRow extends DefaultMOMutableRow2PC { 588 public AgentppTestSharedEntryRow(OID index, Variable[] values) { 589 super(index, values); 590 } 591 592 public OctetString getAgentppTestSharedTableCreationTime() { 593 return (OctetString) getValue(idxAgentppTestSharedTableCreationTime); 594 } 595 596 public void setAgentppTestSharedTableCreationTime(OctetString newValue) { 597 setValue(idxAgentppTestSharedTableCreationTime, newValue); 598 } 599 600 public Integer32 getAgentppTestSharedTableDelay() { 601 return (Integer32) getValue(idxAgentppTestSharedTableDelay); 602 } 603 604 public void setAgentppTestSharedTableDelay(Integer32 newValue) { 605 setValue(idxAgentppTestSharedTableDelay, newValue); 606 } 607 608 public UnsignedInteger32 getAgentppTestSharedTableSession() { 609 return (UnsignedInteger32) getValue(idxAgentppTestSharedTableSession); 610 } 611 612 public void setAgentppTestSharedTableSession(UnsignedInteger32 newValue) { 613 setValue(idxAgentppTestSharedTableSession, newValue); 614 } 615 616 public Integer32 getAgentppTestSharedTableRowStatus() { 617 return (Integer32) getValue(idxAgentppTestSharedTableRowStatus); 618 } 619 620 public void setAgentppTestSharedTableRowStatus(Integer32 newValue) { 621 setValue(idxAgentppTestSharedTableRowStatus, newValue); 622 } 623 624 626 private void delayRequest() { 627 long delay = values[idxAgentppTestSharedTableDelay].toInt() * 10; 628 if (delay > 0) { 629 try { 630 Thread.sleep(delay); 631 } 632 catch (InterruptedException ex) { 633 } 634 } 635 } 636 637 public Variable getValue(int column) { 638 delayRequest(); 639 return super.getValue(column); 640 } 641 642 public void commit(SubRequest subRequest, MOTableRow changeSet, int column) { 643 delayRequest(); 644 super.commit(subRequest, changeSet, column); 645 } 646 647 } 649 650 class AgentppTestSharedEntryRowFactory 651 extends DefaultMOMutableRow2PCFactory 652 { 653 public synchronized MOTableRow createRow(OID index, Variable[] values) 654 throws UnsupportedOperationException 655 { 656 AgentppTestSharedEntryRow row = new AgentppTestSharedEntryRow(index, values); 657 return row; 660 } 661 662 public synchronized void freeRow(MOTableRow row) { 663 } 666 667 } 670 public class AgentppTestSessionsEntryRow extends DefaultMOMutableRow2PC { 671 public AgentppTestSessionsEntryRow(OID index, Variable[] values) { 672 super(index, values); 673 } 674 675 public UnsignedInteger32 getAgentppTestRowCreation() { 676 return (UnsignedInteger32) getValue(idxAgentppTestRowCreation); 677 } 678 679 public void setAgentppTestRowCreation(UnsignedInteger32 newValue) { 680 setValue(idxAgentppTestRowCreation, newValue); 681 } 682 683 public void commitRow(SubRequest subRequest, MOTableRow changeSet) { 685 int newRowIndex = 686 changeSet.getValue(idxAgentppTestRowCreation).toInt(); 687 if (newRowIndex != 0) { 688 OID newIndex = new OID(new int[] { newRowIndex}); 689 Variable[] values = agentppTestSharedEntry.getDefaultValues(); 690 values[idxAgentppTestSharedTableRowStatus] = 691 new Integer32(RowStatus.active); 692 values[idxAgentppTestSharedTableCreationTime] = 693 DateAndTime.makeDateAndTime(new GregorianCalendar ()); 694 values[idxAgentppTestSharedTableSession] = 695 new UnsignedInteger32(getIndex().get(0)); 696 MOTableRow row = agentppTestSharedEntry.createRow(newIndex, values); 697 if (row != null) { 698 if (!agentppTestSharedEntry.addRow(row)) { 699 ((UnsignedInteger32) changeSet.getValue(idxAgentppTestRowCreation)). 700 setValue(0); 701 } 702 } 703 else { 704 ((UnsignedInteger32) changeSet.getValue(idxAgentppTestRowCreation)). 705 setValue(0); 706 } 707 } 708 } 709 } 711 712 class AgentppTestSessionsEntryRowFactory 713 extends DefaultMOMutableRow2PCFactory 714 { 715 public synchronized MOTableRow createRow(OID index, Variable[] values) 716 throws UnsupportedOperationException 717 { 718 AgentppTestSessionsEntryRow row = new AgentppTestSessionsEntryRow(index, values); 719 return row; 722 } 723 724 public synchronized void freeRow(MOTableRow row) { 725 } 728 729 } 732 public class AgentppTestSparseEntryRow extends DefaultMOMutableRow2PC { 733 public AgentppTestSparseEntryRow(OID index, Variable[] values) { 734 super(index, values); 735 } 736 737 public Integer32 getAgentppTestSparseCol1() { 738 return (Integer32) getValue(idxAgentppTestSparseCol1); 739 } 740 741 public void setAgentppTestSparseCol1(Integer32 newValue) { 742 setValue(idxAgentppTestSparseCol1, newValue); 743 } 744 745 public Gauge32 getAgentppTestSparseCol2() { 746 return (Gauge32) getValue(idxAgentppTestSparseCol2); 747 } 748 749 public void setAgentppTestSparseCol2(Gauge32 newValue) { 750 setValue(idxAgentppTestSparseCol2, newValue); 751 } 752 753 public OctetString getAgentppTestSparseCol3() { 754 return (OctetString) getValue(idxAgentppTestSparseCol3); 755 } 756 757 public void setAgentppTestSparseCol3(OctetString newValue) { 758 setValue(idxAgentppTestSparseCol3, newValue); 759 } 760 761 public Integer32 getAgentppTestSparseRowStatus() { 762 return (Integer32) getValue(idxAgentppTestSparseRowStatus); 763 } 764 765 public void setAgentppTestSparseRowStatus(Integer32 newValue) { 766 setValue(idxAgentppTestSparseRowStatus, newValue); 767 } 768 769 771 public void setValue(int column, Variable value) { 772 if (column != idxAgentppTestSparseRowStatus) { 773 if (value.equals(getValue(column))) { 774 super.setValue(column, null); 775 return; 776 } 777 } 778 super.setValue(column, value); 779 } 780 781 } 783 784 class AgentppTestSparseEntryRowFactory 785 extends DefaultMOMutableRow2PCFactory 786 { 787 public synchronized MOTableRow createRow(OID index, Variable[] values) 788 throws UnsupportedOperationException 789 { 790 AgentppTestSparseEntryRow row = new AgentppTestSparseEntryRow(index, values); 791 return row; 794 } 795 796 public synchronized void freeRow(MOTableRow row) { 797 } 800 801 } 804 805 806 public static MOFactory getSharedTableFactory() { 808 return new AgentppTestMOFactory(); 809 } 810 812 static class AgentppTestMOFactory extends DefaultMOFactory { 814 public MOTable createTable(OID oid, MOTableIndex indexDef, 815 MOColumn[] columns) { 816 if (oidAgentppTestSessionsEntry.equals(oid)) { 817 return new DefaultAgentXSharedMOTable(oid, indexDef, columns) { 818 public void setAgentXSharedMOTableSupport(AgentXSharedMOTableSupport 819 sharedTableSupport) { 820 super.setAgentXSharedMOTableSupport(sharedTableSupport); 821 ((MOMutableTableModel)model).clear(); 822 OID index = 823 new OID(new int[] { sharedTableSupport.getSession().getSessionID() }); 824 MOTableRow row = createRow(index); 825 if (row != null) { 826 addRow(row); 827 } 828 } 829 }; 830 } 831 return new DefaultAgentXSharedMOTable(oid, indexDef, columns); 832 } 833 834 public MOTable createTable(OID oid, MOTableIndex indexDef, MOColumn[] columns, 835 MOTableModel model) { 836 DefaultAgentXSharedMOTable table = 837 (DefaultAgentXSharedMOTable) createTable(oid, indexDef, columns); 838 table.setModel(model); 839 return table; 840 } 841 842 } 843 845 } 848 849 850 | Popular Tags |