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 DestinationAddConfirmAction extends JonasBaseAction {
19:
20: public ActionForward executeAction(ActionMapping mapping,
21: ActionForm form, HttpServletRequest request,
22: HttpServletResponse response) throws IOException,
23: ServletException {
24:
25: WhereAreYou oWhere = (WhereAreYou) request.getSession()
26: .getAttribute(WhereAreYou.SESSION_NAME);
27: String serverName = oWhere.getCurrentJonasServerName();
28: String domainName = oWhere.getCurrentDomainName();
29:
30: DestinationAddConfirmForm fBean = (DestinationAddConfirmForm) form;
31: try {
32: //ObjectName mbName = ObjectNames.getConnectorON();
33: ObjectName mbName = MqObjectNames.getConnectorONByName(
34: domainName, (String) m_Session
35: .getAttribute("mqconnector"));
36: boolean isTopic = fBean.getType().toLowerCase().equals(
37: "topic");
38: Object[] params = { isTopic ? Boolean.TRUE : Boolean.FALSE,
39: fBean.getName(), fBean.getProprieties() };
40: String[] signature = { "boolean", "java.lang.String",
41: "java.lang.String" };
42: /*
43: * FWA begin
44: */
45:
46: /*
47: * FWA end
48: */
49: JonasManagementRepr.invoke(mbName, "createDestination",
50: params, signature, serverName);
51: } catch (Throwable t) {
52: addGlobalError(t);
53: saveErrors(request, m_Errors);
54: return (mapping.findForward("Global Error"));
55: }
56: return mapping.findForward("JonasMqConnectDestinationsAction");
57: }
58: }
|