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);