FileDocCategorySizeDatePackage
AcknowledgeActiveAlarmsServlet.javaAPI DocJBoss 4.2.13312Fri Jul 13 21:02:14 BST 2007org.jboss.console.plugins.monitor

AcknowledgeActiveAlarmsServlet

public class AcknowledgeActiveAlarmsServlet extends HttpServlet
author
Dimitris Andreadis.
version
$Revision: 57191 $

Fields Summary
Constructors Summary
Methods Summary
protected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

      doit(req, resp);
   
protected voiddoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

      doit(req, resp);
   
protected voiddoit(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

      try
      {
         MBeanServer server = MBeanServerLocator.locateJBoss();
         ObjectName target = ActiveAlarmTableMBean.OBJECT_NAME;

         // use the alarm table serverId for 'system' 
         String system = (String)server.getAttribute(target, "ServerId");
         // use the user.name environment property for user
         String user = System.getProperty("user.name");
         
         String alarmId = req.getParameter("alarmId").trim();
         
         if (alarmId.equals("*"))
         {
            server.invoke(
                  target,
                  "acknowledgeAll",
                  new Object[] { user, system },
                  new String[] { "java.lang.String", "java.lang.String" });
         }
         else
         {
            server.invoke(
                  target,
                  "acknowledge",
                  new Object[] { alarmId, user, system },
                  new String[] { "java.lang.String", "java.lang.String", "java.lang.String" });
         }
      }
      catch (Exception ex)
      {
         req.setAttribute("error", "Error acknowledging alarms: " + ex.toString());
      }
      req.getRequestDispatcher("/listActiveAlarmTable.jsp").forward(req, resp);