[SNMP4J] [help]newbie Q:How to update a tableRow use SET from
wei tong
thinkinrelativity at gmail.com
Sun Jun 21 03:52:06 CEST 2009
hi folks,
i've solved the problem when i use SET pdu to update rows in the V3 agent;
MOMutableColumn and DefaultMOMutableRow2PCFactory is my key.
Is that a good way?
but here's the Question
-------------------------------------------------------------------------------------------
in DefaultMOMutableRow2PCFactory.java ,
what's the word 'PC' in the name meaning?
why freeRow() do nothing by default?what the function for?
-------------------------------------------------------------------------------------------
codes here:
MOMutableColumn[] columns = new MOMutableColumn[2];
int c = 0;
/*
* use MOMutableColumn instead of MotableColumn ,so that the column
ACCESS_READ_CREATE supported
/*
columns[c++] = new MOMutableColumn(c, SMIConstants.SYNTAX_INTEGER,
MOAccessImpl.ACCESS_READ_CREATE);// Index
columns[c++] = new MOMutableColumn(c, SMIConstants.SYNTAX_OCTET_STRING,
MOAccessImpl.ACCESS_READ_CREATE);// IP
DefaultMOTable ifTable = new DefaultMOTable(new OID(
"1.3.6.1.4.1.750.1.2.9.1"), indexDef, columns);
DefaultMOMutableTableModel model = (DefaultMOMutableTableModel)
ifTable.getModel();
Variable[] rowValues1 = new Variable[] { new Integer32(1),
new OctetString("192.168.1.201") };
model.addRow(new DefaultMOMutableRow2PC(new OID("1"), rowValues1));
/*
* this is very important ,
* if (rowFactoy == null), it throw ex,and you will gei"object cannot
be created"
/*
model.setRowFactory(new DefaultMOMutableRow2PCFactory());
yours
Tony Wii
More information about the SNMP4J
mailing list