01: package org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect;
02:
03: import java.io.IOException;
04:
05: import javax.management.ObjectName;
06: import javax.servlet.ServletException;
07: import javax.servlet.http.HttpServletRequest;
08: import javax.servlet.http.HttpServletResponse;
09:
10: import org.apache.struts.action.ActionForm;
11: import org.apache.struts.action.ActionForward;
12: import org.apache.struts.action.ActionMapping;
13: import org.objectweb.jonas.jmx.JonasManagementRepr;
14: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
15: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
16: import org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect.util.MqObjectNames;
17:
18: public class DestinationDeleteConfirmAction extends JonasBaseAction {
19:
20: public ActionForward executeAction(ActionMapping mapping,
21: ActionForm form, HttpServletRequest request,
22: HttpServletResponse response) throws IOException,
23: ServletException {
24:
25: DestinationDeleteForm fBean = (DestinationDeleteForm) form;
26:
27: WhereAreYou oWhere = (WhereAreYou) request.getSession()
28: .getAttribute(WhereAreYou.SESSION_NAME);
29: String serverName = oWhere.getCurrentJonasServerName();
30: String domainName = oWhere.getCurrentDomainName();
31:
32: try {
33: ObjectName mbName = MqObjectNames.getConnectorONByName(
34: domainName, (String) m_Session
35: .getAttribute("mqconnector"));
36: String[] destinations = {};
37: if (fBean.getDestinationsStr() != null) {
38: destinations = fBean.getDestinationsStr().split(";");
39: }
40: boolean deletePhysicalDestinations = false;
41: if (fBean.getDeletePhysicalDestination() != null) {
42: deletePhysicalDestinations = fBean
43: .getDeletePhysicalDestination().toLowerCase()
44: .equals("yes");
45: }
46: for (int i = 0; i < destinations.length; i++) {
47: String jndiName = destinations[i];
48: Object[] params = {
49: jndiName,
50: deletePhysicalDestinations ? Boolean.TRUE
51: : Boolean.FALSE };
52: String[] signature = { "java.lang.String", "boolean" };
53: JonasManagementRepr.invoke(mbName, "deleteDestination",
54: params, signature, serverName);
55: }
56: } catch (Throwable t) {
57: addGlobalError(t);
58: saveErrors(request, m_Errors);
59: return (mapping.findForward("Global Error"));
60: }
61: return mapping.findForward("JonasMqConnectDestinationsAction");
62: }
63: }
|