public int getScalarValue(OID scalarInstanceOID, Variable value) {
MBeanActionMOInfo mBeanActionMOInfo = getActionInfo(scalarInstanceOID);
if (mBeanActionMOInfo != null) {
// get state
Integer32 v = (Integer32)value;
for (MBeanStateInfo stateInfo : mBeanActionMOInfo.getStates()) {
// check for default state
if (stateInfo.getStateAttribute() == null) {
v.setValue(stateInfo.getStateID());
return PDU.noError;
}
try {
Object attr;
if (stateInfo.getStateAttribute().getName() == null) {
attr = mBeanActionMOInfo.getLastActionResult();
}
else {
attr = MBeanAttributeMOInfo.getAttribute(server,
mBeanActionMOInfo.getObjectName(),
stateInfo.getStateAttribute());
}
if (((attr == null) && (stateInfo.getStateIndication() == null)) ||
((attr != null) && attr.equals(stateInfo.getStateIndication()))) {
v.setValue(stateInfo.getStateID());
return PDU.noError;
}
}
catch (Exception ex) {
// ignore