Ejemplo n.º 1
0
 /**
  * Gets the trap event LogMsg.
  *
  * @param trap the trap object
  * @return the trap event LogMsg
  */
 protected Logmsg getTrapEventLogmsg(Notification trap) {
   Logmsg msg = new Logmsg();
   msg.setDest("logndisplay");
   final StringBuffer dbuf = new StringBuffer();
   dbuf.append("<p>");
   dbuf.append("\n");
   dbuf.append("\t").append(trap.getId()).append(" trap received\n");
   int vbNum = 1;
   for (SmiVariable var : trap.getObjects()) {
     dbuf.append("\t").append(var.getId()).append("=%parm[#").append(vbNum).append("]%\n");
     vbNum++;
   }
   if (dbuf.charAt(dbuf.length() - 1) == '\n') {
     dbuf.deleteCharAt(dbuf.length() - 1); // delete the \n at the end
   }
   dbuf.append("</p>\n\t");
   msg.setContent(dbuf.toString());
   return msg;
 }
Ejemplo n.º 2
0
  public Logmsg getTrapEventLogmsg(MibValueSymbol trapValueSymbol) {
    Logmsg msg = new Logmsg();
    msg.setDest("logndisplay");

    final StringBuffer dbuf = new StringBuffer();
    dbuf.append("<p>");
    dbuf.append("\n");
    dbuf.append("\t").append(trapValueSymbol.getName()).append(" trap received\n");
    int vbNum = 1;
    for (MibValue vb : getTrapVars(trapValueSymbol)) {
      dbuf.append("\t").append(vb.getName()).append("=%parm[#").append(vbNum).append("]%\n");
      vbNum++;
    }

    if (dbuf.charAt(dbuf.length() - 1) == '\n') {
      dbuf.deleteCharAt(dbuf.length() - 1); // delete the \n at the end
    }
    dbuf.append("</p>\n\t");

    msg.setContent(dbuf.toString());

    return msg;
  }