[SNMP4J] how to update MoTableModel Row (not the first and last :) HELP ME!

Frank Fock fock at agentpp.com
Mon Jan 18 20:07:45 CET 2010


Hello Jean,

Both ways should work. As you did not share
which exceptions occur and how your rows
have been initialized, we cannot help
further.

Regards,
Frank

On 18.01.2010 17:05, Jean.Bauwin at sita.aero wrote:
> Hello,
>
> I try to update my DefaultMoTable defines as :
>
> private static DefaultMOTable createModuleTable() {
>
>                  MOTableSubIndex[] subIndexes = new MOTableSubIndex[] { new
> MOTableSubIndex(
>                                  SMIConstants.SYNTAX_INTEGER) };
>                  MOTableIndex indexDef = new MOTableIndex(subIndexes, false
> );
>                  MOColumn[] columns = new MOColumn[3];
>                  int c = 0;
>
>                  columns[c++] = new MOColumn(c, SMIConstants.
> SYNTAX_INTEGER32,MOAccessImpl.ACCESS_READ_ONLY);// module number
>                  columns[c++] = new MOColumn(c, SMIConstants.
> SYNTAX_OCTET_STRING,MOAccessImpl.ACCESS_READ_ONLY);// module name
>                  columns[c++] = new MOColumn(c, SMIConstants.
> SYNTAX_INTEGER32,MOAccessImpl.ACCESS_READ_ONLY);// module status
>
>                  ifTableModule = new DefaultMOTable(new OID(
> "1.3.6.1.4.1.881.5.3.200.1.2.1"),
>                                  indexDef, columns);
>                  model = (MOMutableTableModel) ifTableModule.getModel();
>                  rowValues2 = new Variable[] { new Integer32(1), new
> OctetString("EVATIS-M"), new Integer32(0) };
>                  rowValues3 = new Variable[] { new Integer32(2), new
> OctetString("EVATIS-B"), new Integer32(0) };
>                  rowValues4 = new Variable[] { new Integer32(3), new
> OctetString("EVATIS-I"), new Integer32(0) };
>                  rowValues5 = new Variable[] { new Integer32(4), new
> OctetString("CATS-A"), new Integer32(0) };
>                  rowValues6 = new Variable[] { new Integer32(5), new
> OctetString("CATS-D"), new Integer32(0) };
>                  model.addRow(new DefaultMOMutableRow2PC(new OID("1"),
> rowValues2));
>                  model.addRow(new DefaultMOMutableRow2PC(new OID("2"),
> rowValues3));
>                  model.addRow(new DefaultMOMutableRow2PC(new OID("3"),
> rowValues4));
>                  model.addRow(new DefaultMOMutableRow2PC(new OID("4"),
> rowValues5));
>                  model.addRow(new DefaultMOMutableRow2PC(new OID("5"),
> rowValues6));
>                  ifTableModule.setVolatile(true);
>
>                  return ifTableModule;
>          }
>
> It's easy to update the firstand last row ans the culums.
>
> But i dont understand how to update the row 3 colums 3 for example.
>
> I have tried this :
>
>            ifTableModule.getModel().iterator().next();
>              ifTableModule.getModel().iterator().next();
>              MOMutableTableRow l_row = (MOMutableTableRow) ifTableModule
> .getModel().iterator().next();
>            // row 3 no ?
>            //colum 2 ??
>              l_row.setValue(2, new Integer32(1));
>
>
> but i have an error during the execution...
>
> i have also tried this :
>
>              MOMutableTableRow l_row = (MOMutableTableRow) ifTableEvatis
> .getModel().getRow(new OID("3"));
>              l_row.setValue(3, new Integer32(1));
>
> exception ...
>
> What is the easy way to update a particuar row / colum in my
> DeafaultMotable(for example row 3 colum 3 of my table?)
>
> Thank you in advance for you answers !!
>
> Jean Bauwin
> Aircom Engineer
> +33 (0)1 46 41 10 80
>
> This document is strictly confidential and intended only for use by the addressee unless otherwise stated.  If you are not the intended recipient, please notify the sender immediately and delete it from your system.
>
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list